summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/irc/irc-protocol.c24
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp10
2 files changed, 16 insertions, 18 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index c3a83286b..d752d0089 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -4834,32 +4834,28 @@ IRC_PROTOCOL_CALLBACK(338)
* Callback for the IRC command "341": inviting.
*
* Command looks like:
- * :server 341 mynick nick #channel
- * :server 341 mynick nick :#channel
+ * 341 mynick nick #channel
+ * 341 mynick nick :#channel
*/
IRC_PROTOCOL_CALLBACK(341)
{
- char *pos_channel;
-
- IRC_PROTOCOL_MIN_ARGS(5);
-
- pos_channel = (argv[4][0] == ':') ? argv[4] + 1 : argv[4];
+ IRC_PROTOCOL_MIN_PARAMS(3);
weechat_printf_date_tags (
- irc_msgbuffer_get_target_buffer (server, argv[2], command, NULL, NULL),
+ irc_msgbuffer_get_target_buffer (server, params[0], command, NULL, NULL),
date,
- irc_protocol_tags (command, "irc_numeric", argv[2], address),
+ irc_protocol_tags (command, "irc_numeric", params[0], address),
_("%s%s%s%s has invited %s%s%s to %s%s%s"),
weechat_prefix ("network"),
- irc_nick_color_for_msg (server, 1, NULL, argv[2]),
- argv[2],
+ irc_nick_color_for_msg (server, 1, NULL, params[0]),
+ params[0],
IRC_COLOR_RESET,
- irc_nick_color_for_msg (server, 1, NULL, argv[3]),
- argv[3],
+ irc_nick_color_for_msg (server, 1, NULL, params[1]),
+ params[1],
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
- pos_channel,
+ params[2],
IRC_COLOR_RESET);
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 9ea7f492d..97f08e1dc 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -2892,16 +2892,18 @@ TEST(IrcProtocolWithServer, 341)
{
SRV_INIT;
- /* not enough arguments */
+ /* not enough parameters */
RECV(":server 341");
- CHECK_ERROR_ARGS("341", 2, 5);
+ CHECK_ERROR_PARAMS("341", 0, 3);
RECV(":server 341 alice");
- CHECK_ERROR_ARGS("341", 3, 5);
+ CHECK_ERROR_PARAMS("341", 1, 3);
RECV(":server 341 alice bob");
- CHECK_ERROR_ARGS("341", 4, 5);
+ CHECK_ERROR_PARAMS("341", 2, 3);
RECV(":server 341 alice bob #test");
CHECK_SRV("-- alice has invited bob to #test");
+ RECV(":server 341 alice bob :#test");
+ CHECK_SRV("-- alice has invited bob to #test");
}
/*