diff options
| author | 2021-05-09 22:45:40 +0100 | |
|---|---|---|
| committer | 2021-05-10 01:46:51 +0100 | |
| commit | ecabf153d01b4cb48944155a638e1cf4c1d80d98 (patch) | |
| tree | 8a1b2773847c0a9bf6ffefff2ae1b8ef4ff95df5 /src/modules/m_cloaking.cpp | |
| parent | Switch Channel::ChanModes to use the channel mode map. (diff) | |
Add a new map-based method for building link data.
The new link data is not currently used but will be in the near
future.
Diffstat (limited to 'src/modules/m_cloaking.cpp')
| -rw-r--r-- | src/modules/m_cloaking.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index 6462a1ef3..f665ce3dc 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -411,12 +411,11 @@ class ModuleCloaking : public Module cu.active = false; } - void GetLinkData(std::string& data) override + std::string GetCompatLinkData(const CloakInfo& info) { - data = "broken"; - if (Hash && !cloaks.empty()) + std::string data = "broken"; + if (Hash) { - const CloakInfo& info = cloaks.front(); switch (info.mode) { case MODE_HALF_CLOAK: @@ -434,6 +433,31 @@ class ModuleCloaking : public Module data = info.prefix + SegmentCloak(info, "*", 4, 8) + info.suffix + (info.ignorecase ? "-ci" : ""); } } + return data; + } + + void GetLinkData(LinkData& data, std::string& compatdata) override + { + if (cloaks.empty()) + return; + + const CloakInfo& info = cloaks.front(); + switch (info.mode) + { + case MODE_HALF_CLOAK: + data["mode"] = "half"; + break; + case MODE_OPAQUE: + data["mode"] = "full"; + break; + } + data["domain-parts"] = ConvToStr(info.domainparts); + data["hash"] = Hash ? Hash->name : "broken"; + data["ignore-case"] = info.ignorecase ? "yes" : "no"; + data["key"] = info.key; + data["prefix"] = info.prefix; + data["suffix"] = info.suffix; + compatdata = GetCompatLinkData(info); } void ReadConfig(ConfigStatus& status) override |
