aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-25 01:26:33 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-25 01:26:33 +0200
commit8b0121711986494410bb9d224e90a5dab1dcc601 (patch)
treed95384e6b7735f9523eff72de90feabcc804d90c /protocols
parentf1f7b5e5d7f99419fc9b1a3d3ee3bce6e8602b10 (diff)
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.
Diffstat (limited to 'protocols')
-rw-r--r--protocols/msn/msn.c10
-rw-r--r--protocols/msn/msn.h2
-rw-r--r--protocols/msn/msn_util.c18
3 files changed, 23 insertions, 7 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index 8b4f1a81..fe1d16ac 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -198,12 +198,16 @@ static void msn_get_info(struct im_connection *ic, char *who)
static void msn_add_buddy( struct im_connection *ic, char *who, char *group )
{
+ struct bee_user *bu = bee_user_by_handle( ic->bee, ic, who );
+
msn_buddy_list_add( ic, "FL", who, who, group );
+ if( bu && bu->group )
+ msn_buddy_list_remove( ic, "FL", who, bu->group->name );
}
static void msn_remove_buddy( struct im_connection *ic, char *who, char *group )
{
- msn_buddy_list_remove( ic, "FL", who );
+ msn_buddy_list_remove( ic, "FL", who, NULL );
}
static void msn_chat_msg( struct groupchat *c, char *message, int flags )
@@ -273,7 +277,7 @@ static void msn_add_permit( struct im_connection *ic, char *who )
static void msn_rem_permit( struct im_connection *ic, char *who )
{
- msn_buddy_list_remove( ic, "AL", who );
+ msn_buddy_list_remove( ic, "AL", who, NULL );
}
static void msn_add_deny( struct im_connection *ic, char *who )
@@ -291,7 +295,7 @@ static void msn_add_deny( struct im_connection *ic, char *who )
static void msn_rem_deny( struct im_connection *ic, char *who )
{
- msn_buddy_list_remove( ic, "BL", who );
+ msn_buddy_list_remove( ic, "BL", who, NULL );
}
static int msn_send_typing( struct im_connection *ic, char *who, int typing )
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h
index 59036e37..31683cb5 100644
--- a/protocols/msn/msn.h
+++ b/protocols/msn/msn.h
@@ -166,7 +166,7 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );
int msn_write( struct im_connection *ic, char *s, int len );
int msn_logged_in( struct im_connection *ic );
int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group );
-int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who );
+int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group );
void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );
char *msn_findheader( char *text, char *header, int len );
char **msn_linesplit( char *line );
diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c
index 24f7e10e..cf119b1a 100644
--- a/protocols/msn/msn_util.c
+++ b/protocols/msn/msn_util.c
@@ -108,12 +108,24 @@ int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *
return msn_write( ic, buf, strlen( buf ) );
}
-int msn_buddy_list_remove( struct im_connection *ic, char *list, char *who )
+int msn_buddy_list_remove( struct im_connection *ic, char *list, const char *who, const char *group )
{
struct msn_data *md = ic->proto_data;
- char buf[1024];
+ char buf[1024], groupid[8];
+
+ *groupid = '\0';
+ if( group )
+ {
+ int i;
+ for( i = 0; i < md->groupcount; i ++ )
+ if( g_strcasecmp( md->grouplist[i], group ) == 0 )
+ {
+ g_snprintf( groupid, sizeof( groupid ), " %d", i );
+ break;
+ }
+ }
- g_snprintf( buf, sizeof( buf ), "REM %d %s %s\r\n", ++md->trId, list, who );
+ g_snprintf( buf, sizeof( buf ), "REM %d %s %s%s\r\n", ++md->trId, list, who, groupid );
if( msn_write( ic, buf, strlen( buf ) ) )
return( 1 );