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