diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-01-05 00:38:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-05 00:38:54 +0100 |
commit | 3c7185c5ad61de24f9d1bc39240c8145665fba44 (patch) | |
tree | 94537e374739f043acec319a66412abff9a0ca8d /src | |
parent | dee7825f05e0e558020fabe2e536e2b5d4df8050 (diff) | |
download | irssi-3c7185c5ad61de24f9d1bc39240c8145665fba44.zip |
Update irc-nicklist.c
move altnick check before the nick correction code
Diffstat (limited to 'src')
-rw-r--r-- | src/irc/core/irc-nicklist.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/irc/core/irc-nicklist.c b/src/irc/core/irc-nicklist.c index a006a3cb..1f8c1fc9 100644 --- a/src/irc/core/irc-nicklist.c +++ b/src/irc/core/irc-nicklist.c @@ -345,6 +345,7 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data) { char *str, *cmd, *params, *nick; int n; + gboolean try_alternate_nick; g_return_if_fail(data != NULL); @@ -352,6 +353,10 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data) /* Already connected, no need to handle this anymore. */ return; } + + try_alternate_nick = g_ascii_strcasecmp(server->nick, server->connrec->nick) == 0 && + server->connrec->alternate_nick != NULL && + g_ascii_strcasecmp(server->connrec->alternate_nick, server->nick) != 0; params = event_get_params(data, 2, NULL, &nick); if (g_ascii_strcasecmp(server->nick, nick) != 0) { @@ -362,9 +367,7 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data) g_free(params); /* nick already in use - need to change it .. */ - if (g_ascii_strcasecmp(server->nick, server->connrec->nick) == 0 && - server->connrec->alternate_nick != NULL && - g_ascii_strcasecmp(server->connrec->alternate_nick, server->nick) != 0) { + if (try_alternate_nick) { /* first try, so try the alternative nick.. */ g_free(server->nick); server->nick = g_strdup(server->connrec->alternate_nick); |