1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-12 14:14:48 +02:00

irc: add missing tags on self action messages when capability echo-message is enabled (closes #2074)

This commit is contained in:
Sébastien Helleu
2024-02-16 20:58:31 +01:00
parent 162bcb2622
commit 90c87e7553
6 changed files with 90 additions and 46 deletions
+1
View File
@@ -27,6 +27,7 @@ New features::
Bug fixes::
* core: remove trailing directory separators in home directories (issue #2070)
* irc: add missing tags on self action messages when capability echo-message is enabled (issue #2074)
* irc: don't strip monospace color code 0x11 from incoming messages (issue #2073)
* irc: fix random date displayed when a received message contains tags but no "time" (issue #2064)
* scripts: fix crash on script unload when a hook is created in a buffer close callback (issue #2067)
+6
View File
@@ -389,6 +389,7 @@ irc_command_me_channel_message (struct t_irc_server *server,
server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
channel_name,
NULL, /* address */
"privmsg",
@@ -1976,6 +1977,7 @@ IRC_COMMAND_CALLBACK(ctcp)
ptr_server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
ctcp_target,
NULL, /* address */
"privmsg",
@@ -3844,6 +3846,7 @@ IRC_COMMAND_CALLBACK(msg)
ptr_server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
ptr_channel->name,
NULL, /* address */
"privmsg",
@@ -3868,6 +3871,7 @@ IRC_COMMAND_CALLBACK(msg)
ptr_server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
targets[i],
NULL, /* address */
"privmsg",
@@ -4070,6 +4074,7 @@ IRC_COMMAND_CALLBACK(notice)
ptr_server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
argv[arg_target],
NULL, /* address */
"notice",
@@ -4601,6 +4606,7 @@ IRC_COMMAND_CALLBACK(query)
ptr_server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
ptr_channel->name,
NULL, /* address */
"privmsg",
+3
View File
@@ -65,6 +65,7 @@ void
irc_input_user_message_display (struct t_irc_server *server,
time_t date,
int date_usec,
struct t_hashtable *tags,
const char *target,
const char *address,
const char *command,
@@ -88,6 +89,7 @@ irc_input_user_message_display (struct t_irc_server *server,
ctxt.server = server;
ctxt.date = date;
ctxt.date_usec = date_usec;
ctxt.tags = tags;
ctxt.address = (char *)address;
ctxt.command = (char *)command;
@@ -325,6 +327,7 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
ptr_server,
0, /* date */
0, /* date_usec */
NULL, /* tags */
ptr_channel->name,
NULL, /* address */
"privmsg",
+2
View File
@@ -22,11 +22,13 @@
#include <time.h>
struct t_hashtable;
struct t_gui_buffer;
extern void irc_input_user_message_display (struct t_irc_server *server,
time_t date,
int date_usec,
struct t_hashtable *tags,
const char *target,
const char *address,
const char *command,
+2
View File
@@ -3056,6 +3056,7 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_protocol_ctxt *ctxt,
ctxt->server,
ctxt->date,
ctxt->date_usec,
ctxt->tags,
target,
ctxt->address,
"privmsg",
@@ -3347,6 +3348,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
ctxt->server,
ctxt->date,
ctxt->date_usec,
ctxt->tags,
remote_nick,
ctxt->address,
"privmsg",
+76 -46
View File
@@ -2886,7 +2886,7 @@ TEST(IrcProtocolWithServer, privmsg)
"irc_privmsg,irc_tag_tag1=value1,irc_tag_tag2=value2,"
"notify_private,prefix_nick_248,nick_bob,host_user@host,log1");
/* message with tags + time as timestamp to channel/user */
/* message with tags + time as timestamp to channel/user */
RECV("@tag1=value1;tag2=value2;time=1703500149 :bob!user@host PRIVMSG #test "
":this is the message ");
CHECK_CHAN_DATE_VALUE(
@@ -3088,86 +3088,109 @@ TEST(IrcProtocolWithServer, privmsg)
"), name: file.txt, 3 bytes (protocol: dcc)");
/* valid CTCP to channel */
RECV(":bob!user@host PRIVMSG #test :\01TEST\01");
RECV(":bob!user@host PRIVMSG #test :\01ACTION\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG #test :\01TEST\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG #test :\01ACTION\01");
CHECK_CHAN(" *", "bob",
"irc_privmsg,irc_action,notify_message,nick_bob,"
"host_user@host,log1");
RECV(":bob!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,notify_message,nick_bob,host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01");
CHECK_CHAN(" *", "bob is testing with bold",
"irc_privmsg,irc_action,notify_message,nick_bob,"
"host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,notify_message,nick_bob,host_user@host,log1");
RECV(":bob!user@host PRIVMSG #test :\01VERSION\01");
RECV(":bob!user@host PRIVMSG #test :\01DCC SEND file.txt 1 2 3\01");
/* valid CTCP to ops of channel */
RECV(":bob!user@host PRIVMSG @#test :\01ACTION\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG @#test :\01ACTION\01");
CHECK_CHAN("--", "Action -> @#test: bob",
"irc_privmsg,irc_action,notify_message,nick_bob,"
"host_user@host,log1");
RECV(":bob!user@host PRIVMSG @#test :\01ACTION is testing\01");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,notify_message,nick_bob,host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG @#test :\01ACTION is testing\01");
CHECK_CHAN("--", "Action -> @#test: bob is testing",
"irc_privmsg,irc_action,notify_message,nick_bob,"
"host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,notify_message,nick_bob,host_user@host,log1");
/*
* valid CTCP to channel from self nick
* (case of bouncer or if echo-message capability is enabled)
*/
RECV(":alice!user@host PRIVMSG #test :\01VERSION\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG #test :\01VERSION\01");
CHECK_CHAN("--", "CTCP query to #test: VERSION",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,host_user@host,log1");
RECV(":alice!user@host PRIVMSG #test :\01ACTION\01");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,self_msg,notify_none,no_highlight,nick_alice,"
"host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG #test :\01ACTION\01");
CHECK_CHAN(" *", "alice",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,host_user@host,log1");
RECV(":alice!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,self_msg,notify_none,no_highlight,nick_alice,"
"host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG #test :\01ACTION is testing with \02bold\02\01");
CHECK_CHAN(" *", "alice is testing with bold",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,self_msg,notify_none,no_highlight,nick_alice,"
"host_user@host,log1");
/*
* valid CTCP to ops of channel from self nick
* (case of bouncer or if echo-message capability is enabled)
*/
RECV(":alice!user@host PRIVMSG @#test :\01ACTION\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG @#test :\01ACTION\01");
CHECK_CHAN("--", "Action -> @#test: alice",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,host_user@host,log1");
RECV(":alice!user@host PRIVMSG @#test :\01ACTION is testing\01");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,self_msg,notify_none,no_highlight,nick_alice,"
"host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG @#test :\01ACTION is testing\01");
CHECK_CHAN("--", "Action -> @#test: alice is testing",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_action,self_msg,notify_none,no_highlight,nick_alice,"
"host_user@host,log1");
/* valid CTCP to user */
RECV(":bob!user@host PRIVMSG alice :\01TEST\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01TEST\01");
CHECK_SENT(NULL);
RECV(":bob!user@host PRIVMSG alice :\01ACTION\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01ACTION\01");
CHECK_SENT(NULL);
RECV(":bob!user@host PRIVMSG alice :\01ACTION is testing\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01ACTION is testing\01");
CHECK_SENT(NULL);
RECV(":bob!user@host PRIVMSG alice :\01VERSION\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01VERSION\01");
CHECK_SRV("--", "CTCP requested by bob: VERSION",
"irc_privmsg,irc_ctcp,nick_bob,host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_bob,host_user@host,log1");
info = irc_ctcp_eval_reply (ptr_server,
irc_ctcp_get_reply (ptr_server, "VERSION"));
snprintf (message, sizeof (message),
"CTCP reply to bob: VERSION %s", info);
CHECK_SRV("--", message,
"irc_privmsg,irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"no_highlight,nick_alice,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,irc_ctcp_reply,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
snprintf (message, sizeof (message),
"NOTICE bob :\01VERSION %s\01", info);
CHECK_SENT(message);
free (info);
RECV(":bob!user@host PRIVMSG alice :\01SOURCE\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01SOURCE\01");
info = hook_info_get (NULL, "weechat_site_download", "");
snprintf (message, sizeof (message),
"NOTICE bob :\01SOURCE %s\01", info);
CHECK_SENT(message);
free (info);
RECV(":bob!user@host PRIVMSG alice :\01DCC SEND file.txt 1 2 3\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01DCC SEND file.txt 1 2 3\01");
CHECK_CORE("",
"xfer: incoming file from bob (0.0.0.1, irc." IRC_FAKE_SERVER
"), name: file.txt, 3 bytes (protocol: dcc)");
@@ -3177,31 +3200,38 @@ TEST(IrcProtocolWithServer, privmsg)
* valid CTCP to channel from self nick
* (case of bouncer or if echo-message capability is enabled)
*/
RECV(":alice!user@host PRIVMSG alice :\01CLIENTINFO\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG alice :\01CLIENTINFO\01");
if (i == 0)
{
CHECK_SRV("--", "CTCP requested by alice: CLIENTINFO",
"irc_privmsg,irc_ctcp,nick_alice,host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_alice,host_user@host,log1");
CHECK_SRV("--", "CTCP reply to alice: CLIENTINFO ACTION CLIENTINFO "
"DCC PING SOURCE TIME VERSION",
"irc_privmsg,irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"no_highlight,nick_alice,host_user@host,log1");
}
else
{
CHECK_SRV("--", "CTCP query to alice: CLIENTINFO",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,self_msg,notify_none,no_highlight,nick_alice,"
"host_user@host,log1");
/*
* with echo-message capability, when the same message is received
* for the second time, the request and reply are displayed
*/
RECV(":alice!user@host PRIVMSG alice :\01CLIENTINFO\01");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG alice :\01CLIENTINFO\01");
CHECK_SRV("--", "CTCP requested by alice: CLIENTINFO",
"irc_privmsg,irc_ctcp,nick_alice,host_user@host,log1");
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_alice,host_user@host,log1");
CHECK_SRV("--", "CTCP reply to alice: CLIENTINFO ACTION CLIENTINFO "
"DCC PING SOURCE TIME VERSION",
"irc_privmsg,irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"no_highlight,nick_alice,host_user@host,log1");
}