diff options
Diffstat (limited to 'protocols/msn')
-rw-r--r-- | protocols/msn/msn.h | 5 | ||||
-rw-r--r-- | protocols/msn/msn_util.c | 14 | ||||
-rw-r--r-- | protocols/msn/ns.c | 51 | ||||
-rw-r--r-- | protocols/msn/sb.c | 8 |
4 files changed, 36 insertions, 42 deletions
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h index 9727c537..0cd174f2 100644 --- a/protocols/msn/msn.h +++ b/protocols/msn/msn.h @@ -65,8 +65,11 @@ struct msn_data GSList *msgq; GSList *switchboards; - int buddycount; const struct msn_away_state *away_state; + + int buddycount; + int groupcount; + char **grouplist; }; struct msn_switchboard diff --git a/protocols/msn/msn_util.c b/protocols/msn/msn_util.c index e5f0b2c9..c3bd73cc 100644 --- a/protocols/msn/msn_util.c +++ b/protocols/msn/msn_util.c @@ -45,19 +45,8 @@ int msn_write( struct gaim_connection *gc, char *s, int len ) int msn_logged_in( struct gaim_connection *gc ) { - struct msn_data *md = gc->proto_data; - char buf[1024]; - account_online( gc ); - /* account_online() sets an away state if there is any, so only - execute this code if we're not away. */ - if( md->away_state == msn_away_state_list ) - { - g_snprintf( buf, sizeof( buf ), "CHG %d %s %d\r\n", ++md->trId, md->away_state->code, 0 ); - return( msn_write( gc, buf, strlen( buf ) ) ); - } - return( 0 ); } @@ -141,6 +130,9 @@ static void msn_buddy_ask_yes( gpointer w, struct msn_buddy_ask_data *bla ) { msn_buddy_list_add( bla->gc, "AL", bla->handle, bla->realname ); + if( find_buddy( bla->gc, bla->handle ) == NULL ) + show_got_added( bla->gc, bla->handle, NULL ); + g_free( bla->handle ); g_free( bla->realname ); g_free( bla ); diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 4ced58a0..90d525ef 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -256,6 +256,9 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( num_parts == 5 ) { md->buddycount = atoi( cmd[3] ); + md->groupcount = atoi( cmd[4] ); + if( md->groupcount > 0 ) + md->grouplist = g_new0( char *, md->groupcount ); if( !*cmd[3] || md->buddycount == 0 ) msn_logged_in( gc ); @@ -268,18 +271,6 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) msn_logged_in( gc ); } } - else if( strcmp( cmd[0], "GTC" ) == 0 ) - { - } - else if( strcmp( cmd[0], "BLP" ) == 0 ) - { - } - else if( strcmp( cmd[0], "PRP" ) == 0 ) - { - } - else if( strcmp( cmd[0], "LSG" ) == 0 ) - { - } else if( strcmp( cmd[0], "LST" ) == 0 ) { int list; @@ -296,7 +287,13 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) if( list & 1 ) /* FL */ { - add_buddy( gc, NULL, cmd[1], cmd[2] ); + char *group = NULL; + int num; + + if( cmd[4] != NULL && sscanf( cmd[4], "%d", &num ) == 1 ) + group = md->grouplist[num]; + + add_buddy( gc, group, cmd[1], cmd[2] ); } if( list & 2 ) /* AL */ { @@ -326,11 +323,22 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) } } } - else if( strcmp( cmd[0], "BPR" ) == 0 ) - { - } - else if( strcmp( cmd[0], "CHG" ) == 0 ) + else if( strcmp( cmd[0], "LSG" ) == 0 ) { + int num; + + if( num_parts != 4 ) + { + hide_login_progress_error( gc, "Syntax error" ); + signoff( gc ); + return( 0 ); + } + + http_decode( cmd[2] ); + num = atoi( cmd[1] ); + + if( num < md->groupcount ) + md->grouplist[num] = g_strdup( cmd[2] ); } else if( strcmp( cmd[0], "CHL" ) == 0 ) { @@ -356,12 +364,6 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) return( msn_write( gc, buf, strlen( buf ) ) ); } - else if( strcmp( cmd[0], "QRY" ) == 0 ) - { - } - else if( strcmp( cmd[0], "QNG" ) == 0 ) - { - } else if( strcmp( cmd[0], "ILN" ) == 0 ) { const struct msn_away_state *st; @@ -478,9 +480,6 @@ static int msn_ns_command( gpointer data, char **cmd, int num_parts ) msn_buddy_ask( gc, cmd[4], cmd[5] ); } } - else if( strcmp( cmd[0], "REM" ) == 0 ) - { - } else if( strcmp( cmd[0], "OUT" ) == 0 ) { if( cmd[1] && strcmp( cmd[1], "OTH" ) == 0 ) diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index deaceba1..234be1d6 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -201,9 +201,6 @@ void msn_sb_destroy( struct msn_switchboard *sb ) debug( "Destroying switchboard: %s", sb->who ? sb->who : sb->key ? sb->key : "" ); - if( sb->key ) g_free( sb->key ); - if( sb->who ) g_free( sb->who ); - if( sb->msgq ) { struct msn_message *m; @@ -221,9 +218,12 @@ void msn_sb_destroy( struct msn_switchboard *sb ) serv_got_crap( gc, "Warning: Closing down MSN switchboard connection with " "unsent message to %s, you'll have to resend it.", - m->who ? m->who : "(unknown)" ); + sb->who ? sb->who : "(unknown)" ); } + if( sb->key ) g_free( sb->key ); + if( sb->who ) g_free( sb->who ); + if( sb->chat ) { serv_got_chat_left( gc, sb->chat->id ); |