]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modmanager_static.cpp
Add access checking for m_autoop
[user/henk/code/inspircd.git] / src / modmanager_static.cpp
index e267a2c90b6320c519a5dcaa146430a09b836af1..d9ee07a257a7190754c299a76e4986b9da42da6e 100644 (file)
@@ -85,12 +85,19 @@ bool ModuleManager::Load(const char* name)
        return false;
 }
 
-bool ModuleManager::Unload(Module* mod)
-{
-       return false;
-}
-
 namespace {
+       struct UnloadAction : public HandlerBase0<void>
+       {
+               Module* const mod;
+               UnloadAction(Module* m) : mod(m) {}
+               void Call()
+               {
+                       ServerInstance->Modules->DoSafeUnload(mod);
+                       ServerInstance->GlobalCulls.Apply();
+                       ServerInstance->GlobalCulls.AddItem(this);
+               }
+       };
+
        struct ReloadAction : public HandlerBase0<void>
        {
                Module* const mod;
@@ -109,6 +116,14 @@ namespace {
        };
 }
 
+bool ModuleManager::Unload(Module* mod)
+{
+       if (!CanUnload(mod))
+               return false;
+       ServerInstance->AtomicActions.AddAction(new UnloadAction(mod));
+       return true;
+}
+
 void ModuleManager::Reload(Module* mod, HandlerBase1<void, bool>* callback)
 {
        if (CanUnload(mod))
@@ -127,6 +142,7 @@ void ModuleManager::LoadAll()
                {
                        c = (*(**i).init)();
                        c->ModuleSourceFile = (**i).name;
+                       c->ModuleDLLManager = NULL;
                        Modules[(**i).name] = c;
                        c->init();
                        FOREACH_MOD(I_OnLoadModule,OnLoadModule(c));