aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-01-29 17:54:37 +0000
committerMatthew Wild <mwild1@gmail.com>2009-01-29 17:54:37 +0000
commit4dc046b0afa381ac22982bd1d4265775832c4553 (patch)
tree808a534fe9e3bc2cfadb1ea6bb7bacea05277631 /core/configmanager.lua
parent8fc233d7f5e6a5bee04d6b26a761ac2f9f88e57d (diff)
parent75a4fe601018e84510f1526faa9d155a9299e528 (diff)
downloadprosody-4dc046b0afa381ac22982bd1d4265775832c4553.tar.gz
prosody-4dc046b0afa381ac22982bd1d4265775832c4553.zip
Automated merge with http://waqas.ath.cx:8000/
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index a6e86347..a50e7223 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -107,7 +107,8 @@ do
parsers.lua = {};
function parsers.lua.load(data)
local env;
- env = setmetatable({ Host = true; host = true; }, { __index = function (t, k)
+ -- The ' = true' are needed so as not to set off __newindex when we assign the functions below
+ env = setmetatable({ Host = true; host = true; Component = true, component = true }, { __index = function (t, k)
return rawget(_G, k) or
function (settings_table)
config[__currenthost or "*"][k] = settings_table;
@@ -119,10 +120,21 @@ do
function env.Host(name)
rawset(env, "__currenthost", name);
+ -- Needs at least one setting to logically exist :)
set(name or "*", "core", "defined", true);
end
env.host = env.Host;
+ function env.Component(name)
+ return function (module)
+ set(name, "core", "component_module", module);
+ -- Don't load the global modules by default
+ set(name, "core", "modules_enable", false);
+ rawset(env, "__currenthost", name);
+ end
+ end
+ env.component = env.Component;
+
local chunk, err = loadstring(data);
if not chunk then