diff options
author | Adam <Adam@anope.org> | 2013-04-10 22:26:40 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-04-10 22:26:40 -0500 |
commit | 207c46c871e85b55ae66acc456c6bc412c0c79f9 (patch) | |
tree | 27b07dc9d1e0ee068872ec7841920eea9b846b65 /src/modulemanager.cpp | |
parent | 957cb2bf93d77a5ebb97d945b0656bd1e7bec164 (diff) |
Move some of the modules in extras/ that arent really extra out of extras. Mark our modules as VENDOR and allow modules to have multple types.
Diffstat (limited to 'src/modulemanager.cpp')
-rw-r--r-- | src/modulemanager.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp index 229067979..a6fa1fffd 100644 --- a/src/modulemanager.cpp +++ b/src/modulemanager.cpp @@ -260,7 +260,7 @@ Module *ModuleManager::FindFirstOf(ModType type) { Module *m = *it; - if (m->type == type) + if (m->type & type) return m; } @@ -459,17 +459,20 @@ bool ModuleManager::SetPriority(Module *mod, Implementation i, Priority s, Modul void ModuleManager::UnloadAll() { - std::vector<Anope::string> modules[MT_END]; - for (std::list<Module *>::iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) - if ((*it)->type != PROTOCOL && !(*it)->GetPermanent()) - modules[(*it)->type].push_back((*it)->name); - - for (size_t i = MT_BEGIN + 1; i != MT_END; ++i) - for (unsigned j = 0; j < modules[i].size(); ++j) + std::vector<Anope::string> modules; + for (size_t i = 1, j = 0; i != MT_END; i <<= 1, j |= i) + for (std::list<Module *>::iterator it = Modules.begin(), it_end = Modules.end(); it != it_end; ++it) { - Module *m = FindModule(modules[i][j]); - if (m != NULL) - UnloadModule(m, NULL); + Module *m = *it; + if ((m->type & j) == m->type) + modules.push_back(m->name); } + + for (unsigned i = 0; i < modules.size(); ++i) + { + Module *m = FindModule(modules[i]); + if (m != NULL) + UnloadModule(m, NULL); + } } |