aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules.cpp
diff options
context:
space:
mode:
authorGravatar Daniel De Graaf2010-03-22 11:39:10 -0500
committerGravatar Daniel De Graaf2010-08-03 17:32:40 -0400
commit1ac4f3b4f6cd71f294ddbb9759e1ec9c00139f97 (patch)
tree9110c4322f451c5e75a135aa166331430778ea76 /src/modules.cpp
parentAllow static initialization of dynamic_reference objects (diff)
Move ModuleManager::UnloadAll out of modmanager_dynamic
Diffstat (limited to 'src/modules.cpp')
-rw-r--r--src/modules.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/modules.cpp b/src/modules.cpp
index 4ba9879b0..476e1f594 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -377,6 +377,29 @@ void ModuleManager::DoSafeUnload(Module* mod)
ServerInstance->BuildISupport();
}
+void ModuleManager::UnloadAll()
+{
+ /* We do this more than once, so that any service providers get a
+ * chance to be unhooked by the modules using them, but then get
+ * a chance to be removed themsleves.
+ *
+ * Note: this deliberately does NOT delete the DLLManager objects
+ */
+ for (int tries = 0; tries < 4; tries++)
+ {
+ std::map<std::string, Module*>::iterator i = Modules.begin();
+ while (i != Modules.end())
+ {
+ std::map<std::string, Module*>::iterator me = i++;
+ if (CanUnload(me->second))
+ {
+ DoSafeUnload(me->second);
+ }
+ }
+ ServerInstance->GlobalCulls.Apply();
+ }
+}
+
std::string& ModuleManager::LastError()
{
return LastModuleError;