diff --git a/include/modules.h b/include/modules.h index 491f8e277..86d968087 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1248,10 +1248,10 @@ public: /** Find the first module of a certain type * @param type The module type - * @param ignore If non-nullptr then a module to ignore. + * @param ignoredeprecated Whether to ignore deprecated modules. * @return The module */ - static Module *FindFirstOf(ModType type, Module *ignore = nullptr); + static Module *FindFirstOf(ModType type, bool ignoredeprecated = false); /** Checks whether this version of Anope is at least major.minor.patch.build * Throws a ModuleException if not diff --git a/src/init.cpp b/src/init.cpp index 4f154025b..f61174486 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -557,10 +557,10 @@ bool Anope::Init(int ac, char **av) if (!Anope::NoDB) { - if (!ModuleManager::FindFirstOf(DATABASE)) + if (!ModuleManager::FindFirstOf(DATABASE, true)) throw CoreException("You must load a non-deprecated database module!"); - if (!ModuleManager::FindFirstOf(ENCRYPTION)) + if (!ModuleManager::FindFirstOf(ENCRYPTION, true)) throw CoreException("You must load a non-deprecated encryption module!"); } diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index ceee29874..929dd1f13 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -262,11 +262,14 @@ Module *ModuleManager::FindModule(const Anope::string &name) return NULL; } -Module *ModuleManager::FindFirstOf(ModType type, Module *ignore) +Module *ModuleManager::FindFirstOf(ModType type, bool ignoredeprecated) { for (auto *m : Modules) { - if (m->type & type && m != ignore) + if (ignoredeprecated && (m->type & DEPRECATED)) + continue; + + if (m->type & type) return m; }