Add tests for opmod_send_statusmsg

This commit is contained in:
Ed Kellett 2020-07-05 19:08:33 +01:00
parent 04e5ed6c57
commit f42959a205
No known key found for this signature in database
GPG key ID: CB9986DEF342FABC

View file

@ -1182,7 +1182,7 @@ static void sendto_channel_opmod__local(void)
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_p, "Message source; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID " NOTICE @" TEST_CHANNEL " :<LChanPeon:#test> Hello World!" CRLF, server, MSG);
is_client_sendq(":" TEST_ME_ID " NOTICE @" TEST_CHANNEL " :<LChanPeon:" TEST_CHANNEL "> Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
// Moderated channel
@ -1211,6 +1211,73 @@ static void sendto_channel_opmod__local(void)
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID "90004 TEST =" TEST_CHANNEL " :Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
standard_free();
}
static void sendto_channel_opmod_statusmsg__local(void)
{
standard_init();
ConfigChannel.opmod_send_statusmsg = true;
// This function does not support TS5...
standard_ids();
// Without CAP_CHW | CAP_EOPMOD
standard_server_caps(0, CAP_CHW | CAP_EOPMOD);
sendto_channel_opmod(local_chan_p, local_chan_p, channel, "TEST", "Hello World!");
is_client_sendq_empty(user, "Not on channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_p, "Message source; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq_empty(server, "No users to receive message; " MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
// With CAP_CHW, without CAP_EOPMOD
standard_server_caps(CAP_CHW, CAP_EOPMOD);
sendto_channel_opmod(local_chan_p, local_chan_p, channel, "TEST", "Hello World!");
is_client_sendq_empty(user, "Not on channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_p, "Message source; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID " NOTICE @" TEST_CHANNEL " :<LChanPeon:" TEST_CHANNEL "> Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
// Moderated channel
channel->mode.mode |= MODE_MODERATED;
sendto_channel_opmod(local_chan_p, local_chan_p, channel, "TEST", "Hello World!");
is_client_sendq_empty(user, "Not on channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_p, "Message source; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID "90004 TEST @" TEST_CHANNEL " :Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
// With CAP_CHW | CAP_EOPMOD
channel->mode.mode &= ~MODE_MODERATED;
standard_server_caps(CAP_CHW | CAP_EOPMOD, 0);
sendto_channel_opmod(local_chan_p, local_chan_p, channel, "TEST", "Hello World!");
is_client_sendq_empty(user, "Not on channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":LChanPeon" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_p, "Message source; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID "90004 TEST =" TEST_CHANNEL " :Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
ConfigChannel.opmod_send_statusmsg = false;
standard_free();
}
static void sendto_channel_opmod__local__tags(void)
@ -1248,7 +1315,7 @@ static void sendto_channel_opmod__local__tags(void)
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_p, "Message source; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID " NOTICE @" TEST_CHANNEL " :<LChanPeon:#test> Hello World!" CRLF, server, MSG);
is_client_sendq(":" TEST_ME_ID " NOTICE @" TEST_CHANNEL " :<LChanPeon:" TEST_CHANNEL "> Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
// Moderated channel
@ -1282,6 +1349,8 @@ static void sendto_channel_opmod__local__tags(void)
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_ME_ID "90004 TEST =" TEST_CHANNEL " :Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
standard_free();
}
static void sendto_channel_opmod__remote(void)
@ -1310,7 +1379,7 @@ static void sendto_channel_opmod__remote(void)
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST " TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_SERVER2_ID " NOTICE @" TEST_CHANNEL " :<R2ChanDeaf:#test> Hello World!" CRLF, server, MSG);
is_client_sendq(":" TEST_SERVER2_ID " NOTICE @" TEST_CHANNEL " :<R2ChanDeaf:" TEST_CHANNEL "> Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "Message source; " MSG);
// Moderated channel
@ -1339,6 +1408,63 @@ static void sendto_channel_opmod__remote(void)
standard_free();
}
static void sendto_channel_opmod_statusmsg__remote(void)
{
standard_init();
ConfigChannel.opmod_send_statusmsg = true;
// This function does not support TS5...
standard_ids();
// Without CAP_CHW | CAP_EOPMOD
standard_server_caps(0, CAP_CHW | CAP_EOPMOD);
sendto_channel_opmod(server2, remote2_chan_d, channel, "TEST", "Hello World!");
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq_empty(server, "Message source; " MSG);
is_client_sendq_empty(server2, "No users to receive message; " MSG);
// With CAP_CHW, without CAP_EOPMOD
standard_server_caps(CAP_CHW, CAP_EOPMOD);
sendto_channel_opmod(server2, remote2_chan_d, channel, "TEST", "Hello World!");
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_SERVER2_ID " NOTICE @" TEST_CHANNEL " :<R2ChanDeaf:" TEST_CHANNEL "> Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "Message source; " MSG);
// Moderated channel
channel->mode.mode |= MODE_MODERATED;
sendto_channel_opmod(server2, remote2_chan_d, channel, "TEST", "Hello World!");
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_SERVER2_ID "90205 TEST @" TEST_CHANNEL " :Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "Message source; " MSG);
// With CAP_CHW | CAP_EOPMOD
channel->mode.mode &= ~MODE_MODERATED;
standard_server_caps(CAP_CHW | CAP_EOPMOD, 0);
sendto_channel_opmod(server2, remote2_chan_d, channel, "TEST", "Hello World!");
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_o, "On channel; " MSG);
is_client_sendq(":R2ChanDeaf" TEST_ID_SUFFIX " TEST @" TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_SERVER2_ID "90205 TEST =" TEST_CHANNEL " :Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "Message source; " MSG);
ConfigChannel.opmod_send_statusmsg = false;
standard_free();
}
static void sendto_channel_opmod__remote__tags(void)
{
standard_init();
@ -1370,7 +1496,7 @@ static void sendto_channel_opmod__remote__tags(void)
is_client_sendq("@time=" ADVENTURE_TIME " :R2ChanDeaf" TEST_ID_SUFFIX " TEST " TEST_CHANNEL " :Hello World!" CRLF, local_chan_ov, "On channel; " MSG);
is_client_sendq_empty(local_chan_v, "Not +o; " MSG);
is_client_sendq_empty(local_chan_d, "Deaf; " MSG);
is_client_sendq(":" TEST_SERVER2_ID " NOTICE @" TEST_CHANNEL " :<R2ChanDeaf:#test> Hello World!" CRLF, server, MSG);
is_client_sendq(":" TEST_SERVER2_ID " NOTICE @" TEST_CHANNEL " :<R2ChanDeaf:" TEST_CHANNEL "> Hello World!" CRLF, server, MSG);
is_client_sendq_empty(server2, "Message source; " MSG);
// Moderated channel
@ -4939,8 +5065,10 @@ int main(int argc, char *argv[])
sendto_channel_flags__remote__chanop_voice();
sendto_channel_opmod__local();
sendto_channel_opmod_statusmsg__local();
sendto_channel_opmod__local__tags();
sendto_channel_opmod__remote();
sendto_channel_opmod_statusmsg__remote();
sendto_channel_opmod__remote__tags();
sendto_channel_local1();
sendto_channel_local1__tags();