Changeset 8b01217 for protocols


Ignore:
Timestamp:
2010-07-24T23:26:33Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
42acba1
Parents:
f1f7b5e
Message:

MSN supports having people in multiple groups and BitlBee does not. When
moving people between groups, make sure they *are* removed from their old
group.

Location:
protocols/msn
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/msn.c

    rf1f7b5e r8b01217  
    199199static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
    200200{
     201        struct bee_user *bu = bee_user_by_handle( ic->bee, ic, who );
     202       
    201203        msn_buddy_list_add( ic, "FL", who, who, group );
     204        if( bu && bu->group )
     205                msn_buddy_list_remove( ic, "FL", who, bu->group->name );
    202206}
    203207
    204208static void msn_remove_buddy( struct im_connection *ic, char *who, char *group )
    205209{
    206         msn_buddy_list_remove( ic, "FL", who );
     210        msn_buddy_list_remove( ic, "FL", who, NULL );
    207211}
    208212
     
    274278static void msn_rem_permit( struct im_connection *ic, char *who )
    275279{
    276         msn_buddy_list_remove( ic, "AL", who );
     280        msn_buddy_list_remove( ic, "AL", who, NULL );
    277281}
    278282
     
    292296static void msn_rem_deny( struct im_connection *ic, char *who )
    293297{
    294         msn_buddy_list_remove( ic, "BL", who );
     298        msn_buddy_list_remove( ic, "BL", who, NULL );
    295299}
    296300
  • protocols/msn/msn.h

    rf1f7b5e r8b01217  
    167167int msn_logged_in( struct im_connection *ic );
    168168int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group );
    169 int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
     169int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group );
    170170void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
    171171char *msn_findheader( char *text, char *header, int len );
  • protocols/msn/msn_util.c

    rf1f7b5e r8b01217  
    109109}
    110110
    111 int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who )
     111int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group )
    112112{
    113113        struct msn_data *md = ic->proto_data;
    114         char buf[1024];
    115        
    116         g_snprintf( buf, sizeof( buf ), "REM %d %s %s\r\n", ++md->trId, list, who );
     114        char buf[1024], groupid[8];
     115       
     116        *groupid = '\0';
     117        if( group )
     118        {
     119                int i;
     120                for( i = 0; i < md->groupcount; i ++ )
     121                        if( g_strcasecmp( md->grouplist[i], group ) == 0 )
     122                        {
     123                                g_snprintf( groupid, sizeof( groupid ), " %d", i );
     124                                break;
     125                        }
     126        }
     127       
     128        g_snprintf( buf, sizeof( buf ), "REM %d %s %s%s\r\n", ++md->trId, list, who, groupid );
    117129        if( msn_write( ic, buf, strlen( buf ) ) )
    118130                return( 1 );
Note: See TracChangeset for help on using the changeset viewer.