diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-06-03 22:20:43 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2006-06-03 22:20:43 +0200 |
commit | 9779c186bd6d396a6fde61cc215f2438d453ee97 (patch) | |
tree | f213d656883f0c9f602b9d78bfe3ee9143744bdf /account.c | |
parent | a15c097fa32028394264cf66ef4fd31f56315eb3 (diff) | |
parent | fb62f81f947c74e274b05e32d2e88e3a4d7e2613 (diff) |
[merge] Wilmer
Diffstat (limited to 'account.c')
-rw-r--r-- | account.c | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -52,8 +52,34 @@ account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass ) account_t *account_get( irc_t *irc, char *id ) { account_t *a, *ret = NULL; + char *handle, *s; int nr; + /* This checks if the id string ends with (...) */ + if( ( handle = strchr( id, '(' ) ) && ( s = strchr( handle, ')' ) ) && s[1] == 0 ) + { + struct prpl *proto; + + *s = *handle = 0; + handle ++; + + if( ( proto = find_protocol( id ) ) ) + { + for( a = irc->accounts; a; a = a->next ) + if( a->prpl == proto && + a->prpl->cmp_buddynames( handle, a->user ) == 0 ) + ret = a; + } + + /* Restore the string. */ + handle --; + *handle = '('; + *s = ')'; + + if( ret ) + return ret; + } + if( sscanf( id, "%d", &nr ) == 1 && nr < 1000 ) { for( a = irc->accounts; a; a = a->next ) @@ -140,7 +166,8 @@ void account_on( irc_t *irc, account_t *a ) void account_off( irc_t *irc, account_t *a ) { - account_offline( a->gc ); + a->gc->wants_to_die = TRUE; + signoff( a->gc ); a->gc = NULL; if( a->reconnect ) { |