From 557bad86f76f900f26cd510808399faf18e4e213 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Wed, 10 Nov 2010 20:14:33 +0500 Subject: modulemanager: Return an error when loading a module on a non-existent host, don't create the host. Removes dependecy on componentmanager. --- core/modulemanager.lua | 7 ++----- 1 file 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; -- cgit v1.2.3