diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-12 19:10:16 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-12 19:10:16 +0000 |
commit | be609ff2b0ca885612c0e6d81f82c4f26ed4f58d (patch) | |
tree | b9f83fdc44bd00921ffb9c23035b1f39d565ba93 /account.c | |
parent | 08e5bb2bb2fcc7125f837be4f225d3a9ebf320ed (diff) | |
parent | 8b6b7405d3844271f7bff56e527bfeb1a4872975 (diff) |
Merging mainline.
Diffstat (limited to 'account.c')
-rw-r--r-- | account.c | 30 |
1 files changed, 27 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 */ @@ -68,7 +68,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 ) @@ -122,6 +131,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; } @@ -266,7 +290,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'; |