From f6f348468676e053037da8ebeebbef47351202b0 Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 7 Apr 2005 18:20:34 +0000 Subject: /LOADMODULE and /UNLOADMODULE all successfully working! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1002 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 14 +++++++++++++- src/modules.cpp | 2 +- src/modules/m_helpop.cpp | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/inspircd.cpp b/src/inspircd.cpp index dd1be77d9..44b84979c 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -3269,7 +3269,7 @@ bool UnloadModule(const char* filename) { if (module_names[j] == std::string(filename)) { - if (factory[j]->factory->GetVersion().Flags & VF_STATIC) + if (modules[j]->GetVersion().Flags & VF_STATIC) { log(DEFAULT,"Failed to unload STATIC module %s",filename); snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)"); @@ -3277,6 +3277,9 @@ bool UnloadModule(const char* filename) } // found the module log(DEBUG,"Deleting module..."); + delete modules[j]; + modules[j] = NULL; + log(DEBUG,"Deleting module factory pointer..."); delete factory[j]->factory; log(DEBUG,"Deleting module factory..."); delete factory[j]; @@ -3302,6 +3305,15 @@ bool UnloadModule(const char* filename) break; } } + log(DEBUG,"Erasing module pointer..."); + for (std::vector::iterator m = modules.begin(); m!= modules.end(); m++) + { + if (*m == NULL) + { + modules.erase(m); + break; + } + } log(DEBUG,"Removing dependent commands..."); removecommands(filename); log(DEFAULT,"Module %s unloaded",filename); diff --git a/src/modules.cpp b/src/modules.cpp index 7242ae92e..f068dc591 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -315,7 +315,7 @@ void Module::OnRehash() { } void Module::OnServerRaw(std::string &raw, bool inbound, userrec* user) { } int Module::OnUserPreJoin(userrec* user, chanrec* chan, const char* cname) { return 0; } int Module::OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms) { return false; } -Version Module::GetVersion() { return Version(1,0,0,0); } +Version Module::GetVersion() { return Version(1,0,0,0,VF_VENDOR); } void Module::OnOper(userrec* user) { }; void Module::OnInfo(userrec* user) { }; void Module::OnWhois(userrec* source, userrec* dest) { }; diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 1798122b2..efe4f513d 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -201,7 +201,7 @@ class ModuleHelpop : public Module virtual Version GetVersion() { - return Version(0,0,0,1,VF_STATIC|VF_VENDOR); + return Version(1,0,0,1,VF_STATIC|VF_VENDOR); } }; -- cgit v1.2.3