mirror of
https://github.com/weechat/weechat.git
synced 2026-06-27 13:05:43 +02:00
irc: fix display of outgoing CTCP when channel/private buffer doesn't exist
This commit is contained in:
@@ -1300,16 +1300,20 @@ irc_ctcp_display_send (struct t_irc_server *server,
|
||||
const char *target, const char *type, const char *args)
|
||||
{
|
||||
struct t_irc_nick *ptr_nick;
|
||||
int is_channel;
|
||||
|
||||
if (weechat_strcasecmp (type, "action") == 0)
|
||||
{
|
||||
if (channel
|
||||
&& irc_server_prefix_char_statusmsg (server, target[0]))
|
||||
if (!channel || irc_server_prefix_char_statusmsg (server, target[0]))
|
||||
{
|
||||
/* STATUSMSG action */
|
||||
/* no buffer or STATUSMSG action */
|
||||
is_channel = ((irc_server_prefix_char_statusmsg (server, target[0])
|
||||
&& irc_channel_is_channel (server, target + 1))
|
||||
|| irc_channel_is_channel (server, target));
|
||||
ptr_nick = irc_nick_search (server, channel, server->nick);
|
||||
weechat_printf_date_tags (
|
||||
channel->buffer,
|
||||
(channel) ? channel->buffer : irc_msgbuffer_get_target_buffer (
|
||||
server, target, NULL, "ctcp", NULL),
|
||||
0,
|
||||
irc_protocol_tags (
|
||||
server,
|
||||
@@ -1322,7 +1326,8 @@ irc_ctcp_display_send (struct t_irc_server *server,
|
||||
weechat_prefix ("network"),
|
||||
/* TRANSLATORS: "Action" is an IRC CTCP "ACTION" sent with /me */
|
||||
_("Action"),
|
||||
IRC_COLOR_CHAT_CHANNEL,
|
||||
(is_channel) ?
|
||||
IRC_COLOR_CHAT_CHANNEL : irc_nick_color_for_msg (server, 0, NULL, target),
|
||||
target,
|
||||
IRC_COLOR_RESET,
|
||||
irc_nick_mode_for_display (server, ptr_nick, 0),
|
||||
|
||||
@@ -711,12 +711,19 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage)
|
||||
"nick_alice,log1");
|
||||
|
||||
/* action in private (with /ctcp) */
|
||||
server_input_data (buffer_server, "/ctcp bob ACTION action pv 2");
|
||||
server_input_data (buffer_server, "/ctcp bob action action pv 2");
|
||||
CHECK_SENT("PRIVMSG bob :\01ACTION action pv 2\01");
|
||||
CHECK_PV("bob", " *", "alice action pv 2",
|
||||
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,log1");
|
||||
|
||||
/* action in private (with /ctcp), without private buffer */
|
||||
server_input_data (buffer_server, "/ctcp bob2 action action pv 3");
|
||||
CHECK_SENT("PRIVMSG bob2 :\01ACTION action pv 3\01");
|
||||
CHECK_SRV("--", "Action -> bob2: alice action pv 3",
|
||||
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
|
||||
"nick_alice,log1");
|
||||
|
||||
/* CTCP version to channel */
|
||||
server_input_data (buffer_server, "/ctcp #test version");
|
||||
CHECK_SENT("PRIVMSG #test :\01VERSION\01");
|
||||
@@ -816,7 +823,7 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage)
|
||||
CHECK_NO_MSG;
|
||||
|
||||
/* action on channel (with /ctcp <channel> action) */
|
||||
server_input_data (buffer_server, "/ctcp #test ACTION action chan 2");
|
||||
server_input_data (buffer_server, "/ctcp #test action action chan 2");
|
||||
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 2\01");
|
||||
CHECK_NO_MSG;
|
||||
|
||||
@@ -831,10 +838,15 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage)
|
||||
CHECK_NO_MSG;
|
||||
|
||||
/* action in private (with /ctcp) */
|
||||
server_input_data (buffer_server, "/ctcp bob ACTION action pv 2");
|
||||
server_input_data (buffer_server, "/ctcp bob action action pv 2");
|
||||
CHECK_SENT("PRIVMSG bob :\01ACTION action pv 2\01");
|
||||
CHECK_NO_MSG;
|
||||
|
||||
/* action in private (with /ctcp), without private buffer */
|
||||
server_input_data (buffer_server, "/ctcp bob2 action action pv 3");
|
||||
CHECK_SENT("PRIVMSG bob2 :\01ACTION action pv 3\01");
|
||||
CHECK_NO_MSG;
|
||||
|
||||
/* CTCP version to channel */
|
||||
server_input_data (buffer_server, "/ctcp #test version");
|
||||
CHECK_SENT("PRIVMSG #test :\01VERSION\01");
|
||||
|
||||
Reference in New Issue
Block a user