summaryrefslogtreecommitdiff
path: root/src/modules.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-22 18:02:17 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-03-22 18:02:17 +0000
commit406010998eee82cebe6467c4f64e446ff8b79e5f (patch)
treec571984fab001b407ee0b120df4ffe53497d873e /src/modules.cpp
parenta9754ce49bf616c1d18556e19dd213d9ed54fcfc (diff)
Move ModuleManager::UnloadAll out of modmanager_dynamic
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12649 e03df62e-2008-0410-955e-edbf42e46eb7
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 bf5506d68..a111eaa92 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -395,6 +395,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;