diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-16 09:42:25 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | df9c32b0c3ef78c9a8866779e554994f694139f6 (patch) | |
tree | e99b0172f399dc52fac1ead838ec5a7e0b7b30b4 /src/plugins/irc | |
parent | c577da0375c8f75a073d63e582a5a37a7ed2c782 (diff) | |
download | weechat-df9c32b0c3ef78c9a8866779e554994f694139f6.zip |
irc: use parsed command parameters in "322" command callback
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 5510cccaa..b7727ebf4 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4224,21 +4224,19 @@ IRC_PROTOCOL_CALLBACK(321) * Callback for the IRC command "322": channel for /list. * * Command looks like: - * :server 322 mynick #channel 3 :topic of channel + * 322 mynick #channel 3 :topic of channel */ IRC_PROTOCOL_CALLBACK(322) { - char *pos_topic; - - IRC_PROTOCOL_MIN_ARGS(5); + char *str_params; - pos_topic = (argc > 5) ? - ((argv_eol[5][0] == ':') ? argv_eol[5] + 1 : argv_eol[5]) : NULL; + IRC_PROTOCOL_MIN_PARAMS(3); if (!server->cmd_list_regexp || - (regexec (server->cmd_list_regexp, argv[3], 0, NULL, 0) == 0)) + (regexec (server->cmd_list_regexp, params[1], 0, NULL, 0) == 0)) { + str_params = irc_protocol_string_params (params, 3, num_params - 1); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer ( server, NULL, command, "list", NULL), @@ -4247,14 +4245,16 @@ IRC_PROTOCOL_CALLBACK(322) "%s%s%s%s(%s%s%s)%s%s%s", weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - argv[4], + params[2], IRC_COLOR_CHAT_DELIMITERS, IRC_COLOR_RESET, - (pos_topic && pos_topic[0]) ? ": " : "", - (pos_topic && pos_topic[0]) ? pos_topic : ""); + (str_params && str_params[0]) ? ": " : "", + (str_params && str_params[0]) ? str_params : ""); + if (str_params) + free (str_params); } return WEECHAT_RC_OK; |