Changes in protocols/msn/ns.c [8ff0a61:1145964]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/ns.c
r8ff0a61 r1145964 34 34 static int msn_ns_message( gpointer data, char *msg, int msglen, char **cmd, int num_parts ); 35 35 36 static void msn_auth_got_passport_ id( struct passport_reply *rep);36 static void msn_auth_got_passport_token( struct msn_auth_data *mad ); 37 37 38 38 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) … … 178 178 179 179 debug( "Connecting to a new switchboard with key %s", cmd[5] ); 180 sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ); 180 181 if( ( sb = msn_sb_create( ic, server, port, cmd[5], MSN_SB_NEW ) ) == NULL ) 182 { 183 /* Although this isn't strictly fatal for the NS connection, it's 184 definitely something serious (we ran out of file descriptors?). */ 185 imcb_error( ic, "Could not create new switchboard" ); 186 imc_logout( ic, TRUE ); 187 return( 0 ); 188 } 181 189 182 190 if( md->msgq ) … … 214 222 { 215 223 /* Time for some Passport black magic... */ 216 if( !passport_get_ id( msn_auth_got_passport_id, ic, ic->acc->user, ic->acc->pass, cmd[4] ) )224 if( !passport_get_token( msn_auth_got_passport_token, ic, ic->acc->user, ic->acc->pass, cmd[4] ) ) 217 225 { 218 226 imcb_error( ic, "Error while contacting Passport server" ); … … 270 278 if( num_parts == 5 ) 271 279 { 280 int i, groupcount; 281 282 groupcount = atoi( cmd[4] ); 283 if( groupcount > 0 ) 284 { 285 /* valgrind says this is leaking memory, I'm guessing 286 that this happens during server redirects. */ 287 if( md->grouplist ) 288 { 289 for( i = 0; i < md->groupcount; i ++ ) 290 g_free( md->grouplist[i] ); 291 g_free( md->grouplist ); 292 } 293 294 md->groupcount = groupcount; 295 md->grouplist = g_new0( char *, md->groupcount ); 296 } 297 272 298 md->buddycount = atoi( cmd[3] ); 273 md->groupcount = atoi( cmd[4] );274 if( md->groupcount > 0 )275 md->grouplist = g_new0( char *, md->groupcount );276 277 299 if( !*cmd[3] || md->buddycount == 0 ) 278 300 msn_logged_in( ic ); … … 468 490 debug( "Got a call from %s (session %d). Key = %s", cmd[5], session, cmd[4] ); 469 491 470 sb = msn_sb_create( ic, server, port, cmd[4], session ); 471 sb->who = g_strdup( cmd[5] ); 492 if( ( sb = msn_sb_create( ic, server, port, cmd[4], session ) ) == NULL ) 493 { 494 /* Although this isn't strictly fatal for the NS connection, it's 495 definitely something serious (we ran out of file descriptors?). */ 496 imcb_error( ic, "Could not create new switchboard" ); 497 imc_logout( ic, TRUE ); 498 return( 0 ); 499 } 500 else 501 { 502 sb->who = g_strdup( cmd[5] ); 503 } 472 504 } 473 505 else if( strcmp( cmd[0], "ADD" ) == 0 ) … … 647 679 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 648 680 } 681 682 g_free( inbox ); 683 g_free( folders ); 649 684 } 650 685 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) … … 674 709 } 675 710 676 static void msn_auth_got_passport_ id( struct passport_reply *rep)711 static void msn_auth_got_passport_token( struct msn_auth_data *mad ) 677 712 { 678 struct im_connection *ic = rep->data; 679 struct msn_data *md = ic->proto_data; 680 char *key = rep->result; 681 char buf[1024]; 682 683 if( key == NULL ) 684 { 685 imcb_error( ic, "Error during Passport authentication (%s)", 686 rep->error_string ? rep->error_string : "Unknown error" ); 713 struct im_connection *ic = mad->data; 714 struct msn_data *md; 715 716 /* Dead connection? */ 717 if( g_slist_find( msn_connections, ic ) == NULL ) 718 return; 719 720 md = ic->proto_data; 721 if( mad->token ) 722 { 723 char buf[1024]; 724 725 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, mad->token ); 726 msn_write( ic, buf, strlen( buf ) ); 727 } 728 else 729 { 730 imcb_error( ic, "Error during Passport authentication: %s", mad->error ); 687 731 imc_logout( ic, TRUE ); 688 732 } 689 else690 {691 g_snprintf( buf, sizeof( buf ), "USR %d TWN S %s\r\n", ++md->trId, key );692 msn_write( ic, buf, strlen( buf ) );693 }694 733 }
Note: See TracChangeset
for help on using the changeset viewer.