diff options
| author | 2010-08-05 19:36:16 -0400 | |
|---|---|---|
| committer | 2010-08-05 19:36:16 -0400 | |
| commit | cc6599f329f575a6366e98ea9d78bd0def05b247 (patch) | |
| tree | 4c554eb685c7f3b0b44d165d45b25594dab02dd5 /src/modmanager_static.cpp | |
| parent | Fix up some errors from the init() conversion (diff) | |
| download | inspircd++-cc6599f329f575a6366e98ea9d78bd0def05b247.tar.gz inspircd++-cc6599f329f575a6366e98ea9d78bd0def05b247.tar.bz2 inspircd++-cc6599f329f575a6366e98ea9d78bd0def05b247.zip | |
Persist metadata and modes across module reloads
Diffstat (limited to 'src/modmanager_static.cpp')
| -rw-r--r-- | src/modmanager_static.cpp | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/src/modmanager_static.cpp b/src/modmanager_static.cpp index 9c5457cd9..2547a7146 100644 --- a/src/modmanager_static.cpp +++ b/src/modmanager_static.cpp @@ -67,7 +67,7 @@ class AllModule : public Module MODULE_INIT(AllModule) -bool ModuleManager::Load(const std::string& name, bool defer) +bool ModuleManager::Load(const std::string& name, bool defer, ModuleState* state) { modmap::iterator it = modlist->find(name); if (it == modlist->end()) @@ -92,28 +92,12 @@ bool ModuleManager::Load(const std::string& name, bool defer) catch (CoreException& modexcept) { if (mod) - DoSafeUnload(mod); + DoSafeUnload(mod, NULL); ServerInstance->Logs->Log("MODULE", DEFAULT, "Unable to load " + name + ": " + modexcept.GetReason()); return false; } - FOREACH_MOD(I_OnLoadModule,OnLoadModule(mod)); - /* We give every module a chance to re-prioritize when we introduce a new one, - * not just the one thats loading, as the new module could affect the preference - * of others - */ - for(int tries = 0; tries < 20; tries++) - { - prioritizationState = tries > 0 ? PRIO_STATE_LAST : PRIO_STATE_FIRST; - for (std::map<std::string, Module*>::iterator n = Modules.begin(); n != Modules.end(); ++n) - n->second->Prioritize(); - - if (prioritizationState == PRIO_STATE_LAST) - break; - if (tries == 19) - ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected while loading " + name); - } - ServerInstance->BuildISupport(); + DoModuleLoad(mod, state); return true; } @@ -124,7 +108,7 @@ namespace { UnloadAction(Module* m) : mod(m) {} void Call() { - ServerInstance->Modules->DoSafeUnload(mod); + ServerInstance->Modules->DoSafeUnload(mod, NULL); ServerInstance->GlobalCulls.Apply(); ServerInstance->GlobalCulls.AddItem(this); } @@ -138,10 +122,11 @@ namespace { : mod(m), callback(c) {} void Call() { + ModuleState state; std::string name = mod->ModuleSourceFile; - ServerInstance->Modules->DoSafeUnload(mod); + ServerInstance->Modules->DoSafeUnload(mod, &state); ServerInstance->GlobalCulls.Apply(); - bool rv = ServerInstance->Modules->Load(name.c_str()); + bool rv = ServerInstance->Modules->Load(name.c_str(), false, state); callback->Call(rv); ServerInstance->GlobalCulls.AddItem(this); } |
