Changes in protocols/nogaim.c [c9c7ca7:f6c963b]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/nogaim.c
rc9c7ca7 rf6c963b 289 289 { 290 290 irc_t *irc = ic->irc; 291 user_t *t, *u ;291 user_t *t, *u = irc->users; 292 292 account_t *a; 293 293 … … 306 306 b_event_remove( ic->inpa ); 307 307 308 u = irc->users;309 308 while( u ) 310 309 { … … 429 428 { 430 429 user_t *u = user_findhandle( ic, handle ); 430 char *s, newnick[MAX_NICK_LENGTH+1]; 431 431 432 432 if( !u || !realname ) return; … … 440 440 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) ) 441 441 imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); 442 } 443 } 444 445 void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group ) 446 { 447 user_t *u; 448 449 if( ( u = user_findhandle( ic, handle ) ) ) 450 user_del( ic->irc, u->nick ); 451 } 452 453 /* Mainly meant for ICQ (and now also for Jabber conferences) to allow IM 454 modules to suggest a nickname for a handle. */ 455 void imcb_buddy_nick_hint( struct im_connection *ic, char *handle, char *nick ) 456 { 457 user_t *u = user_findhandle( ic, handle ); 458 char newnick[MAX_NICK_LENGTH+1], *orig_nick; 459 460 if( u && !u->online && !nick_saved( ic->acc, handle ) ) 461 { 462 /* Only do this if the person isn't online yet (which should 463 be the case if we just added it) and if the user hasn't 464 assigned a nickname to this buddy already. */ 465 466 strncpy( newnick, nick, MAX_NICK_LENGTH ); 467 newnick[MAX_NICK_LENGTH] = 0; 468 469 /* Some processing to make sure this string is a valid IRC nickname. */ 470 nick_strip( newnick ); 471 if( set_getbool( &ic->irc->set, "lcnicks" ) ) 472 nick_lc( newnick ); 473 474 if( strcmp( u->nick, newnick ) != 0 ) 475 { 476 /* Only do this if newnick is different from the current one. 477 If rejoining a channel, maybe we got this nick already 478 (and dedupe would only add an underscore. */ 479 nick_dedupe( ic->acc, handle, newnick ); 442 443 if( !u->online && !nick_saved( ic->acc, handle ) ) 444 { 445 /* Detect numeric handles: */ 446 for( s = u->user; isdigit( *s ); s++ ); 480 447 481 /* u->nick will be freed halfway the process, so it can't be 482 passed as an argument. */ 483 orig_nick = g_strdup( u->nick ); 484 user_rename( ic->irc, orig_nick, newnick ); 485 g_free( orig_nick ); 486 } 487 } 488 } 448 if( *s == 0 ) 449 { 450 /* If we reached the end of the string, it only contained numbers. 451 Seems to be an ICQ# then, so hopefully realname contains 452 something more useful. */ 453 strcpy( newnick, realname ); 454 455 /* Some processing to make sure this string is a valid IRC nickname. */ 456 nick_strip( newnick ); 457 if( set_getbool( &ic->irc->set, "lcnicks" ) ) 458 nick_lc( newnick ); 459 460 u->nick = g_strdup( newnick ); 461 } 462 } 463 } 464 } 465 489 466 490 467 /* prpl.c */ … … 577 554 u->online = 0; 578 555 579 /* Remove him/her from the groupchats to prevent PART messages after he/she QUIT already */580 for( c = ic-> groupchats; c; c = c->next )556 /* Remove him/her from the conversations to prevent PART messages after he/she QUIT already */ 557 for( c = ic->conversations; c; c = c->next ) 581 558 remove_chat_buddy_silent( c, (char*) handle ); 582 559 } … … 708 685 } 709 686 710 void imcb_chat_ free( struct groupchat *c )687 void imcb_chat_removed( struct groupchat *c ) 711 688 { 712 689 struct im_connection *ic = c->ic; 713 struct groupchat *l ;690 struct groupchat *l = NULL; 714 691 GList *ir; 715 692 … … 731 708 } 732 709 733 /* Find the previous chat in the linked list. */734 for( l = ic->groupchats; l && l->next != c; l = l->next );735 736 710 if( l ) 737 711 l->next = c->next; 738 712 else 739 ic-> groupchats = c->next;713 ic->conversations = c->next; 740 714 741 715 for( ir = c->in_room; ir; ir = ir->next ) … … 775 749 /* This one just creates the conversation structure, user won't see anything yet */ 776 750 777 if( ic-> groupchats )778 { 779 for( c = ic-> groupchats; c->next; c = c->next );751 if( ic->conversations ) 752 { 753 for( c = ic->conversations; c->next; c = c->next ); 780 754 c = c->next = g_new0( struct groupchat, 1 ); 781 755 } 782 756 else 783 ic-> groupchats = c = g_new0( struct groupchat, 1 );757 ic->conversations = c = g_new0( struct groupchat, 1 ); 784 758 785 759 c->ic = ic; … … 830 804 } 831 805 832 /* This function is one BIG hack... :-( EREWRITE */833 806 void imcb_chat_remove_buddy( struct groupchat *b, char *handle, char *reason ) 834 807 { … … 842 815 if( g_strcasecmp( handle, b->ic->acc->user ) == 0 ) 843 816 { 844 if( b->joined == 0 )845 return;846 847 817 u = user_find( b->ic->irc, b->ic->irc->nick ); 848 818 b->joined = 0; … … 854 824 } 855 825 856 if( me || ( remove_chat_buddy_silent( b, handle ) && b->joined && u ) ) 857 irc_part( b->ic->irc, u, b->channel ); 826 if( remove_chat_buddy_silent( b, handle ) ) 827 if( ( b->joined || me ) && u ) 828 irc_part( b->ic->irc, u, b->channel ); 858 829 } 859 830 … … 881 852 882 853 /* Misc. BitlBee stuff which shouldn't really be here */ 854 855 struct groupchat *chat_by_channel( char *channel ) 856 { 857 struct im_connection *ic; 858 struct groupchat *c; 859 GSList *l; 860 861 /* This finds the connection which has a conversation which belongs to this channel */ 862 for( l = connections; l; l = l->next ) 863 { 864 ic = l->data; 865 for( c = ic->conversations; c && g_strcasecmp( c->channel, channel ) != 0; c = c->next ); 866 if( c ) 867 return c; 868 } 869 870 return NULL; 871 } 883 872 884 873 char *set_eval_away_devoice( set_t *set, char *value )
Note: See TracChangeset
for help on using the changeset viewer.