Changeset

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
parents 2656:9fab59009397
children 2660:9e5b21b7b2f9
files core/modulemanager.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
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