summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-05-27 11:57:17 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-05-27 16:49:08 +0200
commit3a0141174b6a10f8f4816028f44a9093fb22ce1f (patch)
treef93388d414ef65b3cffbba4b629009115e4452e7
parentdbcb8d3dbf3c4247d675ac87f0e4255bbfddc564 (diff)
downloadweechat-3a0141174b6a10f8f4816028f44a9093fb22ce1f.zip
irc: fix display of outgoing STATUSMSG CTCP ACTION without arguments
-rw-r--r--src/plugins/irc/irc-ctcp.c7
-rw-r--r--tests/unit/plugins/irc/test-irc-protocol.cpp36
2 files changed, 39 insertions, 4 deletions
diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c
index c3a75d561..0a0d32900 100644
--- a/src/plugins/irc/irc-ctcp.c
+++ b/src/plugins/irc/irc-ctcp.c
@@ -1318,7 +1318,7 @@ irc_ctcp_display_send (struct t_irc_server *server,
"irc_action,self_msg,notify_none,no_highlight",
server->nick,
NULL),
- "%s%s -> %s%s%s: %s%s%s%s %s",
+ "%s%s -> %s%s%s: %s%s%s%s%s%s",
weechat_prefix ("network"),
/* TRANSLATORS: "Action" is an IRC CTCP "ACTION" sent with /me */
_("Action"),
@@ -1328,8 +1328,9 @@ irc_ctcp_display_send (struct t_irc_server *server,
irc_nick_mode_for_display (server, ptr_nick, 0),
IRC_COLOR_CHAT_NICK_SELF,
server->nick,
- IRC_COLOR_RESET,
- args);
+ (args && args[0]) ? IRC_COLOR_RESET : "",
+ (args && args[0]) ? " " : "",
+ (args && args[0]) ? args : "");
}
else
{
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp
index e681fb2a6..1cb2d5bbf 100644
--- a/tests/unit/plugins/irc/test-irc-protocol.cpp
+++ b/tests/unit/plugins/irc/test-irc-protocol.cpp
@@ -675,6 +675,13 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage)
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
+ /* action on channel (with /me), no message */
+ server_input_data (buffer_chan, "/me");
+ CHECK_SENT("PRIVMSG #test :\01ACTION\01");
+ CHECK_CHAN(" *", "alice",
+ "irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
+ "nick_alice,log1");
+
/* action on channel (with /ctcp <channel> action) */
server_input_data (buffer_server, "/ctcp #test action action chan 2");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 2\01");
@@ -682,6 +689,13 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage)
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
+ /* action on channel (with /ctcp <channel> action), no message */
+ server_input_data (buffer_server, "/ctcp #test action");
+ CHECK_SENT("PRIVMSG #test :\01ACTION\01");
+ CHECK_CHAN(" *", "alice",
+ "irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
+ "nick_alice,log1");
+
/* STATUSMSG action on channel (with /ctcp @<channel> action) */
server_input_data (buffer_server, "/ctcp @#test action action chan ops");
CHECK_SENT("PRIVMSG @#test :\01ACTION action chan ops\01");
@@ -761,6 +775,11 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage)
CHECK_SENT("PRIVMSG #test :msg chan 2");
CHECK_NO_MSG;
+ /* STATUSMSG message to channel (with /msg @<channel>) */
+ server_input_data (buffer_server, "/msg @#test msg chan ops");
+ CHECK_SENT("PRIVMSG @#test :msg chan ops");
+ CHECK_NO_MSG;
+
/* message to a nick (text in private buffer) */
server_input_data (buffer_pv, "msg pv 1");
CHECK_SENT("PRIVMSG bob :msg pv 1");
@@ -776,6 +795,11 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage)
CHECK_SENT("NOTICE #test :notice chan");
CHECK_NO_MSG;
+ /* STATUSMSG notice to channel */
+ server_input_data (buffer_server, "/notice @#test notice chan ops");
+ CHECK_SENT("NOTICE @#test :notice chan ops");
+ CHECK_NO_MSG;
+
/* notice to a nick */
server_input_data (buffer_server, "/notice bob notice pv");
CHECK_SENT("NOTICE bob :notice pv");
@@ -786,11 +810,21 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage)
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 1\01");
CHECK_NO_MSG;
- /* action on channel (with /ctcp) */
+ /* action on channel (with /me), no message */
+ server_input_data (buffer_chan, "/me");
+ CHECK_SENT("PRIVMSG #test :\01ACTION\01");
+ CHECK_NO_MSG;
+
+ /* action on channel (with /ctcp <channel> action) */
server_input_data (buffer_server, "/ctcp #test ACTION action chan 2");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 2\01");
CHECK_NO_MSG;
+ /* STATUSMSG action on channel (with /ctcp @<channel> action) */
+ server_input_data (buffer_server, "/ctcp @#test action action chan ops");
+ CHECK_SENT("PRIVMSG @#test :\01ACTION action chan ops\01");
+ CHECK_NO_MSG;
+
/* action in private (with /me) */
server_input_data (buffer_pv, "/me action pv 1");
CHECK_SENT("PRIVMSG bob :\01ACTION action pv 1\01");