summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-07 18:20:34 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-07 18:20:34 +0000
commitf6f348468676e053037da8ebeebbef47351202b0 (patch)
treee00b4a792c470f1276c19a1a8115845a3c486f57
parentec7fc489a14af54738da17a94b162a9606df4756 (diff)
/LOADMODULE and /UNLOADMODULE all successfully working!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1002 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/inspircd.cpp14
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_helpop.cpp2
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<Module*>::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 &params) { 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);
}
};