From df6f32a7bb1e097af20eded11f0f5c7a6837740b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 10 Oct 2021 22:03:47 +0200 Subject: [PATCH] irc: use parsed command parameters in "error" command callback --- src/plugins/irc/irc-protocol.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 6fbf415de..03879b982 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -1227,11 +1227,11 @@ IRC_PROTOCOL_CALLBACK(chghost) IRC_PROTOCOL_CALLBACK(error) { - char *ptr_args; + char *str_params; - IRC_PROTOCOL_MIN_ARGS(2); + IRC_PROTOCOL_MIN_PARAMS(1); - ptr_args = (argv_eol[1][0] == ':') ? argv_eol[1] + 1 : argv_eol[1]; + str_params = irc_protocol_string_params (params, 0); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL), @@ -1239,12 +1239,13 @@ IRC_PROTOCOL_CALLBACK(error) irc_protocol_tags (command, NULL, NULL, NULL), "%s%s", weechat_prefix ("error"), - ptr_args); + str_params); - if (strncmp (ptr_args, "Closing Link", 12) == 0) - { + if (str_params && (strncmp (str_params, "Closing Link", 12) == 0)) irc_server_disconnect (server, !server->is_connected, 1); - } + + if (str_params) + free (str_params); return WEECHAT_RC_OK; }