Changes in protocols/msn/ns.c [823de9d:21d48d9]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/ns.c
r823de9d r21d48d9 229 229 } 230 230 } 231 else if( num_parts == 7 && strcmp( cmd[2], "OK" ) == 0 )231 else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 ) 232 232 { 233 233 set_t *s; 234 234 235 http_decode( cmd[4] ); 236 237 strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) ); 238 ic->displayname[sizeof(ic->displayname)-1] = 0; 239 240 if( ( s = set_find( &ic->acc->set, "display_name" ) ) ) 241 { 242 g_free( s->value ); 243 s->value = g_strdup( cmd[4] ); 235 if( num_parts == 7 ) 236 { 237 http_decode( cmd[4] ); 238 239 strncpy( ic->displayname, cmd[4], sizeof( ic->displayname ) ); 240 ic->displayname[sizeof(ic->displayname)-1] = 0; 241 242 if( ( s = set_find( &ic->acc->set, "display_name" ) ) ) 243 { 244 g_free( s->value ); 245 s->value = g_strdup( cmd[4] ); 246 } 247 } 248 else 249 { 250 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 244 251 } 245 252 … … 278 285 if( num_parts == 5 ) 279 286 { 287 int i, groupcount; 288 289 groupcount = atoi( cmd[4] ); 290 if( groupcount > 0 ) 291 { 292 /* valgrind says this is leaking memory, I'm guessing 293 that this happens during server redirects. */ 294 if( md->grouplist ) 295 { 296 for( i = 0; i < md->groupcount; i ++ ) 297 g_free( md->grouplist[i] ); 298 g_free( md->grouplist ); 299 } 300 301 md->groupcount = groupcount; 302 md->grouplist = g_new0( char *, md->groupcount ); 303 } 304 280 305 md->buddycount = atoi( cmd[3] ); 281 md->groupcount = atoi( cmd[4] );282 if( md->groupcount > 0 )283 md->grouplist = g_new0( char *, md->groupcount );284 285 306 if( !*cmd[3] || md->buddycount == 0 ) 286 307 msn_logged_in( ic ); … … 406 427 { 407 428 /* FIXME: Warn/Bomb about unknown away state? */ 408 st = msn_away_state_list; 409 } 410 411 imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 412 ( st->number ? OPT_AWAY : 0 ), st->name, NULL ); 429 st = msn_away_state_list + 1; 430 } 431 432 imcb_buddy_status( ic, cmd[3], OPT_LOGGED_IN | 433 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 434 st->name, NULL ); 413 435 } 414 436 else if( strcmp( cmd[0], "FLN" ) == 0 ) … … 435 457 { 436 458 /* FIXME: Warn/Bomb about unknown away state? */ 437 st = msn_away_state_list; 438 } 439 440 imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 441 ( st->number ? OPT_AWAY : 0 ), st->name, NULL ); 459 st = msn_away_state_list + 1; 460 } 461 462 imcb_buddy_status( ic, cmd[2], OPT_LOGGED_IN | 463 ( st != msn_away_state_list ? OPT_AWAY : 0 ), 464 st->name, NULL ); 442 465 } 443 466 else if( strcmp( cmd[0], "RNG" ) == 0 ) … … 649 672 } 650 673 651 if( arg1 )g_free( arg1 );652 if( mtype )g_free( mtype );674 g_free( arg1 ); 675 g_free( mtype ); 653 676 } 654 677 else if( g_strncasecmp( ct, "text/x-msmsgsprofile", 20 ) == 0 ) … … 658 681 else if( g_strncasecmp( ct, "text/x-msmsgsinitialemailnotification", 37 ) == 0 ) 659 682 { 660 char *inbox = msn_findheader( body, "Inbox-Unread:", blen ); 661 char *folders = msn_findheader( body, "Folders-Unread:", blen ); 662 663 if( inbox && folders && set_getbool( &ic->acc->set, "mail_notifications" ) ) 683 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 664 684 { 665 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 685 char *inbox = msn_findheader( body, "Inbox-Unread:", blen ); 686 char *folders = msn_findheader( body, "Folders-Unread:", blen ); 687 688 if( inbox && folders ) 689 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 690 691 g_free( inbox ); 692 g_free( folders ); 666 693 } 667 694 } 668 695 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) 669 696 { 670 char *from = msn_findheader( body, "From-Addr:", blen ); 671 char *fromname = msn_findheader( body, "From:", blen ); 672 673 if( from && fromname && set_getbool( &ic->acc->set, "mail_notifications" ) ) 697 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 674 698 { 675 imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); 699 char *from = msn_findheader( body, "From-Addr:", blen ); 700 char *fromname = msn_findheader( body, "From:", blen ); 701 702 if( from && fromname ) 703 imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); 704 705 g_free( from ); 706 g_free( fromname ); 676 707 } 677 708 }
Note: See TracChangeset
for help on using the changeset viewer.