From ffa1173a0ea836029bae1f41ec13c64b39bfb6a4 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sun, 11 Apr 2010 21:53:27 +0200 Subject: Allow the user to change his/her nick. My old concern was that it gets hairy when dealing with the storage/NickServ part. But meh, just reset all that state when the nick changes and require the user to re-register if s/he wants to save stuff. The only problem's when s/he identifies and may end up getting every account added twice. --- irc_commands.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'irc_commands.c') diff --git a/irc_commands.c b/irc_commands.c index 57268d07..b1b764b9 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -72,11 +72,7 @@ static void irc_cmd_user( irc_t *irc, char **cmd ) static void irc_cmd_nick( irc_t *irc, char **cmd ) { - if( irc->user->nick ) - { - irc_send_num( irc, 438, ":The hand of the deity is upon thee, thy nick may not change" ); - } - else if( irc_user_by_name( irc, cmd[1] ) ) + if( irc_user_by_name( irc, cmd[1] ) ) { irc_send_num( irc, 433, ":This nick is already in use" ); } @@ -85,6 +81,17 @@ static void irc_cmd_nick( irc_t *irc, char **cmd ) /* [SH] Invalid characters. */ irc_send_num( irc, 432, ":This nick contains invalid characters" ); } + else if( irc->user->nick ) + { + if( irc->status & USTATUS_IDENTIFIED ) + { + irc_setpass( irc, NULL ); + irc->status &= ~USTATUS_IDENTIFIED; + irc_umode_set( irc, "-R", 1 ); + } + + irc_user_set_nick( irc->user, cmd[1] ); + } else { irc->user->nick = g_strdup( cmd[1] ); -- cgit v1.2.3