diff options
author | Attila Molnar <attilamolnar@hush.com> | 2016-01-06 18:52:12 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2016-01-06 18:52:12 +0100 |
commit | 30b4d1373ee051465659db2fbbf15f58a9fc26b5 (patch) | |
tree | 90d07fc461e05ed4531857922e6338fba71699e5 /src/modules | |
parent | 69df6199ef8e9693060906037ac9a23880bf4acc (diff) |
m_spanningtree Add compatibility hack that allows modules to drop the VF_COMMON/VF_OPTCOMMON flags
Include m_watch in the list
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/capab.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
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()) |