mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Update irc-nicklist.c
move altnick check before the nick correction code
This commit is contained in:
parent
dee7825f05
commit
3c7185c5ad
@ -345,6 +345,7 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data)
|
|||||||
{
|
{
|
||||||
char *str, *cmd, *params, *nick;
|
char *str, *cmd, *params, *nick;
|
||||||
int n;
|
int n;
|
||||||
|
gboolean try_alternate_nick;
|
||||||
|
|
||||||
g_return_if_fail(data != NULL);
|
g_return_if_fail(data != NULL);
|
||||||
|
|
||||||
@ -353,6 +354,10 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data)
|
|||||||
return;
|
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);
|
params = event_get_params(data, 2, NULL, &nick);
|
||||||
if (g_ascii_strcasecmp(server->nick, nick) != 0) {
|
if (g_ascii_strcasecmp(server->nick, nick) != 0) {
|
||||||
/* the server uses a nick different from the one we send */
|
/* the server uses a nick different from the one we send */
|
||||||
@ -362,9 +367,7 @@ static void event_nick_in_use(IRC_SERVER_REC *server, const char *data)
|
|||||||
g_free(params);
|
g_free(params);
|
||||||
|
|
||||||
/* nick already in use - need to change it .. */
|
/* nick already in use - need to change it .. */
|
||||||
if (g_ascii_strcasecmp(server->nick, server->connrec->nick) == 0 &&
|
if (try_alternate_nick) {
|
||||||
server->connrec->alternate_nick != NULL &&
|
|
||||||
g_ascii_strcasecmp(server->connrec->alternate_nick, server->nick) != 0) {
|
|
||||||
/* first try, so try the alternative nick.. */
|
/* first try, so try the alternative nick.. */
|
||||||
g_free(server->nick);
|
g_free(server->nick);
|
||||||
server->nick = g_strdup(server->connrec->alternate_nick);
|
server->nick = g_strdup(server->connrec->alternate_nick);
|
||||||
|
Loading…
Reference in New Issue
Block a user