aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-04-08 16:37:49 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2006-04-08 16:37:49 +0200
commit85616c361bf152a10f774ad65068103d0724e42b (patch)
treea753ecdc9f39453176541497993ed6e72033350d
parent11bcee97b781bac6e38db4e1630ac6934209e73b (diff)
Added $proto($handle) account matching to account_get().
-rw-r--r--account.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/account.c b/account.c
index ed6b98c0..d2e1dc9e 100644
--- a/account.c
+++ b/account.c
@@ -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 )