summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-07 21:18:29 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-07 21:18:29 +0000
commitb6c2c96eb9cd411628b38768c5b15f1279e6714f (patch)
tree96628af46b3425486db45acd4f9ad0261701d652 /src
parentaea429253a21458b74d1b052e975cd1cc4c1b08a (diff)
Added OnCleanup handler
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2259 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_swhois.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 01aaa3915..15fe19264 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -106,6 +106,22 @@ class ModuleSWhois : public Module
}
}
+ // if the module is unloaded, tidy up all our dangling metadata
+ virtual void OnCleanup(int target_type, void* item)
+ {
+ if (target_type == TYPE_USER)
+ {
+ userrec* u = (userrec*)item;
+ char* field = user->GetExt("swhois");
+ if (field)
+ {
+ std::string* swhois = (std::string*)field;
+ user->Shrink("swhois");
+ delete swhois;
+ }
+ }
+ }
+
// Whenever the linking module receives metadata from another server and doesnt know what
// to do with it (of course, hence the 'meta') it calls this method, and it is up to each
// module in turn to figure out if this metadata key belongs to them, and what they want