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

core, plugins, tests: fix octal notation in strings

This commit is contained in:
Sébastien Helleu
2024-09-17 22:13:57 +02:00
parent 2b702f21d3
commit 02847246b2
13 changed files with 225 additions and 225 deletions
+2 -2
View File
@@ -446,7 +446,7 @@ irc_command_me_channel_message (struct t_irc_server *server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_LIST
| IRC_SERVER_SEND_MULTILINE,
NULL,
"PRIVMSG %s :\01ACTION%s%s\01",
"PRIVMSG %s :\001ACTION%s%s\001",
channel_name,
(message && message[0]) ? " " : "",
(message && message[0]) ? message : "");
@@ -6707,7 +6707,7 @@ IRC_COMMAND_CALLBACK(version)
&& irc_nick_search (ptr_server, ptr_channel, argv[1]))
{
irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01VERSION\01", argv[1]);
"PRIVMSG %s :\001VERSION\001", argv[1]);
}
else
{
+14 -14
View File
@@ -170,7 +170,7 @@ irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
/*
* Extracts CTCP type and arguments from message, which format is:
* \01TYPE arguments...\01
* \001TYPE arguments...\001
*
* Strings *type and *arguments are set with type and arguments parsed,
* both are set to NULL in case of error.
@@ -188,10 +188,10 @@ irc_ctcp_parse_type_arguments (const char *message,
*type = NULL;
*arguments = NULL;
if (message[0] != '\01')
if (message[0] != '\001')
return;
pos_end = strrchr (message + 1, '\01');
pos_end = strrchr (message + 1, '\001');
if (!pos_end)
return;
@@ -263,7 +263,7 @@ irc_ctcp_display_reply_from_nick (struct t_irc_protocol_ctxt *ctxt,
while (ptr_args && ptr_args[0])
{
pos_end = strrchr (ptr_args + 1, '\01');
pos_end = strrchr (ptr_args + 1, '\001');
if (pos_end)
pos_end[0] = '\0';
@@ -396,7 +396,7 @@ irc_ctcp_display_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
{
char *ctcp_type, *ctcp_args, *ctcp_args_no_colors;
if (!ctxt || !arguments || (arguments[0] != '\01'))
if (!ctxt || !arguments || (arguments[0] != '\001'))
return;
irc_ctcp_parse_type_arguments (arguments, &ctcp_type, &ctcp_args);
@@ -434,10 +434,10 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
list_messages = NULL;
/*
* replace any "\01" by a space to prevent any firewall attack via
* replace any "\001" by a space to prevent any firewall attack via
* nf_conntrack_irc (CVE-2022-2663)
*/
dup_ctcp = weechat_string_replace (ctcp, "\01", " ");
dup_ctcp = weechat_string_replace (ctcp, "\001", " ");
if (!dup_ctcp)
goto end;
@@ -448,10 +448,10 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
if (arguments)
{
/*
* replace any "\01" by a space to prevent any firewall attack via
* replace any "\001" by a space to prevent any firewall attack via
* nf_conntrack_irc (CVE-2022-2663)
*/
dup_args = weechat_string_replace (arguments, "\01", " ");
dup_args = weechat_string_replace (arguments, "\001", " ");
if (!dup_args)
goto end;
}
@@ -461,7 +461,7 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_LIST
| IRC_SERVER_SEND_MULTILINE,
NULL,
"NOTICE %s :\01%s%s%s\01",
"NOTICE %s :\001%s%s%s\001",
ctxt->nick,
dup_ctcp_upper,
(dup_args) ? " " : "",
@@ -478,13 +478,13 @@ irc_ctcp_reply_to_nick (struct t_irc_protocol_ctxt *ctxt,
ptr_message = (const char *)weechat_arraylist_get (list_messages, i);
if (!ptr_message)
break;
/* build arguments: '\01' + CTCP + ' ' + message + '\01' */
/* build arguments: '\001' + CTCP + ' ' + message + '\001' */
length = 1 + strlen (dup_ctcp_upper) + 1 + strlen (ptr_message) + 1 + 1;
message = malloc (length);
if (message)
{
snprintf (message, length,
"\01%s %s\01", dup_ctcp_upper, ptr_message);
"\001%s %s\001", dup_ctcp_upper, ptr_message);
irc_ctcp_display_reply_to_nick (ctxt, ctxt->nick, message);
free (message);
}
@@ -1419,7 +1419,7 @@ irc_ctcp_recv (struct t_irc_protocol_ctxt *ctxt,
while (ptr_args && ptr_args[0])
{
pos_end = strrchr (ptr_args + 1, '\01');
pos_end = strrchr (ptr_args + 1, '\001');
if (pos_end)
pos_end[0] = '\0';
@@ -1648,7 +1648,7 @@ irc_ctcp_send (struct t_irc_server *server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH
| IRC_SERVER_SEND_MULTILINE,
NULL,
"PRIVMSG %s :\01%s%s%s\01",
"PRIVMSG %s :\001%s%s%s\001",
target,
type,
(args) ? " " : "",
+2 -2
View File
@@ -315,8 +315,8 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags,
/* display only if capability "echo-message" is NOT enabled */
if (!weechat_hashtable_has_key (ptr_server->cap_list, "echo-message"))
{
action = ((strncmp (message, "\01ACTION ", 8) == 0)
|| (strncmp (message, "\01ACTION\01", 8) == 0));
action = ((strncmp (message, "\001ACTION ", 8) == 0)
|| (strncmp (message, "\001ACTION\001", 8) == 0));
list_size = weechat_arraylist_size (list_messages);
for (i = 0; i < list_size; i++)
{
+10 -10
View File
@@ -991,14 +991,14 @@ irc_message_split_add (struct t_irc_message_split_context *context,
* arguments: "Hello world!"
* suffix : ""
*
* message..: :nick!user@host.com PRIVMSG #channel :\01ACTION is eating\01
* message..: :nick!user@host.com PRIVMSG #channel :\001ACTION is eating\001
* arguments:
* host : ":nick!user@host.com"
* command : "PRIVMSG"
* target : "#channel"
* prefix : ":\01ACTION "
* prefix : ":\001ACTION "
* arguments: "is eating"
* suffix : "\01"
* suffix : "\001"
*
* Messages added to hashtable are:
* host + command + target + prefix + XXX + suffix
@@ -1330,7 +1330,7 @@ irc_message_end_batch (struct t_irc_message_split_context *context,
}
/*
* Splits a PRIVMSG or NOTICE message, taking care of keeping the '\01' char
* Splits a PRIVMSG or NOTICE message, taking care of keeping the '\001' char
* used in CTCP messages.
*
* If multiline == 1, the message is split on newline chars ('\n') and is sent
@@ -1457,13 +1457,13 @@ irc_message_split_privmsg_notice (struct t_irc_message_split_context *context,
{
for (i = 0; i < count_lines; i++)
{
/* for CTCP, prefix is ":\01xxxx " and suffix "\01" */
/* for CTCP, prefix is ":\001xxxx " and suffix "\001" */
prefix[0] = '\0';
suffix[0] = '\0';
ptr_args = list_lines[i];
length = strlen (list_lines[i]);
if ((list_lines[i][0] == '\01')
&& (list_lines[i][length - 1] == '\01'))
if ((list_lines[i][0] == '\001')
&& (list_lines[i][length - 1] == '\001'))
{
pos = strchr (list_lines[i], ' ');
if (pos)
@@ -1482,7 +1482,7 @@ irc_message_split_privmsg_notice (struct t_irc_message_split_context *context,
snprintf (prefix, sizeof (prefix), ":%s", list_lines[i]);
ptr_args = "";
}
suffix[0] = '\01';
suffix[0] = '\001';
suffix[1] = '\0';
}
if (!prefix[0])
@@ -1673,8 +1673,8 @@ irc_message_split (struct t_irc_server *server, const char *message)
&& message
&& strchr (message, '\n')
&& (index_args + 1 <= argc - 1)
&& (weechat_strncmp (argv[index_args + 1], "\01", 1) != 0)
&& (weechat_strncmp (argv[index_args + 1], ":\01", 2) != 0)
&& (weechat_strncmp (argv[index_args + 1], "\001", 1) != 0)
&& (weechat_strncmp (argv[index_args + 1], ":\001", 2) != 0)
&& weechat_hashtable_has_key (server->cap_list, "batch")
&& weechat_hashtable_has_key (server->cap_list, "draft/multiline"));
+10 -10
View File
@@ -2511,7 +2511,7 @@ IRC_PROTOCOL_CALLBACK(notice)
pos_target++;
}
if (ctxt->nick && (pos_args[0] == '\01'))
if (ctxt->nick && (pos_args[0] == '\001'))
{
cap_echo_message = weechat_hashtable_has_key (ctxt->server->cap_list,
"echo-message");
@@ -3017,8 +3017,8 @@ IRC_PROTOCOL_CALLBACK(pong)
*
* Parameter "arguments" is the message arguments, for example:
*
* \01VERSION\01
* \01TEST some arguments\01
* \001VERSION\001
* \001TEST some arguments\001
*/
void
@@ -3059,11 +3059,11 @@ irc_protocol_privmsg_display_ctcp_send (struct t_irc_protocol_ctxt *ctxt,
* PRIVMSG #channel :message for channel here
* PRIVMSG @#channel :message for channel ops here
* PRIVMSG mynick :message for private here
* PRIVMSG #channel :\01ACTION is testing action\01
* PRIVMSG mynick :\01ACTION is testing action\01
* PRIVMSG #channel :\01VERSION\01
* PRIVMSG mynick :\01VERSION\01
* PRIVMSG mynick :\01DCC SEND file.txt 1488915698 50612 128\01
* PRIVMSG #channel :\001ACTION is testing action\001
* PRIVMSG mynick :\001ACTION is testing action\001
* PRIVMSG #channel :\001VERSION\001
* PRIVMSG mynick :\001VERSION\001
* PRIVMSG mynick :\001DCC SEND file.txt 1488915698 50612 128\001
*/
IRC_PROTOCOL_CALLBACK(privmsg)
@@ -3114,7 +3114,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
irc_channel_join_smart_filtered_unmask (ptr_channel, ctxt->nick);
/* CTCP to channel */
if (msg_args[0] == '\01')
if (msg_args[0] == '\001')
{
if (ctxt->nick_is_me)
{
@@ -3218,7 +3218,7 @@ IRC_PROTOCOL_CALLBACK(privmsg)
ptr_channel = irc_channel_search (ctxt->server, remote_nick);
/* CTCP to user */
if (msg_args[0] == '\01')
if (msg_args[0] == '\001')
{
msg_already_received = weechat_hashtable_has_key (
ctxt->server->echo_msg_recv, ctxt->irc_message);
+6 -6
View File
@@ -6365,7 +6365,7 @@ irc_server_xfer_send_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC SEND %s%s%s %s %d %s %s\01",
"PRIVMSG %s :\001DCC SEND %s%s%s %s %d %s %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6382,7 +6382,7 @@ irc_server_xfer_send_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC SEND %s%s%s %s %d %s\01",
"PRIVMSG %s :\001DCC SEND %s%s%s %s %d %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6396,7 +6396,7 @@ irc_server_xfer_send_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC CHAT chat %s %d\01",
"PRIVMSG %s :\001DCC CHAT chat %s %d\001",
weechat_infolist_string (infolist, "remote_nick"),
converted_addr,
weechat_infolist_integer (infolist, "port"));
@@ -6453,7 +6453,7 @@ irc_server_xfer_resume_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC RESUME %s%s%s %d %s %s\01",
"PRIVMSG %s :\001DCC RESUME %s%s%s %d %s %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6467,7 +6467,7 @@ irc_server_xfer_resume_ready_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC RESUME %s%s%s %d %s\01",
"PRIVMSG %s :\001DCC RESUME %s%s%s %d %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
@@ -6524,7 +6524,7 @@ irc_server_xfer_send_accept_resume_cb (const void *pointer, void *data,
irc_server_sendf (
ptr_server,
IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL,
"PRIVMSG %s :\01DCC ACCEPT %s%s%s %d %s\01",
"PRIVMSG %s :\001DCC ACCEPT %s%s%s %d %s\001",
weechat_infolist_string (infolist, "remote_nick"),
(spaces_in_name) ? "\"" : "",
filename,
+3 -3
View File
@@ -378,11 +378,11 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
mask2[0] = '\0';
/*
* we first replace directory separator (commonly '/') by \01 because
* we first replace directory separator (commonly '/') by \001 because
* buffer mask can contain this char, and will be replaced by replacement
* char ('_' by default)
*/
mask3 = weechat_string_replace (mask2, dir_separator, "\01");
mask3 = weechat_string_replace (mask2, dir_separator, "\001");
if (!mask3)
goto end;
@@ -407,7 +407,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
/* restore directory separator */
mask7 = weechat_string_replace (mask6,
"\01", dir_separator);
"\001", dir_separator);
if (!mask7)
goto end;
+10 -10
View File
@@ -1039,9 +1039,9 @@ relay_irc_send_channel_backlog (struct t_relay_client *client,
(ptr_host) ? "!" : "",
(ptr_host) ? ptr_host : "",
channel,
(irc_action) ? "\01ACTION " : "",
(irc_action) ? "\001ACTION " : "",
message,
(irc_action) ? "\01": "");
(irc_action) ? "\001": "");
}
break;
case RELAY_IRC_NUM_CMD:
@@ -1568,12 +1568,12 @@ relay_irc_recv_command_capab (struct t_relay_client *client,
*
* Examples:
*
* message | type | params
* --------------------------|-----------|-----------
* "\01ACTION is testing\01" | "ACTION" | "is testing"
* "\01VERSION\01" | "VERSION" | NULL
* "\01VERSION" | NULL | NULL
* "test" | NULL | NULL
* message | type | params
* ----------------------------|-----------|-------------
* "\001ACTION is testing\001" | "ACTION" | "is testing"
* "\001VERSION\001" | "VERSION" | NULL
* "\001VERSION" | NULL | NULL
* "test" | NULL | NULL
*/
void
@@ -1590,10 +1590,10 @@ relay_irc_parse_ctcp (const char *message, char **ctcp_type, char **ctcp_params)
if (!message)
return;
if (message[0] != '\01')
if (message[0] != '\001')
return;
pos_end = strrchr (message + 1, '\01');
pos_end = strrchr (message + 1, '\001');
if (!pos_end)
return;
+2 -2
View File
@@ -166,8 +166,8 @@ xfer_chat_recv_cb (const void *pointer, void *data, int fd)
length--;
}
if ((ptr_buf[0] == '\01')
&& (ptr_buf[length - 1] == '\01'))
if ((ptr_buf[0] == '\001')
&& (ptr_buf[length - 1] == '\001'))
{
ptr_buf[length - 1] = '\0';
ptr_buf++;
+1 -1
View File
@@ -60,7 +60,7 @@ xfer_command_me (const void *pointer, void *data,
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\r\n",
xfer_chat_sendf (ptr_xfer, "\001ACTION %s\001\r\n",
(argv_eol[1]) ? argv_eol[1] : "");
weechat_printf_date_tags (buffer,
0,
+12 -12
View File
@@ -1574,46 +1574,46 @@ TEST(IrcMessage, Split)
(const char *)hashtable_get (hashtable, "args2"));
hashtable_free (hashtable);
/* PRIVMSG with "\01ACTION\01": no split */
hashtable = irc_message_split (server, "PRIVMSG #channel :\01ACTION\01");
/* PRIVMSG with "\001ACTION\001": no split */
hashtable = irc_message_split (server, "PRIVMSG #channel :\001ACTION\001");
CHECK(hashtable);
LONGS_EQUAL(3, hashtable->items_count);
STRCMP_EQUAL("1",
(const char *)hashtable_get (hashtable, "count"));
STRCMP_EQUAL("PRIVMSG #channel :\01ACTION\01",
STRCMP_EQUAL("PRIVMSG #channel :\001ACTION\001",
(const char *)hashtable_get (hashtable, "msg1"));
STRCMP_EQUAL("",
(const char *)hashtable_get (hashtable, "args1"));
hashtable_free (hashtable);
/* PRIVMSG with "\01ACTION test\01": no split */
hashtable = irc_message_split (server, "PRIVMSG #channel :\01ACTION test\01");
/* PRIVMSG with "\001ACTION test\001": no split */
hashtable = irc_message_split (server, "PRIVMSG #channel :\001ACTION test\001");
CHECK(hashtable);
LONGS_EQUAL(3, hashtable->items_count);
STRCMP_EQUAL("1",
(const char *)hashtable_get (hashtable, "count"));
STRCMP_EQUAL("PRIVMSG #channel :\01ACTION test\01",
STRCMP_EQUAL("PRIVMSG #channel :\001ACTION test\001",
(const char *)hashtable_get (hashtable, "msg1"));
STRCMP_EQUAL("test",
(const char *)hashtable_get (hashtable, "args1"));
hashtable_free (hashtable);
/* PRIVMSG with "\01ACTION " + 512 bytes + "\01": 1 split */
/* PRIVMSG with "\001ACTION " + 512 bytes + "\001": 1 split */
hashtable = irc_message_split (server,
"PRIVMSG #channel :"
"\01ACTION " LOREM_IPSUM_512 "\01");
"\001ACTION " LOREM_IPSUM_512 "\001");
CHECK(hashtable);
LONGS_EQUAL(5, hashtable->items_count);
STRCMP_EQUAL("2",
(const char *)hashtable_get (hashtable, "count"));
STRCMP_EQUAL("PRIVMSG #channel :\01ACTION Lorem ipsum dolor sit"
STRCMP_EQUAL("PRIVMSG #channel :\001ACTION Lorem ipsum dolor sit"
" amet, consectetur adipiscing elit. Fusce auctor ac leo ut "
"maximus. Curabitur vestibulum facilisis neque, vitae sodale"
"s elit pulvinar ac. Mauris suscipit pharetra metus eu hendr"
"erit. Proin viverra ligula ut nibh malesuada, vel vehicula "
"leo pulvinar. Nullam tellus dolor, posuere sed orci in, pre"
"tium fermentum ante. Donec a quam vulputate, fermentum nisi"
" nec, convallis\01",
" nec, convallis\001",
(const char *)hashtable_get (hashtable, "msg1"));
STRCMP_EQUAL("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fu"
"sce auctor ac leo ut maximus. Curabitur vestibulum facilisi"
@@ -1623,9 +1623,9 @@ TEST(IrcMessage, Split)
"uere sed orci in, pretium fermentum ante. Donec a quam vulp"
"utate, fermentum nisi nec, convallis",
(const char *)hashtable_get (hashtable, "args1"));
STRCMP_EQUAL("PRIVMSG #channel :\01ACTION sapien. Vestibulum ma"
STRCMP_EQUAL("PRIVMSG #channel :\001ACTION sapien. Vestibulum ma"
"lesuada dui eget iaculis sagittis. Praesent egestas non ex "
"quis blandit. Maecenas quis leo nunc. In.\01",
"quis blandit. Maecenas quis leo nunc. In.\001",
(const char *)hashtable_get (hashtable, "msg2"));
STRCMP_EQUAL("sapien. Vestibulum malesuada dui eget iaculis sagittis. Pra"
"esent egestas non ex quis blandit. Maecenas quis leo nunc. "
+148 -148
View File
@@ -785,140 +785,140 @@ TEST(IrcProtocolWithServer, SendMessagesWithoutEchoMessage)
/* action on channel (with /me) */
server_input_data (buffer_chan, "/me action chan 1");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 1\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 1\001");
CHECK_CHAN(" *", "alice action chan 1",
"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_SENT("PRIVMSG #test :\001ACTION\001");
CHECK_CHAN(" *", "alice",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action on channel (with raw code: "\01ACTION") */
server_input_data (buffer_chan, "\01ACTION is testing\01");
CHECK_SENT("PRIVMSG #test :\01ACTION is testing\01");
/* action on channel (with raw code: "\001ACTION") */
server_input_data (buffer_chan, "\001ACTION is testing\001");
CHECK_SENT("PRIVMSG #test :\001ACTION is testing\001");
CHECK_CHAN(" *", "alice is testing",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action on channel (with raw code: "\01ACTION"), no message */
server_input_data (buffer_chan, "\01ACTION\01");
CHECK_SENT("PRIVMSG #test :\01ACTION\01");
/* action on channel (with raw code: "\001ACTION"), no message */
server_input_data (buffer_chan, "\001ACTION\001");
CHECK_SENT("PRIVMSG #test :\001ACTION\001");
CHECK_CHAN(" *", "alice",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action on channel (with /action *) */
server_input_data (buffer_chan, "/action * action chan 2");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 2\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 2\001");
CHECK_CHAN(" *", "alice action chan 2",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action on channel (with /action <channel>) */
server_input_data (buffer_server, "/action #test action chan 3");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 3\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 3\001");
CHECK_CHAN(" *", "alice action chan 3",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action on channel (with /action <channel>), no message */
server_input_data (buffer_chan, "/action #test");
CHECK_SENT("PRIVMSG #test :\01ACTION\01");
CHECK_SENT("PRIVMSG #test :\001ACTION\001");
CHECK_CHAN(" *", "alice",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* STATUSMSG action on channel (with /action @<channel>) */
server_input_data (buffer_server, "/action @#test action chan 4");
CHECK_SENT("PRIVMSG @#test :\01ACTION action chan 4\01");
CHECK_SENT("PRIVMSG @#test :\001ACTION action chan 4\001");
CHECK_CHAN("--", "Action -> @#test: alice action chan 4",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* STATUSMSG action on channel (with /action @<channel>), no message */
server_input_data (buffer_server, "/action @#test");
CHECK_SENT("PRIVMSG @#test :\01ACTION\01");
CHECK_SENT("PRIVMSG @#test :\001ACTION\001");
CHECK_CHAN("--", "Action -> @#test: 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 5");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 5\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 5\001");
CHECK_CHAN(" *", "alice action chan 5",
"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_SENT("PRIVMSG #test :\001ACTION\001");
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");
CHECK_SENT("PRIVMSG @#test :\001ACTION action chan ops\001");
CHECK_CHAN("--", "Action -> @#test: alice action chan ops",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action in private (with /me) */
server_input_data (buffer_pv, "/me action pv 1");
CHECK_SENT("PRIVMSG bob :\01ACTION action pv 1\01");
CHECK_SENT("PRIVMSG bob :\001ACTION action pv 1\001");
CHECK_PV("bob", " *", "alice action pv 1",
"irc_privmsg,irc_action,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* action in private (with /ctcp) */
server_input_data (buffer_server, "/ctcp bob action action pv 2");
CHECK_SENT("PRIVMSG bob :\01ACTION action pv 2\01");
CHECK_SENT("PRIVMSG bob :\001ACTION action pv 2\001");
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_SENT("PRIVMSG bob2 :\001ACTION action pv 3\001");
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");
CHECK_SENT("PRIVMSG #test :\001VERSION\001");
CHECK_CHAN("--", "CTCP query to #test: VERSION",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* unknown CTCP to channel */
server_input_data (buffer_server, "/ctcp #test unknown1 some args");
CHECK_SENT("PRIVMSG #test :\01UNKNOWN1 some args\01");
CHECK_SENT("PRIVMSG #test :\001UNKNOWN1 some args\001");
CHECK_CHAN("--", "CTCP query to #test: UNKNOWN1 some args",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* CTCP version to nick */
server_input_data (buffer_server, "/ctcp bob version");
CHECK_SENT("PRIVMSG bob :\01VERSION\01");
CHECK_SENT("PRIVMSG bob :\001VERSION\001");
CHECK_PV("bob", "--", "CTCP query to bob: VERSION",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* CTCP version to other nick (no private buffer) */
server_input_data (buffer_server, "/ctcp other_nick version");
CHECK_SENT("PRIVMSG other_nick :\01VERSION\01");
CHECK_SENT("PRIVMSG other_nick :\001VERSION\001");
CHECK_SRV("--", "CTCP query to other_nick: VERSION",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
/* unknown CTCP to nick */
server_input_data (buffer_server, "/ctcp bob unknown2 some args");
CHECK_SENT("PRIVMSG bob :\01UNKNOWN2 some args\01");
CHECK_SENT("PRIVMSG bob :\001UNKNOWN2 some args\001");
CHECK_PV("bob", "--", "CTCP query to bob: UNKNOWN2 some args",
"irc_privmsg,irc_ctcp,self_msg,notify_none,no_highlight,"
"nick_alice,log1");
@@ -1014,97 +1014,97 @@ TEST(IrcProtocolWithServer, SendMessagesWithEchoMessage)
/* action on channel (with /me) */
server_input_data (buffer_chan, "/me action chan 1");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 1\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 1\001");
CHECK_NO_MSG;
/* action on channel (with /me), no message */
server_input_data (buffer_chan, "/me");
CHECK_SENT("PRIVMSG #test :\01ACTION\01");
CHECK_SENT("PRIVMSG #test :\001ACTION\001");
CHECK_NO_MSG;
/* action on channel (with raw code: "\01ACTION") */
server_input_data (buffer_chan, "\01ACTION is testing\01");
CHECK_SENT("PRIVMSG #test :\01ACTION is testing\01");
/* action on channel (with raw code: "\001ACTION") */
server_input_data (buffer_chan, "\001ACTION is testing\001");
CHECK_SENT("PRIVMSG #test :\001ACTION is testing\001");
CHECK_NO_MSG;
/* action on channel (with raw code: "\01ACTION"), no message */
server_input_data (buffer_chan, "\01ACTION\01");
CHECK_SENT("PRIVMSG #test :\01ACTION\01");
/* action on channel (with raw code: "\001ACTION"), no message */
server_input_data (buffer_chan, "\001ACTION\001");
CHECK_SENT("PRIVMSG #test :\001ACTION\001");
CHECK_NO_MSG;
/* action on channel (with /action *) */
server_input_data (buffer_chan, "/action * action chan 2");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 2\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 2\001");
CHECK_NO_MSG;
/* action on channel (with /action <channel>) */
server_input_data (buffer_server, "/action #test action chan 3");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 3\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 3\001");
CHECK_NO_MSG;
/* action on channel (with /action <channel>), no message */
server_input_data (buffer_chan, "/action #test");
CHECK_SENT("PRIVMSG #test :\01ACTION\01");
CHECK_SENT("PRIVMSG #test :\001ACTION\001");
CHECK_NO_MSG;
/* STATUSMSG action on channel (with /action @<channel>) */
server_input_data (buffer_server, "/action @#test action chan 4");
CHECK_SENT("PRIVMSG @#test :\01ACTION action chan 4\01");
CHECK_SENT("PRIVMSG @#test :\001ACTION action chan 4\001");
CHECK_NO_MSG;
/* STATUSMSG action on channel (with /action @<channel>), no message */
server_input_data (buffer_server, "/action @#test");
CHECK_SENT("PRIVMSG @#test :\01ACTION\01");
CHECK_SENT("PRIVMSG @#test :\001ACTION\001");
CHECK_NO_MSG;
/* action on channel (with /ctcp <channel> action) */
server_input_data (buffer_server, "/ctcp #test action action chan 5");
CHECK_SENT("PRIVMSG #test :\01ACTION action chan 5\01");
CHECK_SENT("PRIVMSG #test :\001ACTION action chan 5\001");
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_SENT("PRIVMSG @#test :\001ACTION action chan ops\001");
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");
CHECK_SENT("PRIVMSG bob :\001ACTION action pv 1\001");
CHECK_NO_MSG;
/* action in private (with /ctcp) */
server_input_data (buffer_server, "/ctcp bob action action pv 2");
CHECK_SENT("PRIVMSG bob :\01ACTION action pv 2\01");
CHECK_SENT("PRIVMSG bob :\001ACTION action pv 2\001");
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_SENT("PRIVMSG bob2 :\001ACTION action pv 3\001");
CHECK_NO_MSG;
/* CTCP version to channel */
server_input_data (buffer_server, "/ctcp #test version");
CHECK_SENT("PRIVMSG #test :\01VERSION\01");
CHECK_SENT("PRIVMSG #test :\001VERSION\001");
CHECK_NO_MSG;
/* unknown CTCP to channel */
server_input_data (buffer_server, "/ctcp #test unknown1 some args");
CHECK_SENT("PRIVMSG #test :\01UNKNOWN1 some args\01");
CHECK_SENT("PRIVMSG #test :\001UNKNOWN1 some args\001");
CHECK_NO_MSG;
/* CTCP version to nick */
server_input_data (buffer_server, "/ctcp bob version");
CHECK_SENT("PRIVMSG bob :\01VERSION\01");
CHECK_SENT("PRIVMSG bob :\001VERSION\001");
CHECK_NO_MSG;
/* CTCP version to other nick (no private buffer) */
server_input_data (buffer_server, "/ctcp other_nick version");
CHECK_SENT("PRIVMSG other_nick :\01VERSION\01");
CHECK_SENT("PRIVMSG other_nick :\001VERSION\001");
CHECK_NO_MSG;
/* unknown CTCP to nick */
server_input_data (buffer_server, "/ctcp bob unknown2 some args");
CHECK_SENT("PRIVMSG bob :\01UNKNOWN2 some args\01");
CHECK_SENT("PRIVMSG bob :\001UNKNOWN2 some args\001");
CHECK_NO_MSG;
hashtable_remove (ptr_server->cap_list, "echo-message");
@@ -1526,12 +1526,12 @@ TEST(IrcProtocolWithServer, batch_without_batch_cap)
/* multiline with CTCP */
RECV(":server BATCH +ref draft/multiline #test");
CHECK_NO_MSG;
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :\01ACTION is testing");
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :\001ACTION is testing");
CHECK_CHAN(" *", "bob is testing",
"irc_privmsg,irc_tag_batch=ref,irc_action,notify_message,"
"nick_bob,host_user_b@host_b,log1");
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :again\01");
CHECK_CHAN("bob", "again\01",
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :again\001");
CHECK_CHAN("bob", "again\001",
"irc_privmsg,irc_tag_batch=ref,notify_message,"
"prefix_nick_248,nick_bob,host_user_b@host_b,log1");
RECV(":server BATCH -ref");
@@ -1727,20 +1727,20 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap)
/* multiline with CTCP */
RECV(":server BATCH +ref draft/multiline #test");
CHECK_NO_MSG;
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :\01ACTION is testing");
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :\001ACTION is testing");
CHECK_NO_MSG;
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :again\01");
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :again\001");
CHECK_NO_MSG;
RECV(":server BATCH -ref");
CHECK_CHAN(" *", "bob is testing",
"irc_privmsg,irc_tag_batch=ref,irc_batch_type_draft/multiline,"
"irc_action,notify_message,nick_bob,host_user_b@host_b,log1");
CHECK_CHAN("bob", "again\01",
CHECK_CHAN("bob", "again\001",
"irc_privmsg,irc_tag_batch=ref,irc_batch_type_draft/multiline,"
"notify_message,prefix_nick_248,nick_bob,"
"host_user_b@host_b,log1");
RECV(":bob!user_b@host_b PRIVMSG #test :prout\01");
CHECK_CHAN("bob", "prout\01",
RECV(":bob!user_b@host_b PRIVMSG #test :prout\001");
CHECK_CHAN("bob", "prout\001",
"irc_privmsg,notify_message,prefix_nick_248,nick_bob,"
"host_user_b@host_b,log1");
@@ -1767,9 +1767,9 @@ TEST(IrcProtocolWithServer, batch_with_batch_cap)
/* multiline with CTCP */
RECV(":server BATCH +ref draft/multiline #test");
CHECK_NO_MSG;
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :\01ACTION is testing");
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :\001ACTION is testing");
CHECK_NO_MSG;
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :again\01");
RECV("@batch=ref :bob!user_b@host_b PRIVMSG #test :again\001");
CHECK_NO_MSG;
RECV(":server BATCH -ref");
CHECK_CHAN(" *", "bob is testing\n"
@@ -2619,94 +2619,94 @@ TEST(IrcProtocolWithServer, notice)
"irc_notice,notify_private,nick_alice,host_user@host,log1");
/* broken CTCP to channel */
RECV(":bob!user@host NOTICE #test :\01");
RECV(":bob!user@host NOTICE #test :\001");
CHECK_SRV("--", "CTCP reply from bob: ",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01TEST");
RECV(":bob!user@host NOTICE #test :\001TEST");
CHECK_SRV("--", "CTCP reply from bob: TEST",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01ACTION");
RECV(":bob!user@host NOTICE #test :\001ACTION");
CHECK_SRV("--", "CTCP reply from bob: ACTION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01ACTION is testing");
RECV(":bob!user@host NOTICE #test :\001ACTION is testing");
CHECK_SRV("--", "CTCP reply from bob: ACTION is testing",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01VERSION");
RECV(":bob!user@host NOTICE #test :\001VERSION");
CHECK_SRV("--", "CTCP reply from bob: VERSION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01DCC");
RECV(":bob!user@host NOTICE #test :\001DCC");
CHECK_SRV("--", "CTCP reply from bob: DCC",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01DCC SEND");
RECV(":bob!user@host NOTICE #test :\001DCC SEND");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01DCC SEND file.txt");
RECV(":bob!user@host NOTICE #test :\001DCC SEND file.txt");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND file.txt",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01DCC SEND file.txt 1 2 3");
RECV(":bob!user@host NOTICE #test :\001DCC SEND file.txt 1 2 3");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND file.txt 1 2 3",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
/* broken CTCP to user */
RECV(":bob!user@host NOTICE alice :\01");
RECV(":bob!user@host NOTICE alice :\001");
CHECK_SRV("--", "CTCP reply from bob: ",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01TEST");
RECV(":bob!user@host NOTICE alice :\001TEST");
CHECK_SRV("--", "CTCP reply from bob: TEST",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01ACTION");
RECV(":bob!user@host NOTICE alice :\001ACTION");
CHECK_SRV("--", "CTCP reply from bob: ACTION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01ACTION is testing");
RECV(":bob!user@host NOTICE alice :\001ACTION is testing");
CHECK_SRV("--", "CTCP reply from bob: ACTION is testing",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01VERSION");
RECV(":bob!user@host NOTICE alice :\001VERSION");
CHECK_SRV("--", "CTCP reply from bob: VERSION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01DCC");
RECV(":bob!user@host NOTICE alice :\001DCC");
CHECK_SRV("--", "CTCP reply from bob: DCC",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01DCC SEND");
RECV(":bob!user@host NOTICE alice :\001DCC SEND");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01DCC SEND file.txt");
RECV(":bob!user@host NOTICE alice :\001DCC SEND file.txt");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND file.txt",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01DCC SEND file.txt 1 2 3");
RECV(":bob!user@host NOTICE alice :\001DCC SEND file.txt 1 2 3");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND file.txt 1 2 3",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
/* valid CTCP to channel */
RECV(":bob!user@host NOTICE #test :\01TEST\01");
RECV(":bob!user@host NOTICE #test :\001TEST\001");
CHECK_SRV("--", "CTCP reply from bob: TEST",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01ACTION\01");
RECV(":bob!user@host NOTICE #test :\001ACTION\001");
CHECK_SRV("--", "CTCP reply from bob: ACTION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01ACTION is testing\01");
RECV(":bob!user@host NOTICE #test :\001ACTION is testing\001");
CHECK_SRV("--", "CTCP reply from bob: ACTION is testing",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01VERSION\01");
RECV(":bob!user@host NOTICE #test :\001VERSION\001");
CHECK_SRV("--", "CTCP reply from bob: VERSION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE #test :\01DCC SEND file.txt 1 2 3\01");
RECV(":bob!user@host NOTICE #test :\001DCC SEND file.txt 1 2 3\001");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND file.txt 1 2 3",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
/* valid CTCP to user */
RECV(":bob!user@host NOTICE alice :\01TEST\01");
RECV(":bob!user@host NOTICE alice :\001TEST\001");
CHECK_SRV("--", "CTCP reply from bob: TEST",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01ACTION\01");
RECV(":bob!user@host NOTICE alice :\001ACTION\001");
CHECK_SRV("--", "CTCP reply from bob: ACTION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01ACTION is testing\01");
RECV(":bob!user@host NOTICE alice :\001ACTION is testing\001");
CHECK_SRV("--", "CTCP reply from bob: ACTION is testing",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01VERSION\01");
RECV(":bob!user@host NOTICE alice :\001VERSION\001");
CHECK_SRV("--", "CTCP reply from bob: VERSION",
"irc_notice,nick_bob,host_user@host,log1");
RECV(":bob!user@host NOTICE alice :\01DCC SEND file.txt 1 2 3\01");
RECV(":bob!user@host NOTICE alice :\001DCC SEND file.txt 1 2 3\001");
CHECK_SRV("--", "CTCP reply from bob: DCC SEND file.txt 1 2 3",
"irc_notice,irc_ctcp,nick_bob,host_user@host,log1");
@@ -3005,29 +3005,29 @@ TEST(IrcProtocolWithServer, privmsg)
}
/* broken CTCP to channel */
RECV(":bob!user@host PRIVMSG #test :\01");
RECV(":bob!user@host PRIVMSG #test :\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Unknown CTCP requested by bob: ",
"irc_privmsg,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host PRIVMSG #test :\01TEST");
RECV(":bob!user@host PRIVMSG #test :\001TEST");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Unknown CTCP requested by bob: TEST",
"irc_privmsg,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host PRIVMSG #test :\01ACTION");
RECV(":bob!user@host PRIVMSG #test :\001ACTION");
CHECK_SENT(NULL);
CHECK_CHAN(" *", "bob",
"irc_privmsg,irc_action,notify_message,nick_bob,"
"host_user@host,log1");
RECV(":bob!user@host PRIVMSG #test :\01ACTION is testing");
RECV(":bob!user@host PRIVMSG #test :\001ACTION is testing");
CHECK_SENT(NULL);
CHECK_CHAN(" *", "bob is testing",
"irc_privmsg,irc_action,notify_message,nick_bob,"
"host_user@host,log1");
info = irc_ctcp_eval_reply (ptr_server,
irc_ctcp_get_reply (ptr_server, "VERSION"));
RECV(":bob!user@host PRIVMSG #test :\01VERSION");
RECV(":bob!user@host PRIVMSG #test :\001VERSION");
snprintf (message, sizeof (message),
"NOTICE bob :\01VERSION %s\01", info);
"NOTICE bob :\001VERSION %s\001", info);
CHECK_SENT(message);
CHECK_CHAN("--", "CTCP requested by bob: VERSION",
"irc_privmsg,irc_ctcp,nick_bob,host_user@host,log1");
@@ -3041,48 +3041,48 @@ TEST(IrcProtocolWithServer, privmsg)
"no_highlight,nick_alice,log1");
}
snprintf (message, sizeof (message),
"NOTICE bob :\01VERSION %s\01", info);
"NOTICE bob :\001VERSION %s\001", info);
CHECK_SENT(message);
free (info);
RECV(":bob!user@host PRIVMSG #test :\01DCC");
RECV(":bob!user@host PRIVMSG #test :\001DCC");
CHECK_SENT(NULL);
CHECK_NO_MSG;
RECV(":bob!user@host PRIVMSG #test :\01DCC SEND");
RECV(":bob!user@host PRIVMSG #test :\001DCC SEND");
CHECK_SENT(NULL);
CHECK_NO_MSG;
RECV(":bob!user@host PRIVMSG #test :\01DCC SEND file.txt");
RECV(":bob!user@host PRIVMSG #test :\001DCC SEND file.txt");
CHECK_SENT(NULL);
CHECK_SRV("=!=", "irc: cannot parse \"privmsg\" command", "");
RECV(":bob!user@host PRIVMSG #test :\01DCC SEND file.txt 1 2 3");
RECV(":bob!user@host PRIVMSG #test :\001DCC SEND file.txt 1 2 3");
CHECK_SENT(NULL);
CHECK_CORE("",
"xfer: incoming file from bob (0.0.0.1, irc." IRC_FAKE_SERVER
"), name: file.txt, 3 bytes (protocol: dcc)");
/* broken CTCP to user */
RECV(":bob!user@host PRIVMSG alice :\01");
RECV(":bob!user@host PRIVMSG alice :\001");
CHECK_SENT(NULL);
CHECK_SRV("--", "Unknown CTCP requested by bob: ",
"irc_privmsg,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host PRIVMSG alice :\01TEST");
RECV(":bob!user@host PRIVMSG alice :\001TEST");
CHECK_SENT(NULL);
CHECK_SRV("--", "Unknown CTCP requested by bob: TEST",
"irc_privmsg,irc_ctcp,nick_bob,host_user@host,log1");
RECV(":bob!user@host PRIVMSG alice :\01ACTION");
RECV(":bob!user@host PRIVMSG alice :\001ACTION");
CHECK_SENT(NULL);
CHECK_PV_CLOSE("bob", " *", "bob",
"irc_privmsg,irc_action,notify_private,nick_bob,"
"host_user@host,log1");
RECV(":bob!user@host PRIVMSG alice :\01ACTION is testing");
RECV(":bob!user@host PRIVMSG alice :\001ACTION is testing");
CHECK_SENT(NULL);
CHECK_PV_CLOSE("bob", " *", "bob is testing",
"irc_privmsg,irc_action,notify_private,nick_bob,"
"host_user@host,log1");
info = irc_ctcp_eval_reply (ptr_server,
irc_ctcp_get_reply (ptr_server, "VERSION"));
RECV(":bob!user@host PRIVMSG alice :\01VERSION");
RECV(":bob!user@host PRIVMSG alice :\001VERSION");
snprintf (message, sizeof (message),
"NOTICE bob :\01VERSION %s\01", info);
"NOTICE bob :\001VERSION %s\001", info);
CHECK_SENT(message);
snprintf (message, sizeof (message),
"CTCP reply to bob: VERSION %s", info);
@@ -3094,16 +3094,16 @@ TEST(IrcProtocolWithServer, privmsg)
"no_highlight,nick_alice,log1");
}
free (info);
RECV(":bob!user@host PRIVMSG alice :\01DCC");
RECV(":bob!user@host PRIVMSG alice :\001DCC");
CHECK_SENT(NULL);
CHECK_NO_MSG;
RECV(":bob!user@host PRIVMSG alice :\01DCC SEND");
RECV(":bob!user@host PRIVMSG alice :\001DCC SEND");
CHECK_SENT(NULL);
CHECK_NO_MSG;
RECV(":bob!user@host PRIVMSG alice :\01DCC SEND file.txt");
RECV(":bob!user@host PRIVMSG alice :\001DCC SEND file.txt");
CHECK_SENT(NULL);
CHECK_SRV("=!=", "irc: cannot parse \"privmsg\" command", "");
RECV(":bob!user@host PRIVMSG alice :\01DCC SEND file.txt 1 2 3");
RECV(":bob!user@host PRIVMSG alice :\001DCC SEND file.txt 1 2 3");
CHECK_SENT(NULL);
CHECK_CORE("",
"xfer: incoming file from bob (0.0.0.1, irc." IRC_FAKE_SERVER
@@ -3111,23 +3111,23 @@ TEST(IrcProtocolWithServer, privmsg)
/* valid CTCP to channel */
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG #test :\01TEST\01");
":bob!user@host PRIVMSG #test :\001TEST\001");
CHECK_SENT(NULL);
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG #test :\01ACTION\01");
":bob!user@host PRIVMSG #test :\001ACTION\001");
CHECK_SENT(NULL);
CHECK_CHAN(" *", "bob",
"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");
":bob!user@host PRIVMSG #test :\001ACTION is testing with \002bold\002\001");
CHECK_SENT(NULL);
CHECK_CHAN(" *", "bob is testing with bold",
"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 :\01PING 1703496549 905284\01");
CHECK_SENT("NOTICE bob :\01PING 1703496549 905284\01");
":bob!user@host PRIVMSG #test :\001PING 1703496549 905284\001");
CHECK_SENT("NOTICE bob :\001PING 1703496549 905284\001");
CHECK_CHAN("--", "CTCP requested by bob: PING 1703496549 905284",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_bob,host_user@host,log1");
@@ -3140,7 +3140,7 @@ TEST(IrcProtocolWithServer, privmsg)
"no_highlight,nick_alice,log1");
}
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG #test :\01UNKNOWN\01");
":bob!user@host PRIVMSG #test :\001UNKNOWN\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Unknown CTCP requested by bob: UNKNOWN",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
@@ -3148,20 +3148,20 @@ TEST(IrcProtocolWithServer, privmsg)
/* valid CTCP to ops of channel */
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG @#test :\01ACTION\01");
":bob!user@host PRIVMSG @#test :\001ACTION\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Action -> @#test: bob",
"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");
":bob!user@host PRIVMSG @#test :\001ACTION is testing\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Action -> @#test: bob is testing",
"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 :\01PING 1703496549 905284\01");
CHECK_SENT("NOTICE bob :\01PING 1703496549 905284\01");
":bob!user@host PRIVMSG @#test :\001PING 1703496549 905284\001");
CHECK_SENT("NOTICE bob :\001PING 1703496549 905284\001");
CHECK_CHAN("--", "CTCP requested by bob: PING 1703496549 905284",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_bob,host_user@host,log1");
@@ -3174,7 +3174,7 @@ TEST(IrcProtocolWithServer, privmsg)
"no_highlight,nick_alice,log1");
}
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG @#test :\01UNKNOWN\01");
":bob!user@host PRIVMSG @#test :\001UNKNOWN\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Unknown CTCP requested by bob: UNKNOWN",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
@@ -3185,35 +3185,35 @@ TEST(IrcProtocolWithServer, privmsg)
* (case of bouncer or if echo-message capability is enabled)
*/
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG #test :\01VERSION\01");
":alice!user@host PRIVMSG #test :\001VERSION\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "CTCP query to #test: VERSION",
"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");
":alice!user@host PRIVMSG #test :\001ACTION\001");
CHECK_SENT(NULL);
CHECK_CHAN(" *", "alice",
"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");
":alice!user@host PRIVMSG #test :\001ACTION is testing with \002bold\002\001");
CHECK_SENT(NULL);
CHECK_CHAN(" *", "alice is testing with bold",
"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 :\01PING 1703496549 905284\01");
":alice!user@host PRIVMSG #test :\001PING 1703496549 905284\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "CTCP query to #test: PING 1703496549 905284",
"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 :\01UNKNOWN\01");
":alice!user@host PRIVMSG #test :\001UNKNOWN\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "CTCP query to #test: UNKNOWN",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
@@ -3225,28 +3225,28 @@ TEST(IrcProtocolWithServer, privmsg)
* (case of bouncer or if echo-message capability is enabled)
*/
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG @#test :\01ACTION\01");
":alice!user@host PRIVMSG @#test :\001ACTION\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Action -> @#test: alice",
"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");
":alice!user@host PRIVMSG @#test :\001ACTION is testing\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "Action -> @#test: alice is testing",
"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 :\01PING 1703496549 905284\01");
":alice!user@host PRIVMSG @#test :\001PING 1703496549 905284\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "CTCP query to @#test: PING 1703496549 905284",
"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 :\01UNKNOWN\01");
":alice!user@host PRIVMSG @#test :\001UNKNOWN\001");
CHECK_SENT(NULL);
CHECK_CHAN("--", "CTCP query to @#test: UNKNOWN",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
@@ -3255,17 +3255,17 @@ TEST(IrcProtocolWithServer, privmsg)
/* valid CTCP to user */
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01TEST\01");
":bob!user@host PRIVMSG alice :\001TEST\001");
CHECK_SENT(NULL);
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01ACTION\01");
":bob!user@host PRIVMSG alice :\001ACTION\001");
CHECK_SENT(NULL);
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01ACTION is testing\01");
":bob!user@host PRIVMSG alice :\001ACTION is testing\001");
CHECK_SENT(NULL);
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01PING 1703496549 905284\01");
CHECK_SENT("NOTICE bob :\01PING 1703496549 905284\01");
":bob!user@host PRIVMSG alice :\001PING 1703496549 905284\001");
CHECK_SENT("NOTICE bob :\001PING 1703496549 905284\001");
CHECK_SRV("--", "CTCP requested by bob: PING 1703496549 905284",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_bob,host_user@host,log1");
@@ -3278,7 +3278,7 @@ TEST(IrcProtocolWithServer, privmsg)
"no_highlight,nick_alice,log1");
}
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01UNKNOWN\01");
":bob!user@host PRIVMSG alice :\001UNKNOWN\001");
CHECK_SENT(NULL);
CHECK_SRV("--", "Unknown CTCP requested by bob: UNKNOWN",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
@@ -3286,9 +3286,9 @@ TEST(IrcProtocolWithServer, privmsg)
info = irc_ctcp_eval_reply (ptr_server,
irc_ctcp_get_reply (ptr_server, "VERSION"));
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01VERSION\01");
":bob!user@host PRIVMSG alice :\001VERSION\001");
snprintf (message, sizeof (message),
"NOTICE bob :\01VERSION %s\01", info);
"NOTICE bob :\001VERSION %s\001", info);
CHECK_SENT(message);
CHECK_SRV("--", "CTCP requested by bob: VERSION",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
@@ -3304,18 +3304,18 @@ TEST(IrcProtocolWithServer, privmsg)
"nick_alice,log1");
}
snprintf (message, sizeof (message),
"NOTICE bob :\01VERSION %s\01", info);
"NOTICE bob :\001VERSION %s\001", info);
CHECK_SENT(message);
free (info);
info = hook_info_get (NULL, "weechat_site_download", "");
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01SOURCE\01");
":bob!user@host PRIVMSG alice :\001SOURCE\001");
snprintf (message, sizeof (message),
"NOTICE bob :\01SOURCE %s\01", info);
"NOTICE bob :\001SOURCE %s\001", info);
CHECK_SENT(message);
free (info);
RECV("@time=2023-12-25T10:29:09.456789Z "
":bob!user@host PRIVMSG alice :\01DCC SEND file.txt 1 2 3\01");
":bob!user@host PRIVMSG alice :\001DCC SEND file.txt 1 2 3\001");
CHECK_SENT(NULL);
CHECK_CORE("",
"xfer: incoming file from bob (0.0.0.1, irc." IRC_FAKE_SERVER
@@ -3327,11 +3327,11 @@ TEST(IrcProtocolWithServer, privmsg)
* (case of bouncer or if echo-message capability is enabled)
*/
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host PRIVMSG alice :\01CLIENTINFO\01");
":alice!user@host PRIVMSG alice :\001CLIENTINFO\001");
if (echo_message == 0)
{
CHECK_SENT("NOTICE alice :\01CLIENTINFO ACTION CLIENTINFO DCC "
"PING SOURCE TIME VERSION\01");
CHECK_SENT("NOTICE alice :\001CLIENTINFO ACTION CLIENTINFO DCC "
"PING SOURCE TIME VERSION\001");
CHECK_SRV("--", "CTCP requested by alice: CLIENTINFO",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_alice,host_user@host,log1");
@@ -3349,15 +3349,15 @@ TEST(IrcProtocolWithServer, privmsg)
"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 alice :\01CLIENTINFO\01");
CHECK_SENT("NOTICE alice :\01CLIENTINFO ACTION CLIENTINFO DCC "
"PING SOURCE TIME VERSION\01");
":alice!user@host PRIVMSG alice :\001CLIENTINFO\001");
CHECK_SENT("NOTICE alice :\001CLIENTINFO ACTION CLIENTINFO DCC "
"PING SOURCE TIME VERSION\001");
CHECK_SRV("--", "CTCP requested by alice: CLIENTINFO",
"irc_privmsg,irc_tag_time=2023-12-25T10:29:09.456789Z,"
"irc_ctcp,nick_alice,host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host NOTICE alice :\01CLIENTINFO DCC PING "
"SOURCE TIME VERSION\01");
":alice!user@host NOTICE alice :\001CLIENTINFO DCC PING "
"SOURCE TIME VERSION\001");
CHECK_SENT(NULL);
CHECK_SRV("--", "CTCP reply to alice: CLIENTINFO DCC PING "
"SOURCE TIME VERSION",
@@ -3365,8 +3365,8 @@ TEST(IrcProtocolWithServer, privmsg)
"irc_ctcp,irc_ctcp_reply,self_msg,notify_none,"
"no_highlight,nick_alice,host_user@host,log1");
RECV("@time=2023-12-25T10:29:09.456789Z "
":alice!user@host NOTICE alice :\01CLIENTINFO DCC PING "
"SOURCE TIME VERSION\01");
":alice!user@host NOTICE alice :\001CLIENTINFO DCC PING "
"SOURCE TIME VERSION\001");
CHECK_SENT(NULL);
CHECK_SRV("--", "CTCP reply from alice: CLIENTINFO DCC PING "
"SOURCE TIME VERSION",
@@ -825,7 +825,7 @@ TEST(RelayIrcWithClient, ParseCtcp)
ctcp_type = (char *)0x01;
ctcp_params = (char *)0x01;
relay_irc_parse_ctcp ("\01ACTION is testing\01", &ctcp_type, &ctcp_params);
relay_irc_parse_ctcp ("\001ACTION is testing\001", &ctcp_type, &ctcp_params);
STRCMP_EQUAL("ACTION", ctcp_type);
STRCMP_EQUAL("is testing", ctcp_params);
free (ctcp_type);
@@ -833,7 +833,7 @@ TEST(RelayIrcWithClient, ParseCtcp)
ctcp_type = (char *)0x01;
ctcp_params = (char *)0x01;
relay_irc_parse_ctcp ("\01ACTION is testing \01 extra", &ctcp_type, &ctcp_params);
relay_irc_parse_ctcp ("\001ACTION is testing \001 extra", &ctcp_type, &ctcp_params);
STRCMP_EQUAL("ACTION", ctcp_type);
STRCMP_EQUAL(" is testing ", ctcp_params);
free (ctcp_type);
@@ -841,20 +841,20 @@ TEST(RelayIrcWithClient, ParseCtcp)
ctcp_type = (char *)0x01;
ctcp_params = (char *)0x01;
relay_irc_parse_ctcp ("\01VERSION\01", &ctcp_type, &ctcp_params);
relay_irc_parse_ctcp ("\001VERSION\001", &ctcp_type, &ctcp_params);
STRCMP_EQUAL("VERSION", ctcp_type);
STRCMP_EQUAL(NULL, ctcp_params);
free (ctcp_type);
ctcp_type = (char *)0x01;
ctcp_params = (char *)0x01;
relay_irc_parse_ctcp ("\01ACTION is testing", &ctcp_type, &ctcp_params);
relay_irc_parse_ctcp ("\001ACTION is testing", &ctcp_type, &ctcp_params);
STRCMP_EQUAL(NULL, ctcp_type);
STRCMP_EQUAL(NULL, ctcp_params);
ctcp_type = (char *)0x01;
ctcp_params = (char *)0x01;
relay_irc_parse_ctcp ("\01VERSION", &ctcp_type, &ctcp_params);
relay_irc_parse_ctcp ("\001VERSION", &ctcp_type, &ctcp_params);
STRCMP_EQUAL(NULL, ctcp_type);
STRCMP_EQUAL(NULL, ctcp_params);