From acc9f5228f686ea816db38d8ecb1925adc053984 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 6 Jun 2023 00:57:07 +0100 Subject: Allow secondary cloak methods to be used on link synchronisation. If a server has a conditional cloak method (e.g. account) as the primary cloak method it doesn't make sense to use it for link consistency. With this change a secondary cloak method can request that it is used instead of the primary if the primary does not mark itself as link sensitive. --- src/modules/m_cloak.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/modules/m_cloak.cpp') diff --git a/src/modules/m_cloak.cpp b/src/modules/m_cloak.cpp index e94a3a33d..6b4dddad3 100644 --- a/src/modules/m_cloak.cpp +++ b/src/modules/m_cloak.cpp @@ -321,7 +321,21 @@ public: if (cloakmethods.empty()) return; - auto& cloakmethod = cloakmethods.front(); + Cloak::MethodPtr cloakmethod; + for (const auto& method : cloakmethods) + { + if (method->IsLinkSensitive()) + { + // This cloak method really wants to be the link method so prefer it. + cloakmethod = method; + break; + } + } + + // If no methods are link sensitive we just use the first. + if (!cloakmethod) + cloakmethod = cloakmethods.front(); + cloakmethod->GetLinkData(data, compatdata); data["method"] = cloakmethod->GetName(); -- cgit v1.3.1-10-gc9f91