diff options
| author | 2026-03-19 00:45:01 +0000 | |
|---|---|---|
| committer | 2026-03-19 00:45:01 +0000 | |
| commit | 94aa15801ff978a92de2c7dbcacfdbe1c1d31297 (patch) | |
| tree | a5439b120a68da060a829901d320038b86539046 /src/modules | |
| parent | Implement the IRCv3 no-implicit-names specification. (diff) | |
| download | inspircd++-94aa15801ff978a92de2c7dbcacfdbe1c1d31297.tar.gz inspircd++-94aa15801ff978a92de2c7dbcacfdbe1c1d31297.tar.bz2 inspircd++-94aa15801ff978a92de2c7dbcacfdbe1c1d31297.zip | |
Improve config compatibility with previous releases.
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_ircv3_ctctags.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 2354f673d..cffd5a08c 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -327,7 +327,7 @@ private: } public: - AllowTags allowclientonlytags; + AllowTags clientonlytags; insp::flat_map<std::string, std::function<bool(LocalUser*, const std::string&)>, irc::insensitive_swo> knowntags = { { "+draft/channel-context", ValidateChannel }, // https://ircv3.net/specs/client-tags/channel-context { "+draft/react", ValidateReaction }, // https://ircv3.net/specs/client-tags/react @@ -348,7 +348,7 @@ public: { // 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 || allowclientonlytags == AllowTags::NONE) + if (tagname[0] != '+' || tagname.length() < 2 || clientonlytags == AllowTags::NONE) return MOD_RES_PASSTHRU; // If the user is local then we check whether they have the message-tags cap @@ -359,7 +359,7 @@ public: if (!cap.IsEnabled(lu)) return MOD_RES_DENY; // Cap not enabled. - if (allowclientonlytags == AllowTags::KNOWN) + if (clientonlytags == AllowTags::KNOWN) { auto it = knowntags.find(tagname); if (it == knowntags.end() || !it->second(lu, tagvalue)) @@ -416,24 +416,18 @@ public: void ReadConfig(ConfigStatus& status) override { const auto& tag = ServerInstance->Config->ConfValue("ctctags"); - c2ctags.allowclientonlytags = tag->getEnum("allowclientonlytags", AllowTags::ALL, { + + const auto allowclientonlytags = tag->getBool("allowclientonlytags", true); + c2ctags.clientonlytags = tag->getEnum("clientonlytags", allowclientonlytags ? AllowTags::ALL : AllowTags::NONE, { {"all", AllowTags::ALL }, {"known", AllowTags::KNOWN }, {"none", AllowTags::NONE }, - - // Compatibility with v4.9 and older. - {"false", AllowTags::NONE }, - {"no", AllowTags::NONE }, - {"off", AllowTags::NONE }, - {"on", AllowTags::ALL }, - {"true", AllowTags::ALL }, - {"yes", AllowTags::ALL }, }); } void OnBuildISupport(ISupport::TokenMap& tokens) override { - switch (c2ctags.allowclientonlytags) + switch (c2ctags.clientonlytags) { case AllowTags::NONE: tokens["CLIENTTAGDENY"] = "*"; |
