diff options
Diffstat (limited to 'tests/unit/plugins')
-rw-r--r-- | tests/unit/plugins/irc/test-irc-protocol.cpp | 122 |
1 files changed, 76 insertions, 46 deletions
diff --git a/tests/unit/plugins/irc/test-irc-protocol.cpp b/tests/unit/plugins/irc/test-irc-protocol.cpp index cfec8b399..2f857dac4 100644 --- a/tests/unit/plugins/irc/test-irc-protocol.cpp +++ b/tests/unit/plugins/irc/test-irc-protocol.cpp @@ -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"); } |