summaryrefslogtreecommitdiff
path: root/src/plugins/irc
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/irc')
-rw-r--r--src/plugins/irc/irc-protocol.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index af1bb29d7..ab4a3dd1e 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -3138,21 +3138,17 @@ IRC_PROTOCOL_CALLBACK(server_mode_reason)
IRC_PROTOCOL_CALLBACK(numeric)
{
- char *pos_args;
+ int arg_text;
+ char *str_params;
- IRC_PROTOCOL_MIN_ARGS(3);
+ IRC_PROTOCOL_MIN_PARAMS(1);
- if (irc_server_strcasecmp (server, server->nick, argv[2]) == 0)
- {
- pos_args = (argc > 3) ?
- ((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
- }
- else
- {
- pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
- }
+ arg_text = (irc_server_strcasecmp (server, server->nick, params[0]) == 0) ?
+ 1 : 0;
+
+ str_params = irc_protocol_string_params (params, arg_text, num_params - 1);
- if (pos_args)
+ if (str_params && str_params[0])
{
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL),
@@ -3160,9 +3156,12 @@ IRC_PROTOCOL_CALLBACK(numeric)
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s",
weechat_prefix ("network"),
- pos_args);
+ str_params);
}
+ if (str_params)
+ free (str_params);
+
return WEECHAT_RC_OK;
}