modulemanager: Fix traceback on unloading global modules (thanks KSid)

Thu, 18 Feb 2010 16:22:50 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Thu, 18 Feb 2010 16:22:50 +0000
changeset 2659
ba6dd11f7259
parent 2656
9fab59009397
child 2660
9e5b21b7b2f9

modulemanager: Fix traceback on unloading global modules (thanks KSid)

core/modulemanager.lua file | annotate | diff | comparison | revisions
--- 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
 

mercurial