diff options
| -rw-r--r-- | protocols/msn/msn.c | 6 | ||||
| -rw-r--r-- | protocols/msn/msn.h | 2 | ||||
| -rw-r--r-- | protocols/msn/msn_util.c | 22 | ||||
| -rw-r--r-- | protocols/msn/ns.c | 8 | 
4 files changed, 28 insertions, 10 deletions
| diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index d6a4b158..a5807318 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -181,7 +181,7 @@ static void msn_get_info(struct im_connection *ic, char *who)  static void msn_add_buddy( struct im_connection *ic, char *who, char *group )  { -	msn_buddy_list_add( ic, "FL", who, who ); +	msn_buddy_list_add( ic, "FL", who, who, group );  }  static void msn_remove_buddy( struct im_connection *ic, char *who, char *group ) @@ -251,7 +251,7 @@ static void msn_keepalive( struct im_connection *ic )  static void msn_add_permit( struct im_connection *ic, char *who )  { -	msn_buddy_list_add( ic, "AL", who, who ); +	msn_buddy_list_add( ic, "AL", who, who, NULL );  }  static void msn_rem_permit( struct im_connection *ic, char *who ) @@ -263,7 +263,7 @@ static void msn_add_deny( struct im_connection *ic, char *who )  {  	struct msn_switchboard *sb; -	msn_buddy_list_add( ic, "BL", who, who ); +	msn_buddy_list_add( ic, "BL", who, who, NULL );  	/* If there's still a conversation with this person, close it. */  	if( ( sb = msn_sb_by_handle( ic, who ) ) ) diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h index f3cb8635..e4abcb60 100644 --- a/protocols/msn/msn.h +++ b/protocols/msn/msn.h @@ -159,7 +159,7 @@ gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond );  /* msn_util.c */  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, char *list, char *who, char *realname ); +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 );  void msn_buddy_ask( struct im_connection *ic, char *handle, char *realname );  char *msn_findheader( char *text, char *header, int len ); diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index a8d24b30..f9c10e72 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -50,14 +50,26 @@ int msn_logged_in( struct im_connection *ic )  	return( 0 );  } -int msn_buddy_list_add( struct im_connection *ic, char *list, char *who, char *realname_ ) +int msn_buddy_list_add( struct im_connection *ic, const char *list, const char *who, const char *realname_, const char *group )  {  	struct msn_data *md = ic->proto_data; -	char buf[1024], *realname; +	char buf[1024], *realname, groupid[8];  	realname = msn_http_encode( realname_ ); -	g_snprintf( buf, sizeof( buf ), "ADD %d %s %s %s\r\n", ++md->trId, list, who, realname ); +	*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 ), "ADD %d %s %s %s%s\r\n", ++md->trId, list, who, realname, groupid );  	if( msn_write( ic, buf, strlen( buf ) ) )  	{  		g_free( realname ); @@ -93,7 +105,7 @@ static void msn_buddy_ask_yes( void *data )  {  	struct msn_buddy_ask_data *bla = data; -	msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname ); +	msn_buddy_list_add( bla->ic, "AL", bla->handle, bla->realname, NULL );  	imcb_ask_add( bla->ic, bla->handle, NULL ); @@ -106,7 +118,7 @@ static void msn_buddy_ask_no( void *data )  {  	struct msn_buddy_ask_data *bla = data; -	msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname ); +	msn_buddy_list_add( bla->ic, "BL", bla->handle, bla->realname, NULL );  	g_free( bla->handle );  	g_free( bla->realname ); diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 2b0600a3..8afcbe23 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -532,8 +532,14 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts )  		}  		else if( num_parts >= 6 && strcmp( cmd[2], "FL" ) == 0 )  		{ +			const char *group = NULL; +			int num; +			 +			if( cmd[6] != NULL && sscanf( cmd[6], "%d", &num ) == 1 && num < md->groupcount ) +				group = md->grouplist[num]; +			  			http_decode( cmd[5] ); -			imcb_add_buddy( ic, cmd[4], NULL ); +			imcb_add_buddy( ic, cmd[4], group );  			imcb_rename_buddy( ic, cmd[4], cmd[5] );  		}  	} | 
