From 5ff86ea2c5361401de5f0deed0250ad4ae7dc853 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 14 Mar 2025 19:45:43 +0000 Subject: [PATCH] Implement support for the new way of setting vhosts on InspIRCd. --- modules/protocol/inspircd.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp index 8f103fbdb..f59440e17 100644 --- a/modules/protocol/inspircd.cpp +++ b/modules/protocol/inspircd.cpp @@ -510,6 +510,17 @@ public: void SendVHost(User *u, const Anope::string &vident, const Anope::string &vhost) override { + if (Servers::Capab.count("CLOAK")) + { + Anope::string cloak; + if (!vident.empty()) + cloak.append(vident).push_back('@'); + cloak.append(vhost); + + Uplink::Send("METADATA", u->GetUID(), "custom-cloak", cloak); + return; + } + if (!vident.empty()) this->SendChgIdentInternal(u->GetUID(), vident); @@ -2034,7 +2045,24 @@ public: Log() << "InspIRCd " << (plus ? "loaded" : "unloaded") << " the " << modname << " module; adjusted functionality."; } + } + else if (params[1].equals_cs("cloakmethods")) + { + spacesepstream tokens(params[2]); + for (Anope::string token; tokens.GetToken(token); ) + { + const auto idx = token.find('='); + if (token.compare(0, idx, "custom", 6) == 0) + { + Log() << "The remote server has the custom cloak method; this will be used for setting vhosts."; + Servers::Capab.insert("CLOAK"); + return; + } + } + + Log() << "The remote server does not have the custom cloak method; CHGIDENT and CHGHOST will be used until the module is loaded."; + Servers::Capab.erase("CLOAK"); } } }