summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--src/plugins/irc/irc-command.c4
-rw-r--r--src/plugins/irc/irc-protocol.c18
-rw-r--r--src/plugins/irc/irc-server.c3
4 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index c05bb3d64..8711b6aed 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -32,6 +32,7 @@ Bug fixes::
* core: replace newlines by spaces in argument "completion" of function hook_command (issue #538)
* core: replace char "," by "~" in color codes to separate foreground from background (issue #1264)
* alias: remove default aliases /AME and /AMSG (issue #1355)
+ * irc: quote NICK command argument sent to the server only if there's a ":" in the nick (issue #1376, issue #1319)
* irc: return all arguments in the PONG response to a PING (issue #1369)
* irc: disable server reconnection when the server buffer is closed (issue #236)
* irc: strip spaces at beginning/end of addresses in server option "addresses" (issue #195)
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c
index 19f42f1e6..ab88437c3 100644
--- a/src/plugins/irc/irc-command.c
+++ b/src/plugins/irc/irc-command.c
@@ -3543,7 +3543,9 @@ irc_send_nick_server (struct t_irc_server *server, const char *nickname)
if (server->is_connected)
{
irc_server_sendf (server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
- "NICK :%s", nickname);
+ "NICK %s%s",
+ (nickname && strchr (nickname, ':')) ? ":" : "",
+ nickname);
}
else
irc_server_set_nick (server, nickname);
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index e662e8fc7..a68534cbc 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -5446,7 +5446,11 @@ IRC_PROTOCOL_CALLBACK(432)
irc_server_set_nick (server, alternate_nick);
- irc_server_sendf (server, 0, NULL, "NICK :%s", server->nick);
+ irc_server_sendf (
+ server, 0, NULL,
+ "NICK %s%s",
+ (server->nick && strchr (server->nick, ':')) ? ":" : "",
+ server->nick);
}
return WEECHAT_RC_OK;
@@ -5490,7 +5494,11 @@ IRC_PROTOCOL_CALLBACK(433)
irc_server_set_nick (server, alternate_nick);
- irc_server_sendf (server, 0, NULL, "NICK :%s", server->nick);
+ irc_server_sendf (
+ server, 0, NULL,
+ "NICK %s%s",
+ (server->nick && strchr (server->nick, ':')) ? ":" : "",
+ server->nick);
}
else
{
@@ -5548,7 +5556,11 @@ IRC_PROTOCOL_CALLBACK(437)
irc_server_set_nick (server, alternate_nick);
- irc_server_sendf (server, 0, NULL, "NICK :%s", server->nick);
+ irc_server_sendf (
+ server, 0, NULL,
+ "NICK %s%s",
+ (server->nick && strchr (server->nick, ':')) ? ":" : "",
+ server->nick);
}
}
diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c
index 271a7f5d4..22907d7b7 100644
--- a/src/plugins/irc/irc-server.c
+++ b/src/plugins/irc/irc-server.c
@@ -3760,8 +3760,9 @@ irc_server_login (struct t_irc_server *server)
weechat_string_replace (username, " ", "_") : strdup ("weechat");
irc_server_sendf (
server, 0, NULL,
- "NICK :%s\n"
+ "NICK %s%s\n"
"USER %s 0 * :%s",
+ (server->nick && strchr (server->nick, ':')) ? ":" : "",
server->nick,
(username2) ? username2 : "weechat",
(realname && realname[0]) ? realname : ((username2) ? username2 : "weechat"));