Diff

core/modulemanager.lua @ 2659:ba6dd11f7259

modulemanager: Fix traceback on unloading global modules (thanks KSid)
author Matthew Wild <mwild1@gmail.com>
date Thu, 18 Feb 2010 16:22:50 +0000
parent 2585:a9e99897b2e8
child 2925:692b3c6c5bd2
line wrap: on
line diff
--- a/core/modulemanager.lua	Wed Feb 17 13:21:33 2010 +0000
+++ b/core/modulemanager.lua	Thu Feb 18 16:22:50 2010 +0000
@@ -158,7 +158,7 @@
 		log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil");
 	end
 	if success then
-		hosts[host].events.fire_event("module-loaded", { module = module_name, host = host });
+		(hosts[api_instance.host] or prosody).events.fire_event("module-loaded", { module = module_name, host = host });
 		return true;
 	else -- load failed, unloading
 		unload(api_instance.host, module_name);
@@ -210,7 +210,7 @@
 		end
 	end
 	modulemap[host][name] = nil;
-	hosts[host].events.fire_event("module-unloaded", { module = name, host = host });
+	(hosts[host] or prosody).events.fire_event("module-unloaded", { module = name, host = host });
 	return true;
 end