aboutsummaryrefslogtreecommitdiffstats
path: root/core/hostmanager.lua
diff options
context:
space:
mode:
authorWaqas Hussain <waqas20@gmail.com>2010-11-10 17:37:14 +0500
committerWaqas Hussain <waqas20@gmail.com>2010-11-10 17:37:14 +0500
commit68f1533da5dac7f3d1873cbab0e08bfa521ee54f (patch)
treef7ee512a1860b19557bc7f0009918aea95952b4a /core/hostmanager.lua
parenta9eb525db3ff365bf20242fe2eddc96680ad17f4 (diff)
downloadprosody-68f1533da5dac7f3d1873cbab0e08bfa521ee54f.tar.gz
prosody-68f1533da5dac7f3d1873cbab0e08bfa521ee54f.zip
hostmanager: Added support for components to hostmanager.activate().
Diffstat (limited to 'core/hostmanager.lua')
-rw-r--r--core/hostmanager.lua24
1 files changed, 17 insertions, 7 deletions
diff --git a/core/hostmanager.lua b/core/hostmanager.lua
index bd44d258..71bc723e 100644
--- a/core/hostmanager.lua
+++ b/core/hostmanager.lua
@@ -49,13 +49,23 @@ end
prosody_events.add_handler("server-starting", load_enabled_hosts);
function activate(host, host_config)
- hosts[host] = {type = "local", sessions = {},
- host = host, s2sout = {}, events = events_new(),
- disallow_s2s = configmanager.get(host, "core", "disallow_s2s")
- or (configmanager.get(host, "core", "anonymous_login")
- and (configmanager.get(host, "core", "disallow_s2s") ~= false));
- dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
- };
+ local host_session = {
+ host = host;
+ s2sout = {};
+ events = events_new();
+ dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen();
+ disallow_s2s = configmanager.get(host, "core", "disallow_s2s");
+ };
+ if not host_config.core.component_module then -- host
+ host_session.type = "local";
+ host_session.sessions = {};
+ if configmanager.get(host, "core", "anonymous_login") then
+ host_session.disallow_s2s = (configmanager.get(host, "core", "disallow_s2s") ~= false);
+ end
+ else -- component
+ host_session.type = "component";
+ end
+ hosts[host] = host_session;
for option_name in pairs(host_config.core) do
if option_name:match("_ports$") or option_name:match("_interface$") then
log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name);