Changeset 70ac477 for protocols/msn/ns.c


Ignore:
Timestamp:
2010-06-11T11:34:39Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1c8e5f7
Parents:
5266354
Message:

Create new MSN groups when necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/ns.c

    r5266354 r70ac477  
    612612                }
    613613        }
     614        else if( strcmp( cmd[0], "ADG" ) == 0 )
     615        {
     616                char *group = g_strdup( cmd[3] );
     617                int groupnum, i;
     618                GSList *l, *next;
     619               
     620                http_decode( group );
     621                if( sscanf( cmd[4], "%d", &groupnum ) == 1 )
     622                {
     623                        if( groupnum >= md->groupcount )
     624                        {
     625                                md->grouplist = g_renew( char *, md->grouplist, groupnum + 1 );
     626                                for( i = md->groupcount; i <= groupnum; i ++ )
     627                                        md->grouplist[i] = NULL;
     628                                md->groupcount = groupnum + 1;
     629                        }
     630                        g_free( md->grouplist[groupnum] );
     631                        md->grouplist[groupnum] = group;
     632                }
     633                else
     634                {
     635                        /* Shouldn't happen, but if it does, give up on the group. */
     636                        g_free( group );
     637                        imcb_error( ic, "Syntax error" );
     638                        imc_logout( ic, TRUE );
     639                        return 0;
     640                }
     641               
     642                for( l = md->grpq; l; l = next )
     643                {
     644                        struct msn_groupadd *ga = l->data;
     645                        next = l->next;
     646                        if( g_strcasecmp( ga->group, group ) == 0 )
     647                        {
     648                                if( !msn_buddy_list_add( ic, "FL", ga->who, ga->who, group ) )
     649                                        return 0;
     650                               
     651                                g_free( ga->group );
     652                                g_free( ga->who );
     653                                g_free( ga );
     654                                md->grpq = g_slist_remove( md->grpq, ga );
     655                        }
     656                }
     657        }
    614658        else if( isdigit( cmd[0][0] ) )
    615659        {
Note: See TracChangeset for help on using the changeset viewer.