diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-07 18:43:23 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-03-07 18:43:23 +0000 |
commit | fb020ac61b1e457de7a44492bb05a84515828ac7 (patch) | |
tree | 5dfdcae592d25251c11068cec8e8b1186de865b0 /account.c | |
parent | e08e53c9398700309000c6e6b7ff895185d567a9 (diff) | |
parent | c32f492758759c04d8b6239a7862648c9d32c4d8 (diff) |
Merging in mainline, including improved away/status stuff.
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'; |