Changeset 6acc033


Ignore:
Timestamp:
2010-06-09T00:35:13Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
95c3ea9
Parents:
46d215d
Message:

Moving MSN contacts between groups is now possible, but no support yet for
creating new groups.

Location:
protocols/msn
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    r46d215d r6acc033  
    182182static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
    183183{
    184         msn_buddy_list_add( ic, "FL", who, who );
     184        msn_buddy_list_add( ic, "FL", who, who, group );
    185185}
    186186
     
    252252static void msn_add_permit( struct im_connection *ic, char *who )
    253253{
    254         msn_buddy_list_add( ic, "AL", who, who );
     254        msn_buddy_list_add( ic, "AL", who, who, NULL );
    255255}
    256256
     
    264264        struct msn_switchboard *sb;
    265265       
    266         msn_buddy_list_add( ic, "BL", who, who );
     266        msn_buddy_list_add( ic, "BL", who, who, NULL );
    267267       
    268268        /* If there's still a conversation with this person, close it. */
  • protocols/msn/msn.h

    r46d215d r6acc033  
    160160int msn_write( struct im_connection *ic, char *s, int len );
    161161int msn_logged_in( struct im_connection *ic );
    162 int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname );
     162int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group );
    163163int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
    164164void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
  • protocols/msn/msn_util.c

    r46d215d r6acc033  
    5151}
    5252
    53 int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname_ )
     53int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group )
    5454{
    5555        struct msn_data *md = ic->proto_data;
    56         char buf[1024], *realname;
     56        char buf[1024], *realname, groupid[8];
    5757       
    5858        realname = msn_http_encode( realname_ );
    5959       
    60         g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname );
     60        *groupid = '\0';
     61        if( group )
     62        {
     63                int i;
     64                for( i = 0; i < md->groupcount; i ++ )
     65                        if( g_strcasecmp( md->grouplist[i], group ) == 0 )
     66                        {
     67                                g_snprintf( groupid, sizeof( groupid ), " %d", i );
     68                                break;
     69                        }
     70        }
     71       
     72        g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s%s\r\n", ++md->trId, list, who, realname, groupid );
    6173        if( msn_write( ic, buf, strlen( buf ) ) )
    6274        {
     
    94106        struct msn_buddy_ask_data *bla = data;
    95107       
    96         msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname );
     108        msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname, NULL );
    97109       
    98110        imcb_ask_add( bla->ic, bla->handle, NULL );
     
    107119        struct msn_buddy_ask_data *bla = data;
    108120       
    109         msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname );
     121        msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname, NULL );
    110122       
    111123        g_free( bla->handle );
  • protocols/msn/ns.c

    r46d215d r6acc033  
    533533                else if( num_parts >= 6 && strcmp( cmd[2], "FL" ) == 0 )
    534534                {
     535                        const char *group = NULL;
     536                        int num;
     537                       
     538                        if( cmd[6] != NULL && sscanf( cmd[6], "%d", &num ) == 1 && num < md->groupcount )
     539                                group = md->grouplist[num];
     540                       
    535541                        http_decode( cmd[5] );
    536                         imcb_add_buddy( ic, cmd[4], NULL );
     542                        imcb_add_buddy( ic, cmd[4], group );
    537543                        imcb_rename_buddy( ic, cmd[4], cmd[5] );
    538544                }
Note: See TracChangeset for help on using the changeset viewer.