From 30b4d1373ee051465659db2fbbf15f58a9fc26b5 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Wed, 6 Jan 2016 18:52:12 +0100 Subject: m_spanningtree Add compatibility hack that allows modules to drop the VF_COMMON/VF_OPTCOMMON flags Include m_watch in the list --- src/modules/m_spanningtree/capab.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/modules/m_spanningtree/capab.cpp b/src/modules/m_spanningtree/capab.cpp index 9035d89c9..b75fbc3cc 100644 --- a/src/modules/m_spanningtree/capab.cpp +++ b/src/modules/m_spanningtree/capab.cpp @@ -26,6 +26,17 @@ #include "link.h" #include "main.h" +struct CompatMod +{ + const char* name; + ModuleFlags listflag; +}; + +static CompatMod compatmods[] = +{ + { "m_watch.so", VF_OPTCOMMON } +}; + std::string TreeSocket::MyModules(int filter) { const ModuleManager::ModuleMap& modlist = ServerInstance->Modules->GetModules(); @@ -33,13 +44,27 @@ std::string TreeSocket::MyModules(int filter) std::string capabilities; for (ModuleManager::ModuleMap::const_iterator i = modlist.begin(); i != modlist.end(); ++i) { + Module* const mod = i->second; // 2.2 advertises its settings for the benefit of services // 2.0 would bork on this if (proto_version < 1205 && i->second->ModuleSourceFile == "m_kicknorejoin.so") continue; + bool do_compat_include = false; + if (proto_version < 1205) + { + for (size_t j = 0; j < sizeof(compatmods)/sizeof(compatmods[0]); j++) + { + if ((compatmods[j].listflag & filter) && (mod->ModuleSourceFile == compatmods[j].name)) + { + do_compat_include = true; + break; + } + } + } + Version v = i->second->GetVersion(); - if (!(v.Flags & filter)) + if ((!do_compat_include) && (!(v.Flags & filter))) continue; if (i != modlist.begin()) -- cgit v1.2.3