diff options
Diffstat (limited to 'irc.c')
-rw-r--r-- | irc.c | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -31,6 +31,12 @@ static gboolean irc_userping( gpointer _irc ); GSList *irc_connection_list = NULL; +static char *passchange (irc_t *irc, void *set, char *value) +{ + irc_setpass (irc, value); + return (NULL); +} + irc_t *irc_new( int fd ) { irc_t *irc = g_new0( irc_t, 1 ); @@ -128,6 +134,7 @@ irc_t *irc_new( int fd ) set_add( irc, "strip_html", "true", NULL ); set_add( irc, "to_char", ": ", set_eval_to_char ); set_add( irc, "typing_notice", "false", set_eval_bool ); + set_add( irc, "password", NULL, passchange); conf_loaddefaults( irc ); @@ -153,7 +160,7 @@ void irc_free(irc_t * irc) log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd ); if( irc->status >= USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) ) - if( !bitlbee_save( irc ) ) + if( storage_save( irc, TRUE ) != STORAGE_OK ) irc_usermsg( irc, "Error while saving settings!" ); if( irc->ping_source_id > 0 ) @@ -260,6 +267,20 @@ void irc_free(irc_t * irc) g_main_quit( global.loop ); } +/* USE WITH CAUTION! + Sets pass without checking */ +void irc_setpass (irc_t *irc, const char *pass) +{ + if (irc->password) g_free (irc->password); + + if (pass) { + irc->password = g_strdup (pass); + irc_usermsg (irc, "Password successfully changed"); + } else { + irc->password = NULL; + } +} + int irc_process( irc_t *irc ) { char **lines, *temp; @@ -1509,7 +1530,7 @@ int irc_privmsg( irc_t *irc, user_t *u, char *type, char *to, char *prefix, char else { irc_write( irc, ":%s!%s@%s %s %s :%s%s", u->nick, u->user, u->host, - type, to, prefix, line ); + type, to, prefix ? prefix : "", line ); } line = s + 1; } |