summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/modules.h4
-rw-r--r--src/inspircd.cpp9
-rw-r--r--src/modules.cpp1
3 files changed, 13 insertions, 1 deletions
diff --git a/include/modules.h b/include/modules.h
index 2c1cf4ff7..2745fef33 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -466,11 +466,13 @@ class Module : public classbase
virtual void OnDelZLine(userrec* source, std::string ipmask);
virtual void OnDelKLine(userrec* source, std::string hostmask);
-
+
virtual void OnDelQLine(userrec* source, std::string nickmask);
virtual void OnDelELine(userrec* source, std::string hostmask);
+ virtual void OnCleanup(int target_type, void* source);
+
/** Called after any nickchange, local or remote. This can be used to track users after nickchanges
* have been applied. Please note that although you can see remote nickchanges through this function, you should
* NOT make any changes to the userrec if the user is a remote user as this may cause a desnyc.
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index f47cc339b..75c0833fc 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2184,6 +2184,15 @@ bool UnloadModule(const char* filename)
snprintf(MODERR,MAXBUF,"Module not unloadable (marked static)");
return false;
}
+ /* Give the module a chance to tidy out all its metadata */
+ for (chan_hash::iterator c = chanlist.begin(); c != chanlist.end(); c++)
+ {
+ modules[j]->OnCleanup(TYPE_CHANNEL,c->second);
+ }
+ for (user_hash::iterator u = userlist.begin(); u != userlist.end(); u++)
+ {
+ modules[j]->OnCleanup(TYPE_USER,u->second);
+ }
FOREACH_MOD OnUnloadModule(modules[j],module_names[j]);
// found the module
log(DEBUG,"Deleting module...");
diff --git a/src/modules.cpp b/src/modules.cpp
index f47a2cb4e..6e553167e 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -385,6 +385,7 @@ void Module::OnDelZLine(userrec* source, std::string ipmask) { };
void Module::OnDelKLine(userrec* source, std::string hostmask) { };
void Module::OnDelQLine(userrec* source, std::string nickmask) { };
void Module::OnDelELine(userrec* source, std::string hostmask) { };
+void Module::OnCleanup(int target_type, void* source) { };
/* server is a wrapper class that provides methods to all of the C-style
* exports in the core