diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2022-02-10 20:50:16 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-02-10 20:50:16 +0100 |
commit | ba7ff87d19217b92dda4eee6a5020aa29441bae1 (patch) | |
tree | 067310b0ff98aecf0737deebfea38708eb8d76d9 /src/plugins/irc | |
parent | d7c8b16c4fcd366f294519268145a7217fa3900f (diff) | |
download | weechat-ba7ff87d19217b92dda4eee6a5020aa29441bae1.zip |
irc: fix parsing of message 223 (m_filter) sent by InspIRCd server (closes #1751)
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 97 |
1 files changed, 59 insertions, 38 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 699178743..bcf8e3751 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -3951,32 +3951,44 @@ IRC_PROTOCOL_CALLBACK(306) * * Command looks like: * 319 mynick nick :some text here + * + * On InspIRCd server (not a whois reply): + * 223 mynick :EXEMPT #help */ IRC_PROTOCOL_CALLBACK(whois_nick_msg) { char *str_params; - IRC_PROTOCOL_MIN_PARAMS(3); - - str_params = irc_protocol_string_params (params, 2, 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", - 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_params); + IRC_PROTOCOL_MIN_PARAMS(2); - if (str_params) - free (str_params); + if (num_params >= 3) + { + str_params = irc_protocol_string_params (params, 2, 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", + 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_params); + if (str_params) + free (str_params); + } + else + { + /* + * not enough parameters: this should not be a whois command so we + * display the arguments as-is + */ + IRC_PROTOCOL_RUN_CALLBACK(numeric); + } return WEECHAT_RC_OK; } @@ -3992,26 +4004,35 @@ IRC_PROTOCOL_CALLBACK(whowas_nick_msg) { char *str_params; - IRC_PROTOCOL_MIN_PARAMS(3); - - str_params = irc_protocol_string_params (params, 2, num_params - 1); - - weechat_printf_date_tags ( - irc_msgbuffer_get_target_buffer ( - server, params[1], command, "whowas", NULL), - date, - irc_protocol_tags (command, tags, "irc_numeric", NULL, NULL), - "%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_params); + IRC_PROTOCOL_MIN_PARAMS(2); - if (str_params) - free (str_params); + if (num_params >= 3) + { + str_params = irc_protocol_string_params (params, 2, num_params - 1); + weechat_printf_date_tags ( + irc_msgbuffer_get_target_buffer ( + server, params[1], command, "whowas", NULL), + date, + irc_protocol_tags (command, tags, "irc_numeric", NULL, NULL), + "%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_params); + if (str_params) + free (str_params); + } + else + { + /* + * not enough parameters: this should not be a whowas command so we + * display the arguments as-is + */ + IRC_PROTOCOL_RUN_CALLBACK(numeric); + } return WEECHAT_RC_OK; } |