diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-15 20:03:55 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2021-10-17 21:28:31 +0200 |
commit | 76b75ad5cdcd3cd418f2b2d4d09e7bb3043f8cd3 (patch) | |
tree | ecaccebc71392c465e919b260a2e70ccfce850b5 /src/plugins/irc | |
parent | 74ceaa1a6882d777909822a4b8334c769127d70f (diff) | |
download | weechat-76b75ad5cdcd3cd418f2b2d4d09e7bb3043f8cd3.zip |
irc: use parsed command parameters in "numeric" command callback
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 25 |
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; } |