X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=core%2Fconfigmanager.lua;h=e7677df67e63ff2a4a48b2362cfecf3b14fc02c6;hb=562c5a60021ff900f7bdd3f9255a2c0cfda7cf91;hp=ada14051ac1f38dc49fd52a95aa73db58034dcf0;hpb=df0842ff8867d1afb63fb04584a7f8da95eaf645;p=prosody.git diff --git a/core/configmanager.lua b/core/configmanager.lua index ada14051..e7677df6 100644 --- a/core/configmanager.lua +++ b/core/configmanager.lua @@ -1,6 +1,6 @@ -- Prosody IM --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. @@ -9,8 +9,9 @@ local _G = _G; -local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table = - setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table; +local setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table, format = + setmetatable, loadfile, pcall, rawget, rawset, io, error, dofile, type, pairs, table, string.format; + local eventmanager = require "core.eventmanager"; @@ -124,6 +125,10 @@ do rawset(env, "__currenthost", "*") -- Default is global function env.Host(name) + if rawget(config, name) and rawget(config[name].core, "component_module") then + error(format("Host %q clashes with previously defined %s Component %q, for services use a sub-domain like conference.%s", + name, config[name].core.component_module:gsub("^%a+$", { component = "external", muc = "MUC"}), name, name), 0); + end rawset(env, "__currenthost", name); -- Needs at least one setting to logically exist :) set(name or "*", "core", "defined", true); @@ -131,6 +136,10 @@ do env.host = env.Host; function env.Component(name) + if rawget(config, name) and rawget(config[name].core, "defined") and not rawget(config[name].core, "component_module") then + error(format("Component %q clashes with previously defined Host %q, for services use a sub-domain like conference.%s", + name, name, name), 0); + end set(name, "core", "component_module", "component"); -- Don't load the global modules by default set(name, "core", "load_global_modules", false);