summaryrefslogtreecommitdiff
path: root/tests/unit/plugins
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2021-08-08 18:37:15 +0200
committerSébastien Helleu <flashcode@flashtux.org>2021-08-08 18:37:15 +0200
commit8e676edd1a5a1ab91279d55a2181757ad36b5ced (patch)
treee8c3778b3027636bcd90285d5cd520f8653f2b01 /tests/unit/plugins
parent415ea95eb42d061d350fe5b3b3cb9b00f05c6915 (diff)
downloadweechat-8e676edd1a5a1ab91279d55a2181757ad36b5ced.zip
irc: save CLIENTTAGDENY from message 005 in server, do not send typing messages if "typing" client tag is denied
Diffstat (limited to 'tests/unit/plugins')
-rw-r--r--tests/unit/plugins/irc/test-irc-server.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/unit/plugins/irc/test-irc-server.cpp b/tests/unit/plugins/irc/test-irc-server.cpp
index 7748858ec..d891d3ea0 100644
--- a/tests/unit/plugins/irc/test-irc-server.cpp
+++ b/tests/unit/plugins/irc/test-irc-server.cpp
@@ -251,6 +251,74 @@ TEST(IrcServer, SetPrefixModesChars)
/*
* Tests functions:
+ * irc_server_set_clienttagdeny
+ */
+
+TEST(IrcServer, SetClienttagdeny)
+{
+ struct t_irc_server *server;
+
+ server = irc_server_alloc ("test_clienttagdeny");
+ CHECK(server);
+
+ POINTERS_EQUAL(NULL, server->clienttagdeny);
+ LONGS_EQUAL(0, server->clienttagdeny_count);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array);
+ LONGS_EQUAL(1, server->typing_allowed);
+
+ irc_server_set_clienttagdeny (server, "*");
+ irc_server_set_clienttagdeny (server, NULL);
+ POINTERS_EQUAL(NULL, server->clienttagdeny);
+ LONGS_EQUAL(0, server->clienttagdeny_count);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array);
+ LONGS_EQUAL(1, server->typing_allowed);
+
+ irc_server_set_clienttagdeny (server, "*");
+ irc_server_set_clienttagdeny (server, "");
+ POINTERS_EQUAL(NULL, server->clienttagdeny);
+ LONGS_EQUAL(0, server->clienttagdeny_count);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array);
+ LONGS_EQUAL(1, server->typing_allowed);
+
+ irc_server_set_clienttagdeny (server, "*");
+ STRCMP_EQUAL("*", server->clienttagdeny);
+ LONGS_EQUAL(1, server->clienttagdeny_count);
+ STRCMP_EQUAL("*", server->clienttagdeny_array[0]);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array[1]);
+ LONGS_EQUAL(0, server->typing_allowed);
+
+ irc_server_set_clienttagdeny (server, "*,-foo");
+ STRCMP_EQUAL("*,-foo", server->clienttagdeny);
+ LONGS_EQUAL(2, server->clienttagdeny_count);
+ STRCMP_EQUAL("*", server->clienttagdeny_array[0]);
+ STRCMP_EQUAL("!foo", server->clienttagdeny_array[1]);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array[2]);
+ LONGS_EQUAL(0, server->typing_allowed);
+
+ irc_server_set_clienttagdeny (server, "*,-foo,-example/bar");
+ STRCMP_EQUAL("*,-foo,-example/bar", server->clienttagdeny);
+ LONGS_EQUAL(3, server->clienttagdeny_count);
+ STRCMP_EQUAL("*", server->clienttagdeny_array[0]);
+ STRCMP_EQUAL("!foo", server->clienttagdeny_array[1]);
+ STRCMP_EQUAL("!example/bar", server->clienttagdeny_array[2]);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array[3]);
+ LONGS_EQUAL(0, server->typing_allowed);
+
+ irc_server_set_clienttagdeny (server, "*,-foo,-example/bar,-typing");
+ STRCMP_EQUAL("*,-foo,-example/bar,-typing", server->clienttagdeny);
+ LONGS_EQUAL(4, server->clienttagdeny_count);
+ STRCMP_EQUAL("*", server->clienttagdeny_array[0]);
+ STRCMP_EQUAL("!foo", server->clienttagdeny_array[1]);
+ STRCMP_EQUAL("!example/bar", server->clienttagdeny_array[2]);
+ STRCMP_EQUAL("!typing", server->clienttagdeny_array[3]);
+ POINTERS_EQUAL(NULL, server->clienttagdeny_array[4]);
+ LONGS_EQUAL(1, server->typing_allowed);
+
+ irc_server_free (server);
+}
+
+/*
+ * Tests functions:
* irc_server_set_lag
*/