summaryrefslogtreecommitdiff
path: root/src/base.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-15 21:25:30 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-15 21:25:30 +0000
commit01c23b31f7d0ea87052cd22814af826ecb11f0f3 (patch)
tree53743a6950d0ddafe6c8319eecf09b1c6d1687a2 /src/base.cpp
parent94d7827e8b101b528c427298fada73664970cf26 (diff)
Remove Extensible items from user, channel, and Membership on module unload
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11730 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/base.cpp')
-rw-r--r--src/base.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/base.cpp b/src/base.cpp
index aac66fd3f..27eb4af23 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -122,14 +122,32 @@ bool Extensible::Register(ExtensionItem* item)
return Extensible::extension_types.insert(std::make_pair(item->key, item)).second;
}
-void Extensible::UnRegister(Module* module)
+std::vector<ExtensionItem*> Extensible::BeginUnregister(Module* module)
{
+ std::vector<ExtensionItem*> rv;
ExtensibleTypes::iterator i = extension_types.begin();
while (i != extension_types.end())
{
ExtensibleTypes::iterator c = i++;
if (c->second->owner == module)
+ {
+ rv.push_back(c->second);
extension_types.erase(c);
+ }
+ }
+ return rv;
+}
+
+void Extensible::doUnhookExtensions(const std::vector<ExtensionItem*>& toRemove)
+{
+ for(std::vector<ExtensionItem*>::const_iterator i = toRemove.begin(); i != toRemove.end(); i++)
+ {
+ ExtensibleStore::iterator e = extensions.find((**i).key);
+ if (e != extensions.end())
+ {
+ (**i).free(e->second);
+ extensions.erase(e);
+ }
}
}