summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-04-25 11:31:42 +0100
committerSadie Powell <sadie@witchery.services>2020-05-05 01:49:35 +0100
commit7488b2de62811d7f831e84fb0aeac2345a7f9ee9 (patch)
treeed31fd531583e73a75d79d290e07c80ab4e5fef0
parent054148247e682c8fbebc21080c5bf2b770a9c671 (diff)
Allow enabling the message-tags cap without client-only tags.
-rw-r--r--docs/conf/modules.conf.example5
-rw-r--r--src/modules/m_ircv3_ctctags.cpp8
2 files changed, 12 insertions, 1 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index 85180d78d..09d997b32 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -1180,6 +1180,11 @@
# extension which allows clients to add extra data to their messages.
# This is used to support new IRCv3 features such as replies and ids.
#<module name="ircv3_ctctags">
+#
+# If you want to only allow client tags that are intended for processing
+# by the server you can disable the following setting. Doing this is not
+# recommended though as it may break clients.
+#<ctctags allowclientonlytags="yes">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# IRCv3 echo-message module: Provides the echo-message IRCv3
diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp
index 16b71e83e..bf39bb381 100644
--- a/src/modules/m_ircv3_ctctags.cpp
+++ b/src/modules/m_ircv3_ctctags.cpp
@@ -261,6 +261,7 @@ class C2CTags : public ClientProtocol::MessageTagProvider
Cap::Capability& cap;
public:
+ bool allowclientonlytags;
C2CTags(Module* Creator, Cap::Capability& Cap)
: ClientProtocol::MessageTagProvider(Creator)
, cap(Cap)
@@ -271,7 +272,7 @@ class C2CTags : public ClientProtocol::MessageTagProvider
{
// A client-only tag is prefixed with a plus sign (+) and otherwise conforms
// to the format specified in IRCv3.2 tags.
- if (tagname[0] != '+' || tagname.length() < 2)
+ if (tagname[0] != '+' || tagname.length() < 2 || !allowclientonlytags)
return MOD_RES_PASSTHRU;
// If the user is local then we check whether they have the message-tags cap
@@ -323,6 +324,11 @@ class ModuleIRCv3CTCTags
{
}
+ void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
+ {
+ c2ctags.allowclientonlytags = ServerInstance->Config->ConfValue("ctctags")->getBool("allowclientonlytags", true);
+ }
+
ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE
{
return CopyClientTags(details.tags_in, details.tags_out);