Changes in protocols/msn/ns.c [bb839e8:70ac477]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/msn/ns.c
rbb839e8 r70ac477 35 35 36 36 static void msn_auth_got_passport_token( struct msn_auth_data *mad ); 37 static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name ); 37 38 38 39 gboolean msn_ns_connected( gpointer data, gint source, b_input_condition cond ) … … 75 76 if( msn_write( ic, s, strlen( s ) ) ) 76 77 { 77 ic->inpa = b_input_add( md->fd, GAIM_INPUT_READ, msn_ns_callback, ic );78 ic->inpa = b_input_add( md->fd, B_EV_IO_READ, msn_ns_callback, ic ); 78 79 imcb_log( ic, "Connected to server, waiting for reply" ); 79 80 } … … 231 232 else if( num_parts >= 7 && strcmp( cmd[2], "OK" ) == 0 ) 232 233 { 233 set_t *s;234 235 234 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 } 235 msn_ns_got_display_name( ic, cmd[4] ); 248 236 else 249 {250 237 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 251 }252 238 253 239 imcb_log( ic, "Authenticated, getting buddy list" ); … … 547 533 else if( num_parts >= 6 && strcmp( cmd[2], "FL" ) == 0 ) 548 534 { 535 const char *group = NULL; 536 int num; 537 538 if( cmd[6] != NULL && sscanf( cmd[6], "%d", &num ) == 1 && num < md->groupcount ) 539 group = md->grouplist[num]; 540 549 541 http_decode( cmd[5] ); 550 imcb_add_buddy( ic, cmd[4], NULL);542 imcb_add_buddy( ic, cmd[4], group ); 551 543 imcb_rename_buddy( ic, cmd[4], cmd[5] ); 552 544 } … … 573 565 return( 0 ); 574 566 } 567 #if 0 568 /* Discard this one completely for now since I don't care about the ack 569 and since MSN servers can apparently screw up the formatting. */ 575 570 else if( strcmp( cmd[0], "REA" ) == 0 ) 576 571 { … … 603 598 } 604 599 } 600 #endif 605 601 else if( strcmp( cmd[0], "IPG" ) == 0 ) 606 602 { … … 614 610 imc_logout( ic, TRUE ); 615 611 return( 0 ); 612 } 613 } 614 else if( strcmp( cmd[0], "ADG" ) == 0 ) 615 { 616 char *group = g_strdup( cmd[3] ); 617 int groupnum, i; 618 GSList *l, *next; 619 620 http_decode( group ); 621 if( sscanf( cmd[4], "%d", &groupnum ) == 1 ) 622 { 623 if( groupnum >= md->groupcount ) 624 { 625 md->grouplist = g_renew( char *, md->grouplist, groupnum + 1 ); 626 for( i = md->groupcount; i <= groupnum; i ++ ) 627 md->grouplist[i] = NULL; 628 md->groupcount = groupnum + 1; 629 } 630 g_free( md->grouplist[groupnum] ); 631 md->grouplist[groupnum] = group; 632 } 633 else 634 { 635 /* Shouldn't happen, but if it does, give up on the group. */ 636 g_free( group ); 637 imcb_error( ic, "Syntax error" ); 638 imc_logout( ic, TRUE ); 639 return 0; 640 } 641 642 for( l = md->grpq; l; l = next ) 643 { 644 struct msn_groupadd *ga = l->data; 645 next = l->next; 646 if( g_strcasecmp( ga->group, group ) == 0 ) 647 { 648 if( !msn_buddy_list_add( ic, "FL", ga->who, ga->who, group ) ) 649 return 0; 650 651 g_free( ga->group ); 652 g_free( ga->who ); 653 g_free( ga ); 654 md->grpq = g_slist_remove( md->grpq, ga ); 655 } 616 656 } 617 657 } … … 752 792 } 753 793 } 794 795 static gboolean msn_ns_got_display_name( struct im_connection *ic, char *name ) 796 { 797 set_t *s; 798 799 if( ( s = set_find( &ic->acc->set, "display_name" ) ) == NULL ) 800 return FALSE; /* Shouldn't happen.. */ 801 802 http_decode( name ); 803 804 if( s->value && strcmp( s->value, name ) == 0 ) 805 { 806 return TRUE; 807 /* The names match, nothing to worry about. */ 808 } 809 else if( s->value != NULL && 810 ( strcmp( name, ic->acc->user ) == 0 || 811 set_getbool( &ic->acc->set, "local_display_name" ) ) ) 812 { 813 /* The server thinks our display name is our e-mail address 814 which is probably wrong, or the user *wants* us to do this: 815 Always use the locally set display_name. */ 816 return msn_set_display_name( ic, s->value ); 817 } 818 else 819 { 820 if( s->value && *s->value ) 821 imcb_log( ic, "BitlBee thinks your display name is `%s' but " 822 "the MSN server says it's `%s'. Using the MSN " 823 "server's name. Set local_display_name to true " 824 "to use the local name.", s->value, name ); 825 826 if( g_utf8_validate( name, -1, NULL ) ) 827 { 828 g_free( s->value ); 829 s->value = g_strdup( name ); 830 } 831 else 832 { 833 imcb_log( ic, "Warning: Friendly name in server response was corrupted" ); 834 } 835 836 return TRUE; 837 } 838 }
Note: See TracChangeset
for help on using the changeset viewer.