diff options
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 15 | ||||
-rw-r--r-- | tests/unit/plugins/irc/test-irc-protocol.cpp | 12 |
2 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index d752d0089..21d5d5972 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4865,12 +4865,16 @@ IRC_PROTOCOL_CALLBACK(341) * Callback for the IRC command "344": channel reop. * * Command looks like: - * :server 344 mynick #channel nick!user@host + * 344 mynick #channel nick!user@host */ IRC_PROTOCOL_CALLBACK(344) { - IRC_PROTOCOL_MIN_ARGS(5); + char *str_host; + + IRC_PROTOCOL_MIN_PARAMS(3); + + str_host = irc_protocol_string_params (params, 2, num_params - 1); weechat_printf_date_tags ( irc_msgbuffer_get_target_buffer (server, NULL, command, "reop", NULL), @@ -4879,10 +4883,13 @@ IRC_PROTOCOL_CALLBACK(344) _("%sChannel reop %s%s%s: %s%s"), weechat_prefix ("network"), IRC_COLOR_CHAT_CHANNEL, - argv[3], + params[1], IRC_COLOR_RESET, IRC_COLOR_CHAT_HOST, - (argv_eol[4][0] == ':') ? argv_eol[4] + 1 : argv_eol[4]); + str_host); + + if (str_host) + free (str_host); return WEECHAT_RC_OK; } diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index 97f08e1dc..5edc5352c 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -2915,20 +2915,24 @@ TEST(IrcProtocolWithServer, 344) { SRV_INIT_JOIN; - /* not enough arguments */ + /* not enough parameters */ RECV(":server 344"); - CHECK_ERROR_ARGS("344", 2, 5); + CHECK_ERROR_PARAMS("344", 0, 3); RECV(":server 344 alice"); - CHECK_ERROR_ARGS("344", 3, 5); + CHECK_ERROR_PARAMS("344", 1, 3); RECV(":server 344 alice #test"); - CHECK_ERROR_ARGS("344", 4, 5); + CHECK_ERROR_PARAMS("344", 2, 3); RECV(":server 344 alice #test nick!user@host"); CHECK_SRV("-- Channel reop #test: nick!user@host"); + RECV(":server 344 alice #test :nick!user@host"); + CHECK_SRV("-- Channel reop #test: nick!user@host"); /* channel not found */ RECV(":server 344 alice #xyz nick!user@host"); CHECK_SRV("-- Channel reop #xyz: nick!user@host"); + RECV(":server 344 alice #xyz :nick!user@host"); + CHECK_SRV("-- Channel reop #xyz: nick!user@host"); } /* |