aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2009-12-10 03:02:04 +0500
committerWaqas Hussain <waqas20@gmail.com>2009-12-10 03:02:04 +0500
commitf742f936091ba45358a3a73d73b24d911f1d2987 (patch)
tree1a735f459c11a9679e2236a4d38bdea4dc283c43
parent8495a4cfffc975d8369e2f18b08b80e5f23bc21d (diff)
downloadprosody-f742f936091ba45358a3a73d73b24d911f1d2987.tar.gz
prosody-f742f936091ba45358a3a73d73b24d911f1d2987.zip
modulemanager: Fire item-removed events on module unload.
-rw-r--r--core/modulemanager.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 7ee262c4..032cab84 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -200,6 +200,15 @@ function unload(host, name, ...)
end
end
hooks:remove(host, name);
+ if mod.module.items then -- remove items
+ for key,t in pairs(mod.module.items) do
+ for i = #t,1,-1 do
+ local value = t[i];
+ t[i] = nil;
+ hosts[host].events.fire_event("item-removed/"..key, {source = self, item = value});
+ end
+ end
+ end
modulemap[host][name] = nil;
hosts[host].events.fire_event("module-unloaded", { module = name, host = host });
return true;