summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-10-14 23:17:56 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-10-17 21:28:31 +0200
commitbf8c85f422eda0d9c10e2aaddacf5e881c66887d (patch)
treec7891f74c40c439353a53b47364bc0b5ea139ff2 /src
parent179822fb91a6dae34a22cf35f174c0df68917230 (diff)
downloadweechat-bf8c85f422eda0d9c10e2aaddacf5e881c66887d.zip
irc: use parsed command parameters in "quit" command callback
Diffstat (limited to 'src')
-rw-r--r--src/plugins/irc/irc-protocol.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 145ce9176..e848cac0a 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -2835,22 +2835,22 @@ end:
* Callback for the IRC command "QUIT".
*
* Command looks like:
- * :nick!user@host QUIT :quit message
+ * QUIT :quit message
*/
IRC_PROTOCOL_CALLBACK(quit)
{
- char *pos_comment;
+ char *str_params;
struct t_irc_channel *ptr_channel;
struct t_irc_nick *ptr_nick;
struct t_irc_channel_speaking *ptr_nick_speaking;
int local_quit, display_host;
- IRC_PROTOCOL_MIN_ARGS(2);
- IRC_PROTOCOL_CHECK_PREFIX;
+ IRC_PROTOCOL_MIN_PARAMS(0);
+ IRC_PROTOCOL_CHECK_NICK;
- pos_comment = (argc > 2) ?
- ((argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2]) : NULL;
+ str_params = (num_params > 0) ?
+ irc_protocol_string_params (params, 0, num_params - 1) : NULL;
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
@@ -2885,7 +2885,7 @@ IRC_PROTOCOL_CALLBACK(quit)
ptr_channel->has_quit_server = 1;
}
display_host = weechat_config_boolean (irc_config_look_display_host_quit);
- if (pos_comment && pos_comment[0])
+ if (str_params)
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
@@ -2914,7 +2914,7 @@ IRC_PROTOCOL_CALLBACK(quit)
IRC_COLOR_MESSAGE_QUIT,
IRC_COLOR_CHAT_DELIMITERS,
IRC_COLOR_REASON_QUIT,
- pos_comment,
+ str_params,
IRC_COLOR_CHAT_DELIMITERS);
}
else
@@ -2956,6 +2956,9 @@ IRC_PROTOCOL_CALLBACK(quit)
}
}
+ if (str_params)
+ free (str_params);
+
return WEECHAT_RC_OK;
}