aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-10 20:14:33 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-10 20:14:33 +0500
commit557bad86f76f900f26cd510808399faf18e4e213 (patch)
treeda29a7fe3221bb1aa81702f8507af7f7db73e9b5
parentd1706d1cb578ea661f52564d271968b76b088af1 (diff)
downloadprosody-557bad86f76f900f26cd510808399faf18e4e213.tar.gz
prosody-557bad86f76f900f26cd510808399faf18e4e213.zip
modulemanager: Return an error when loading a module on a non-existent host, don't create the host. Removes dependecy on componentmanager.
-rw-r--r--core/modulemanager.lua7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index e228e48d..67a77af6 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -91,6 +91,8 @@ prosody_events.add_handler("component-activated", load_modules_for_host);
function load(host, module_name, config)
if not (host and module_name) then
return nil, "insufficient-parameters";
+ elseif not hosts[host] then
+ return nil, "unknown-host";
end
if not modulemap[host] then
@@ -118,11 +120,6 @@ function load(host, module_name, config)
api_instance.environment = pluginenv;
setfenv(mod, pluginenv);
- if not hosts[host] then
- local create_component = _G.require "core.componentmanager".create_component;
- hosts[host] = create_component(host);
- log("debug", "Created new component: %s", host);
- end
hosts[host].modules = modulemap[host];
modulemap[host][module_name] = pluginenv;