diff options
| author | 2023-01-13 20:43:13 +0000 | |
|---|---|---|
| committer | 2023-01-13 20:50:00 +0000 | |
| commit | 1f4ffdfee959614e3afe7e7daab06a040ca1ac41 (patch) | |
| tree | f49b94d8d59e9d08867501c23b21828a3bb9976b /src/modules/m_cloak.cpp | |
| parent | Document the cloak_sha256 <cloak:case> option. (diff) | |
| download | inspircd++-1f4ffdfee959614e3afe7e7daab06a040ca1ac41.tar.gz inspircd++-1f4ffdfee959614e3afe7e7daab06a040ca1ac41.tar.bz2 inspircd++-1f4ffdfee959614e3afe7e7daab06a040ca1ac41.zip | |
Various improvements to the cloak system.
- Only rewrite cloak => cloaking if the cloak_md5 module is also
loaded.
- Include the cloak method in the link data.
- If 1206 servers are using different cloak methods then ignore
the other data when telling operators about the link failure.
- Clean up the code in a few places.
Diffstat (limited to 'src/modules/m_cloak.cpp')
| -rw-r--r-- | src/modules/m_cloak.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/modules/m_cloak.cpp b/src/modules/m_cloak.cpp index f7ef8fdb8..f6e0c2e98 100644 --- a/src/modules/m_cloak.cpp +++ b/src/modules/m_cloak.cpp @@ -21,6 +21,7 @@ #include "clientprotocolevent.h" #include "modules/cloak.h" #include "modules/ircv3_replies.h" +#include "utility/map.h" typedef std::vector<Cloak::MethodPtr> CloakMethodList; @@ -233,10 +234,30 @@ class ModuleCloakSHA256 final cloakmethods.swap(newcloakmethods); } - void GetLinkData(Module::LinkData& data, std::string& compatdata) override + void CompareLinkData(const LinkData& otherdata, LinkDataDiff& diffs) { - if (!cloakmethods.empty()) - cloakmethods.front()->GetLinkData(data, compatdata); + std::string unused; + LinkData data; + this->GetLinkData(data, unused); + + // If the only difference is the method then just include that. + insp::map::difference(data, otherdata, diffs); + auto it = diffs.find("method"); + if (it != diffs.end()) + diffs = { *it }; + } + + void GetLinkData(LinkData& data, std::string& compatdata) override + { + if (cloakmethods.empty()) + return; + + auto& cloakmethod = cloakmethods.front(); + cloakmethod->GetLinkData(data, compatdata); + + data["method"] = cloakmethod->GetName(); + if (compatdata.empty()) + compatdata.assign(cloakmethod->GetName()); } void Prioritize() override |
