diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-11 13:34:39 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-11 13:34:39 +0200 |
commit | 70ac4771ebf3358d7bec9bd6fe37cde4c23223bc (patch) | |
tree | 579cce153611c9dca6c132a4b56ac3293753d700 /protocols/msn/ns.c | |
parent | 52663546cc019ebdf4a7d56f1425408e20e1d4cb (diff) |
Create new MSN groups when necessary.
Diffstat (limited to 'protocols/msn/ns.c')
-rw-r--r-- | protocols/msn/ns.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 8afcbe23..0be9e727 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -611,6 +611,50 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) return( 0 ); } } + else if( strcmp( cmd[0], "ADG" ) == 0 ) + { + char *group = g_strdup( cmd[3] ); + int groupnum, i; + GSList *l, *next; + + http_decode( group ); + if( sscanf( cmd[4], "%d", &groupnum ) == 1 ) + { + if( groupnum >= md->groupcount ) + { + md->grouplist = g_renew( char *, md->grouplist, groupnum + 1 ); + for( i = md->groupcount; i <= groupnum; i ++ ) + md->grouplist[i] = NULL; + md->groupcount = groupnum + 1; + } + g_free( md->grouplist[groupnum] ); + md->grouplist[groupnum] = group; + } + else + { + /* Shouldn't happen, but if it does, give up on the group. */ + g_free( group ); + imcb_error( ic, "Syntax error" ); + imc_logout( ic, TRUE ); + return 0; + } + + for( l = md->grpq; l; l = next ) + { + struct msn_groupadd *ga = l->data; + next = l->next; + if( g_strcasecmp( ga->group, group ) == 0 ) + { + if( !msn_buddy_list_add( ic, "FL", ga->who, ga->who, group ) ) + return 0; + + g_free( ga->group ); + g_free( ga->who ); + g_free( ga ); + md->grpq = g_slist_remove( md->grpq, ga ); + } + } + } else if( isdigit( cmd[0][0] ) ) { int num = atoi( cmd[0] ); |