summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-10-10 22:03:47 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-10-17 21:28:31 +0200
commitdf6f32a7bb1e097af20eded11f0f5c7a6837740b (patch)
tree974b1ffd7a26c2aad691c742ee63527dcfe5f1e5
parenta2a733fc36de9403080fa265027cae92e87a068a (diff)
downloadweechat-df6f32a7bb1e097af20eded11f0f5c7a6837740b.zip
irc: use parsed command parameters in "error" command callback
-rw-r--r--src/plugins/irc/irc-protocol.c15
1 files 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;
}