diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2019-07-11 07:08:36 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2019-07-11 07:08:36 +0200 |
commit | fd592c2323ec7011c74a655c05cb3d12b1610761 (patch) | |
tree | be7fcca539346ac921ac0313e371aaf1ab75b741 /src/plugins/irc | |
parent | 82a92bd4e9bc2330b9c25cc1a54be658bff1312e (diff) | |
download | weechat-fd592c2323ec7011c74a655c05cb3d12b1610761.zip |
irc: quote NICK command argument sent to the server only if there's a ":" in the nick (closes #1376, issue #1319)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-command.c | 4 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 18 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 3 |
3 files changed, 20 insertions, 5 deletions
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")); |