Diff

core/configmanager.lua @ 3011:1189a29cd846

configmanager: Add VirtualHost as an alias for Host (re-applied in trunk due to previous bad merge with 0.7)
author Matthew Wild <mwild1@gmail.com>
date Wed, 14 Apr 2010 12:59:46 +0100
parent 2925:692b3c6c5bd2
child 3012:6d86e26f0923
line wrap: on
line diff
--- a/core/configmanager.lua	Sun Apr 11 01:30:31 2010 +0100
+++ b/core/configmanager.lua	Wed Apr 14 12:59:46 2010 +0100
@@ -112,7 +112,7 @@
 	function parsers.lua.load(data, filename)
 		local env;
 		-- 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,
+		env = setmetatable({ Host = true, host = true, VirtualHost = true, Component = true, component = true,
 							Include = true, include = true, RunScript = dofile }, { __index = function (t, k)
 												return rawget(_G, k) or
 														function (settings_table)
@@ -124,7 +124,7 @@
 										end});
 		
 		rawset(env, "__currenthost", "*") -- Default is global
-		function env.Host(name)
+		function env.VirtualHost(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);
@@ -133,7 +133,7 @@
 			-- Needs at least one setting to logically exist :)
 			set(name or "*", "core", "defined", true);
 		end
-		env.host = env.Host;
+		env.Host, env.host = env.VirtualHost, env.VirtualHost;
 		
 		function env.Component(name)
 			if rawget(config, name) and rawget(config[name].core, "defined") and not rawget(config[name].core, "component_module") then