diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-11 21:53:27 +0200 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-11 21:53:27 +0200 |
commit | ffa1173a0ea836029bae1f41ec13c64b39bfb6a4 (patch) | |
tree | a4bd6df138c24daaebd3329234c7a07502aa1a8f /irc_commands.c | |
parent | dbb0ce32e607dbcd6c5ad4d5ab309e969afd6fd4 (diff) |
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.
Diffstat (limited to 'irc_commands.c')
-rw-r--r-- | irc_commands.c | 17 |
1 files changed, 12 insertions, 5 deletions
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] ); |