irc: add a condition for colon before the password in PASS message (issue #602)

Some weird IRC servers may refuse a PASS command with a colon, so we
send a colon only if the password contains spaces or begins with a
colon.
This commit is contained in:
Sébastien Helleu 2015-11-24 20:26:06 +01:00
parent 9e9dd27bb3
commit 4fca6c58c8
2 changed files with 9 additions and 2 deletions

View File

@ -46,7 +46,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
* core: fix truncated messages after a word with a length of zero on screen
(for example a zero width space: U+200B) (bug #40985, issue #502)
* api: fix handle of invalid escape in function string_convert_escaped_chars()
* irc: add a missing colon before the password in PASS message (issue #602)
* irc: add a missing colon before the password in PASS message, if the password
has spaces or begins with a colon (issue #602)
* irc: fix charset decoding in incoming private messages (issue #520)
* irc: display the arrow before server name in raw buffer
* irc: fix display of messages sent to server in raw buffer

View File

@ -3328,7 +3328,13 @@ irc_server_login (struct t_irc_server *server)
server, IRC_SERVER_OPTION_CAPABILITIES);
if (password && password[0])
irc_server_sendf (server, 0, NULL, "PASS :%s", password);
{
irc_server_sendf (
server, 0, NULL,
"PASS %s%s",
((password[0] == ':') || (strchr (password, ' '))) ? ":" : "",
password);
}
if (!server->nick)
{