Software / code / prosody
Comparison
core/hostmanager.lua @ 3594:d3b57562cd87
hostmanager: Added support for components to hostmanager.activate().
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Wed, 10 Nov 2010 17:37:14 +0500 |
| parent | 3587:d94aacb2771a |
| child | 3597:8090880f0e18 |
comparison
equal
deleted
inserted
replaced
| 3593:58a4af582eb3 | 3594:d3b57562cd87 |
|---|---|
| 47 end | 47 end |
| 48 | 48 |
| 49 prosody_events.add_handler("server-starting", load_enabled_hosts); | 49 prosody_events.add_handler("server-starting", load_enabled_hosts); |
| 50 | 50 |
| 51 function activate(host, host_config) | 51 function activate(host, host_config) |
| 52 hosts[host] = {type = "local", sessions = {}, | 52 local host_session = { |
| 53 host = host, s2sout = {}, events = events_new(), | 53 host = host; |
| 54 disallow_s2s = configmanager.get(host, "core", "disallow_s2s") | 54 s2sout = {}; |
| 55 or (configmanager.get(host, "core", "anonymous_login") | 55 events = events_new(); |
| 56 and (configmanager.get(host, "core", "disallow_s2s") ~= false)); | 56 dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen(); |
| 57 dialback_secret = configmanager.get(host, "core", "dialback_secret") or uuid_gen(); | 57 disallow_s2s = configmanager.get(host, "core", "disallow_s2s"); |
| 58 }; | 58 }; |
| 59 if not host_config.core.component_module then -- host | |
| 60 host_session.type = "local"; | |
| 61 host_session.sessions = {}; | |
| 62 if configmanager.get(host, "core", "anonymous_login") then | |
| 63 host_session.disallow_s2s = (configmanager.get(host, "core", "disallow_s2s") ~= false); | |
| 64 end | |
| 65 else -- component | |
| 66 host_session.type = "component"; | |
| 67 end | |
| 68 hosts[host] = host_session; | |
| 59 for option_name in pairs(host_config.core) do | 69 for option_name in pairs(host_config.core) do |
| 60 if option_name:match("_ports$") or option_name:match("_interface$") then | 70 if option_name:match("_ports$") or option_name:match("_interface$") then |
| 61 log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name); | 71 log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name); |
| 62 end | 72 end |
| 63 end | 73 end |