summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-protocol.c
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-10-15 21:10:00 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-10-17 21:28:31 +0200
commitf51f3dbe299d817b208c26a8ff4dedccb4465607 (patch)
tree4916e9e90b6173e64fcc1e1d0362d6170449370f /src/plugins/irc/irc-protocol.c
parentefecdf5d450d83ff3a5eb7256791d3d70c87fd1b (diff)
downloadweechat-f51f3dbe299d817b208c26a8ff4dedccb4465607.zip
irc: use parsed command parameters in "305" and "306" command callbacks
Diffstat (limited to 'src/plugins/irc/irc-protocol.c')
-rw-r--r--src/plugins/irc/irc-protocol.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index 616f00e44..de21811b3 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -3799,15 +3799,18 @@ IRC_PROTOCOL_CALLBACK(303)
* Callback for the IRC command "305": unaway.
*
* Command looks like:
- * :server 305 mynick :Does this mean you're really back?
+ * 305 mynick :Does this mean you're really back?
*/
IRC_PROTOCOL_CALLBACK(305)
{
- IRC_PROTOCOL_MIN_ARGS(3);
+ char *str_params;
+
+ IRC_PROTOCOL_MIN_PARAMS(1);
- if (argc > 3)
+ if (num_params > 1)
{
+ str_params = irc_protocol_string_params (params, 1, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, "unaway", NULL),
@@ -3815,7 +3818,9 @@ IRC_PROTOCOL_CALLBACK(305)
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s",
weechat_prefix ("network"),
- (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
+ str_params);
+ if (str_params)
+ free (str_params);
}
server->is_away = 0;
@@ -3830,15 +3835,18 @@ IRC_PROTOCOL_CALLBACK(305)
* Callback for the IRC command "306": now away.
*
* Command looks like:
- * :server 306 mynick :We'll miss you
+ * 306 mynick :We'll miss you
*/
IRC_PROTOCOL_CALLBACK(306)
{
- IRC_PROTOCOL_MIN_ARGS(3);
+ char *str_params;
+
+ IRC_PROTOCOL_MIN_PARAMS(1);
- if (argc > 3)
+ if (num_params > 1)
{
+ str_params = irc_protocol_string_params (params, 1, num_params - 1);
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (
server, NULL, command, "away", NULL),
@@ -3846,7 +3854,9 @@ IRC_PROTOCOL_CALLBACK(306)
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s",
weechat_prefix ("network"),
- (argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]);
+ str_params);
+ if (str_params)
+ free (str_params);
}
server->is_away = 1;