Changes in protocols/msn/ns.c [21d48d9:823de9d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/ns.c
r21d48d9 r823de9d 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 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" ); 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] ); 251 244 } 252 245 … … 285 278 if( num_parts == 5 ) 286 279 { 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; 280 md->buddycount = atoi( cmd[3] ); 281 md->groupcount = atoi( cmd[4] ); 282 if( md->groupcount > 0 ) 302 283 md->grouplist = g_new0( char *, md->groupcount ); 303 } 304 305 md->buddycount = atoi( cmd[3] ); 284 306 285 if( !*cmd[3] || md->buddycount == 0 ) 307 286 msn_logged_in( ic ); … … 427 406 { 428 407 /* FIXME: Warn/Bomb about unknown away state? */ 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 ); 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 ); 435 413 } 436 414 else if( strcmp( cmd[0], "FLN" ) == 0 ) … … 457 435 { 458 436 /* FIXME: Warn/Bomb about unknown away state? */ 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 ); 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 ); 465 442 } 466 443 else if( strcmp( cmd[0], "RNG" ) == 0 ) … … 672 649 } 673 650 674 g_free( arg1 );675 g_free( mtype );651 if( arg1 ) g_free( arg1 ); 652 if( mtype ) g_free( mtype ); 676 653 } 677 654 else if( g_strncasecmp( ct, "text/x-msmsgsprofile", 20 ) == 0 ) … … 681 658 else if( g_strncasecmp( ct, "text/x-msmsgsinitialemailnotification", 37 ) == 0 ) 682 659 { 683 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 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" ) ) 684 664 { 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 ); 665 imcb_log( ic, "INBOX contains %s new messages, plus %s messages in other folders.", inbox, folders ); 693 666 } 694 667 } 695 668 else if( g_strncasecmp( ct, "text/x-msmsgsemailnotification", 30 ) == 0 ) 696 669 { 697 if( set_getbool( &ic->acc->set, "mail_notifications" ) ) 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" ) ) 698 674 { 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 ); 675 imcb_log( ic, "Received an e-mail message from %s <%s>.", fromname, from ); 707 676 } 708 677 }
Note: See TracChangeset
for help on using the changeset viewer.