diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-07-17 22:54:49 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-07-17 23:48:38 +0200 |
commit | 081b9f6bd20dc19edbed491c4e8d8cb24de0559d (patch) | |
tree | c26d5b47c773c2422bde7b8394b91be328cd887e /src | |
parent | b1780e3efba9913f7f0011efa9e7dfc5bd65603a (diff) | |
download | xK-081b9f6bd20dc19edbed491c4e8d8cb24de0559d.tar.gz xK-081b9f6bd20dc19edbed491c4e8d8cb24de0559d.tar.xz xK-081b9f6bd20dc19edbed491c4e8d8cb24de0559d.zip |
Fix handling of multiple NICK's before a USER
We have to release the old nickname _first_, so that we can register the
same one again (albeit with a slight race condition).
Diffstat (limited to 'src')
-rw-r--r-- | src/kike.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -638,16 +638,16 @@ irc_handle_nick (const struct irc_message *msg, struct client *c) irc_send_reply (c, IRC_ERR_ERRONEOUSNICKNAME, nickname); return; } - if (str_map_find (&ctx->users, nickname)) - { - irc_send_reply (c, IRC_ERR_NICKNAMEINUSE, nickname); - return; - } if (c->nickname) { str_map_set (&ctx->users, c->nickname, NULL); free (c->nickname); } + if (str_map_find (&ctx->users, nickname)) + { + irc_send_reply (c, IRC_ERR_NICKNAMEINUSE, nickname); + return; + } // Allocate the nickname c->nickname = xstrdup (nickname); |