diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-15 21:25:30 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-15 21:25:30 +0000 |
commit | 01c23b31f7d0ea87052cd22814af826ecb11f0f3 (patch) | |
tree | 53743a6950d0ddafe6c8319eecf09b1c6d1687a2 /src/base.cpp | |
parent | 94d7827e8b101b528c427298fada73664970cf26 (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.cpp | 20 |
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); + } } } |