diff options
author | Sven Moritz Hallberg <pesco@khjk.org> | 2010-06-03 12:41:03 +0200 |
---|---|---|
committer | Sven Moritz Hallberg <pesco@khjk.org> | 2010-06-03 12:41:03 +0200 |
commit | 5f8ab6a9adf09ea7c07f728227bdb6d3953588f1 (patch) | |
tree | 1b708f624d5ee996217055aec11490f06024efca /account.c | |
parent | 3f81999c20852f14a5fb27a6ef6c5ea44db61a4d (diff) | |
parent | f9928cb319c2879a56b7280f09723b26035982d0 (diff) |
merge in bitlbee 1.2.5
Diffstat (limited to 'account.c')
-rw-r--r-- | account.c | 33 |
1 files changed, 30 insertions, 3 deletions
@@ -1,7 +1,7 @@ /********************************************************************\ * BitlBee -- An IRC to other IM-networks gateway * * * - * Copyright 2002-2004 Wilmer van der Gaast and others * + * Copyright 2002-2010 Wilmer van der Gaast and others * \********************************************************************/ /* Account management functions */ @@ -26,6 +26,7 @@ #define BITLBEE_CORE #include "bitlbee.h" #include "account.h" +#include "chat.h" account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass ) { @@ -53,6 +54,8 @@ account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass ) s = set_add( &a->set, "auto_reconnect", "true", set_eval_bool, a ); + s = set_add( &a->set, "nick_source", "handle", NULL, a ); + s = set_add( &a->set, "password", NULL, set_eval_account, a ); s->flags |= ACC_SET_NOSAVE | SET_NULL_OK; @@ -67,7 +70,16 @@ account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass ) if( prpl->init ) prpl->init( a ); - return( a ); + s = set_add( &a->set, "away", NULL, set_eval_account, a ); + s->flags |= SET_NULL_OK; + + if( a->flags & ACC_FLAG_STATUS_MESSAGE ) + { + s = set_add( &a->set, "status", NULL, set_eval_account, a ); + s->flags |= SET_NULL_OK; + } + + return a; } char *set_eval_account( set_t *set, char *value ) @@ -121,6 +133,21 @@ char *set_eval_account( set_t *set, char *value ) acc->auto_connect = bool2int( value ); return value; } + else if( strcmp( set->key, "away" ) == 0 || + strcmp( set->key, "status" ) == 0 ) + { + if( acc->ic && acc->ic->flags & OPT_LOGGED_IN ) + { + /* If we're currently on-line, set the var now already + (bit of a hack) and send an update. */ + g_free( set->value ); + set->value = g_strdup( value ); + + imc_away_send_update( acc->ic ); + } + + return value; + } return SET_INVALID; } @@ -265,7 +292,7 @@ int account_reconnect_delay_parse( char *value, struct account_reconnect_delay * /* A whole day seems like a sane "maximum maximum". */ p->max = 86400; - /* Format: /[0-9]+([*+][0-9]+(<[0-9+]))/ */ + /* Format: /[0-9]+([*+][0-9]+(<[0-9+])?)?/ */ while( *value && isdigit( *value ) ) p->start = p->start * 10 + *value++ - '0'; |