From b6c2c96eb9cd411628b38768c5b15f1279e6714f Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 7 Dec 2005 21:18:29 +0000 Subject: Added OnCleanup handler git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2259 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_swhois.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') 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 -- cgit v1.2.3