1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 07:16:37 +02:00

irc: fix parsing of message 338 (whois, host) sent by Rizon server (closes #1737)

This commit is contained in:
Sébastien Helleu
2022-01-05 08:24:04 +01:00
parent 8c49475f75
commit 0d6b18bc54
3 changed files with 39 additions and 26 deletions
+1
View File
@@ -27,6 +27,7 @@ New features::
Bug fixes::
* core: fix display of hotlist in buflist after changing value of option weechat.look.hotlist_sort (issue #1733)
* irc: fix parsing of message 338 (whois, host) sent by Rizon server (issue #1737)
* irc: fix display of message 344 received as whois geo info (issue #1736)
* irc: fix display of IRC numeric messages with no parameters
+31 -21
View File
@@ -4881,34 +4881,44 @@ IRC_PROTOCOL_CALLBACK(333)
*
* Command looks like:
* 338 mynick nick host :actually using host
*
* On Rizon server:
* 338 mynick nick :is actually user@host [ip]
*/
IRC_PROTOCOL_CALLBACK(338)
{
char *str_text;
IRC_PROTOCOL_MIN_PARAMS(4);
IRC_PROTOCOL_MIN_PARAMS(3);
str_text = irc_protocol_string_params (params, 3, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, params[1], command, "whois", NULL),
date,
irc_protocol_tags (command, tags, "irc_numeric", NULL, NULL),
"%s%s[%s%s%s]%s %s %s%s",
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
irc_nick_color_for_msg (server, 1, NULL, params[1]),
params[1],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
str_text,
IRC_COLOR_CHAT_HOST,
params[2]);
if (str_text)
free (str_text);
if (num_params < 4)
{
irc_protocol_cb_whois_nick_msg (server, date, irc_message, tags, nick,
address, host, command, ignored,
params, num_params);
}
else
{
str_text = irc_protocol_string_params (params, 3, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, params[1], command, "whois", NULL),
date,
irc_protocol_tags (command, tags, "irc_numeric", NULL, NULL),
"%s%s[%s%s%s]%s %s %s%s",
weechat_prefix ("network"),
IRC_COLOR_CHAT_DELIMITERS,
irc_nick_color_for_msg (server, 1, NULL, params[1]),
params[1],
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_RESET,
str_text,
IRC_COLOR_CHAT_HOST,
params[2]);
if (str_text)
free (str_text);
}
return WEECHAT_RC_OK;
}
+7 -5
View File
@@ -2924,16 +2924,18 @@ TEST(IrcProtocolWithServer, 338)
/* not enough parameters */
RECV(":server 338");
CHECK_ERROR_PARAMS("338", 0, 4);
CHECK_ERROR_PARAMS("338", 0, 3);
RECV(":server 338 alice");
CHECK_ERROR_PARAMS("338", 1, 4);
CHECK_ERROR_PARAMS("338", 1, 3);
RECV(":server 338 alice bob");
CHECK_ERROR_PARAMS("338", 2, 4);
RECV(":server 338 alice bob hostname");
CHECK_ERROR_PARAMS("338", 3, 4);
CHECK_ERROR_PARAMS("338", 2, 3);
RECV(":server 338 alice bob hostname :actually using host");
CHECK_SRV("-- [bob] actually using host hostname");
/* on Rizon server */
RECV(":server 338 alice bob :is actually bob@example.com [1.2.3.4]");
CHECK_SRV("-- [bob] is actually bob@example.com [1.2.3.4]");
}
/*