aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-03-14 17:03:48 +0000
committerMatthew Wild <mwild1@gmail.com>2012-03-14 17:03:48 +0000
commitaef2645ec8a90374fdb869aee40bff7c878d34d5 (patch)
treeab9200860fa8a69e96ce056c2a67e20636b8c101
parenta4a4365842fd701623fa72d38e9ea8068e0674ce (diff)
downloadprosody-aef2645ec8a90374fdb869aee40bff7c878d34d5.tar.gz
prosody-aef2645ec8a90374fdb869aee40bff7c878d34d5.zip
modulemanager: Use appropriate events object for global modules when firing item-removed on unload
-rw-r--r--core/modulemanager.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 0ca37105..328224ae 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -101,11 +101,12 @@ local function do_unload_module(host, name)
end
if mod.module.items then -- remove items
+ local events = (host == "*" and prosody.events) or hosts[host].events;
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 = mod.module, item = value});
+ events.fire_event("item-removed/"..key, {source = mod.module, item = value});
end
end
end