Changeset 57c96f7
- Timestamp:
- 2010-04-05T01:00:02Z (15 years ago)
- Branches:
- master
- Children:
- 1f92a58
- Parents:
- 0b5cc72
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.h
r0b5cc72 r57c96f7 205 205 int irc_user_free( irc_t *irc, const char *nick ); 206 206 irc_user_t *irc_user_by_name( irc_t *irc, const char *nick ); 207 int irc_user_set_nick( irc_ t *irc, const char *old, const char *new );207 int irc_user_set_nick( irc_user_t *iu, const char *new ); 208 208 gint irc_user_cmp( gconstpointer a_, gconstpointer b_ ); 209 209 -
irc_channel.c
r0b5cc72 r57c96f7 82 82 int irc_channel_add_user( irc_channel_t *ic, irc_user_t *iu ) 83 83 { 84 if( !irc_channel_has_user( ic, iu ) )84 if( irc_channel_has_user( ic, iu ) ) 85 85 return 0; 86 86 -
irc_user.c
r0b5cc72 r57c96f7 83 83 } 84 84 85 int irc_user_set_nick( irc_ t *irc, const char *old, const char *new )85 int irc_user_set_nick( irc_user_t *iu, const char *new ) 86 86 { 87 irc_ user_t *iu = irc_user_by_name( irc, old );87 irc_t *irc = iu->irc; 88 88 char key[strlen(new)+1]; 89 89 GSList *cl; … … 100 100 who's in the same channel like our user. */ 101 101 if( iu == irc->user || 102 ( irc_channel_has_user( ic, irc->user) &&102 ( ( ic->flags & IRC_CHANNEL_JOINED ) && 103 103 irc_channel_has_user( ic, iu ) ) ) 104 104 { -
root_commands.c
r0b5cc72 r57c96f7 648 648 } 649 649 } 650 #endif 650 651 651 652 static void cmd_rename( irc_t *irc, char **cmd ) 652 653 { 653 user_t *u; 654 655 if( g_strcasecmp( cmd[1], irc->nick ) == 0 ) 654 irc_user_t *iu; 655 656 iu = irc_user_by_name( irc, cmd[1] ); 657 658 if( iu == NULL ) 659 { 660 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); 661 } 662 else if( iu == irc->user ) 656 663 { 657 664 irc_usermsg( irc, "Nick `%s' can't be changed", cmd[1] ); 658 665 } 659 else if( g_strcasecmp( cmd[1], irc->channel ) == 0 ) 660 { 661 if( strchr( CTYPES, cmd[2][0] ) && nick_ok( cmd[2] + 1 ) ) 662 { 663 u = user_find( irc, irc->nick ); 664 665 irc_part( irc, u, irc->channel ); 666 g_free( irc->channel ); 667 irc->channel = g_strdup( cmd[2] ); 668 irc_join( irc, u, irc->channel ); 669 670 if( strcmp( cmd[0], "set_rename" ) != 0 ) 671 set_setstr( &irc->set, "control_channel", cmd[2] ); 672 } 673 } 674 else if( user_find( irc, cmd[2] ) && ( nick_cmp( cmd[1], cmd[2] ) != 0 ) ) 666 else if( !nick_ok( cmd[2] ) ) 667 { 668 irc_usermsg( irc, "Nick `%s' is invalid", cmd[2] ); 669 } 670 else if( irc_user_by_name( irc, cmd[2] ) ) 675 671 { 676 672 irc_usermsg( irc, "Nick `%s' already exists", cmd[2] ); 677 673 } 678 else if( !nick_ok( cmd[2] ) ) 679 { 680 irc_usermsg( irc, "Nick `%s' is invalid", cmd[2] ); 681 } 682 else if( !( u = user_find( irc, cmd[1] ) ) ) 683 { 684 irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] ); 685 } 686 else 687 { 688 user_rename( irc, cmd[1], cmd[2] ); 689 irc_write( irc, ":%s!%s@%s NICK %s", cmd[1], u->user, u->host, cmd[2] ); 690 if( g_strcasecmp( cmd[1], irc->mynick ) == 0 ) 691 { 692 g_free( irc->mynick ); 693 irc->mynick = g_strdup( cmd[2] ); 694 674 else 675 { 676 if( !irc_user_set_nick( iu, cmd[2] ) ) 677 { 678 irc_usermsg( irc, "Error while changing nick" ); 679 return; 680 } 681 682 if( iu == irc->root ) 683 { 695 684 /* If we're called internally (user did "set root_nick"), 696 685 let's not go O(INF). :-) */ 697 686 if( strcmp( cmd[0], "set_rename" ) != 0 ) 698 set_setstr( &irc-> set, "root_nick", cmd[2] );699 } 700 else if( u->send_handler == buddy_send_handler)701 { 702 nick_set( u->ic->acc,u->handle, cmd[2] );687 set_setstr( &irc->b->set, "root_nick", cmd[2] ); 688 } 689 else if( iu->bu ) 690 { 691 nick_set( iu->bu->ic->acc, iu->bu->handle, cmd[2] ); 703 692 } 704 693 … … 707 696 } 708 697 698 #if 0 709 699 char *set_eval_root_nick( set_t *set, char *new_nick ) 710 700 { … … 1232 1222 { "add", 2, cmd_add, 0 }, 1233 1223 { "info", 1, cmd_info, 0 }, 1224 #endif 1234 1225 { "rename", 2, cmd_rename, 0 }, 1226 #if 0 1235 1227 { "remove", 1, cmd_remove, 0 }, 1236 1228 { "block", 1, cmd_block, 0 },
Note: See TracChangeset
for help on using the changeset viewer.