Changeset

4604:eef5e3a83792

modulemanager: Use appropriate events object for global modules when firing item-removed on unload
author Matthew Wild <mwild1@gmail.com>
date Wed, 14 Mar 2012 17:03:48 +0000
parents 4603:6900c9484834
children 4605:69746db53125
files core/modulemanager.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Sun Mar 11 20:56:09 2012 +0000
+++ b/core/modulemanager.lua	Wed Mar 14 17:03:48 2012 +0000
@@ -101,11 +101,12 @@
 	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