1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

Don't change the "wanted nick" when receiving NICK event from server, unless

we did the /NICK change. This is useful with the new irc servers changing
your nick to your UID instead of killing you, at reconnect time you'd get
"invalid nick" when irssi would try setting the UID as your nick..


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2351 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-01-28 05:28:25 +00:00 committed by cras
parent a6ee439c26
commit 08c23ce6d4
4 changed files with 14 additions and 5 deletions

View File

@ -490,9 +490,7 @@ void server_connect_unref(SERVER_CONNECT_REC *conn)
void server_change_nick(SERVER_REC *server, const char *nick) void server_change_nick(SERVER_REC *server, const char *nick)
{ {
g_free(server->connrec->nick);
g_free(server->nick); g_free(server->nick);
server->connrec->nick = g_strdup(nick);
server->nick = g_strdup(nick); server->nick = g_strdup(nick);
signal_emit("server nick changed", 1, server); signal_emit("server nick changed", 1, server);

View File

@ -317,6 +317,9 @@ static void cmd_nick(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item
if (!cmd_get_params(data, &free_arg, 1, &nick)) if (!cmd_get_params(data, &free_arg, 1, &nick))
return; return;
g_free(server->last_nick);
server->last_nick = g_strdup(nick);
irc_send_cmdv(server, "NICK %s", nick); irc_send_cmdv(server, "NICK %s", nick);
cmd_params_free(free_arg); cmd_params_free(free_arg);
} }

View File

@ -301,7 +301,7 @@ static void event_target_unavailable(IRC_SERVER_REC *server, const char *data)
g_free(params); g_free(params);
} }
static void event_nick(SERVER_REC *server, const char *data, static void event_nick(IRC_SERVER_REC *server, const char *data,
const char *orignick) const char *orignick)
{ {
char *params, *nick; char *params, *nick;
@ -312,10 +312,16 @@ static void event_nick(SERVER_REC *server, const char *data,
if (g_strcasecmp(orignick, server->nick) == 0) { if (g_strcasecmp(orignick, server->nick) == 0) {
/* You changed your nick */ /* You changed your nick */
server_change_nick(server, nick); if (g_strcasecmp(server->last_nick, nick) == 0) {
/* changed with /NICK - keep it as wanted nick */
g_free(server->connrec->nick);
server->connrec->nick = g_strdup(nick);
} }
nicklist_rename(server, orignick, nick); server_change_nick(SERVER(server), nick);
}
nicklist_rename(SERVER(server), orignick, nick);
g_free(params); g_free(params);
} }

View File

@ -43,6 +43,8 @@ struct _IRC_SERVER_REC {
REDIRECT_REC *redirect_next; REDIRECT_REC *redirect_next;
REDIRECT_REC *redirect_continue; REDIRECT_REC *redirect_continue;
char *last_nick; /* last /NICK, kept even if it resulted as not valid change */
char *real_address; /* address the irc server gives */ char *real_address; /* address the irc server gives */
char *usermode; /* The whole mode string .. */ char *usermode; /* The whole mode string .. */
char *wanted_usermode; /* The usermode we want to use, doesn't include the modes given us by the server (eg. +r) */ char *wanted_usermode; /* The usermode we want to use, doesn't include the modes given us by the server (eg. +r) */