Changeset

4537:d8d257c13562

modulemanager: load(): Return and use the correct module object
author Matthew Wild <mwild1@gmail.com>
date Sun, 22 Jan 2012 19:27:06 +0000
parents 4536:285450536ec0
children 4538:d0a89c1c43fd
files core/modulemanager.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/modulemanager.lua	Sun Jan 22 19:10:13 2012 +0000
+++ b/core/modulemanager.lua	Sun Jan 22 19:27:06 2012 +0000
@@ -170,7 +170,7 @@
 		log("error", "Error initializing module '%s' on '%s': %s", module_name, host, err or "nil");
 		do_unload_module(api_instance.host, module_name); -- Ignore error, module may be partially-loaded
 	end
-	return ok and mod, err;
+	return ok and pluginenv, err;
 end
 
 local function do_reload_module(host, name)
@@ -219,7 +219,7 @@
 function load(host, name)
 	local mod, err = do_load_module(host, name);
 	if mod then
-		(hosts[mod.host] or prosody).events.fire_event("module-loaded", { module = module_name, host = host });
+		(hosts[mod.module.host] or prosody).events.fire_event("module-loaded", { module = name, host = host });
 	end
 	return mod, err;
 end