diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-16 10:04:29 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 31b15c14231353c68c37ee398ff3e2c532b759ed (patch) | |
tree | dd36b9157ee0d779f1e06df3b42aff3a41a54a38 /src | |
parent | 60c9beab2bf513b3c62b47fabd12748799a68c6f (diff) | |
download | weechat-31b15c14231353c68c37ee398ff3e2c532b759ed.zip |
irc: use parsed command parameters in "328" command callback
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 58baed506..653ae50e4 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4416,18 +4416,20 @@ IRC_PROTOCOL_CALLBACK(327) * Callback for the IRC command "328": channel URL. * * Command looks like: - * :server 328 mynick #channel :https://example.com/ + * 328 mynick #channel :https://example.com/ */ IRC_PROTOCOL_CALLBACK(328) { + char *str_url; struct t_irc_channel *ptr_channel; - IRC_PROTOCOL_MIN_ARGS(5); + IRC_PROTOCOL_MIN_PARAMS(3); - ptr_channel = irc_channel_search (server, argv[3]); + ptr_channel = irc_channel_search (server, params[1]); if (ptr_channel) { + str_url = irc_protocol_string_params (params, 2, num_params - 1); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, NULL, ptr_channel->buffer), @@ -4436,10 +4438,11 @@ IRC_PROTOCOL_CALLBACK(328) _("%sURL for %s%s%s: %s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_RESET, - (argv_eol[4][0] == ':') ? - argv_eol[4] + 1 : argv_eol[4]); + str_url); + if (str_url) + free (str_url); } return WEECHAT_RC_OK; |