Comparison

core/hostmanager.lua @ 6721:3807af36d773

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Tue, 19 May 2015 16:33:47 +0200
parent 6621:352fa2cae1c9
parent 6706:60c692828cf6
child 6791:e813e8cf6046
comparison
equal deleted inserted replaced
6705:c269ab6ab98a 6721:3807af36d773
24 local incoming_s2s = _G.prosody.incoming_s2s; 24 local incoming_s2s = _G.prosody.incoming_s2s;
25 local core_route_stanza = _G.prosody.core_route_stanza; 25 local core_route_stanza = _G.prosody.core_route_stanza;
26 26
27 local pairs, select, rawget = pairs, select, rawget; 27 local pairs, select, rawget = pairs, select, rawget;
28 local tostring, type = tostring, type; 28 local tostring, type = tostring, type;
29 local setmetatable = setmetatable;
29 30
30 module "hostmanager" 31 module "hostmanager"
32
33 local host_mt = { }
34 function host_mt:__tostring()
35 if self.type == "component" then
36 local typ = configmanager.get(self.host, "component_module");
37 if typ == "component" then
38 return ("Component %q"):format(self.host);
39 end
40 return ("Component %q %q"):format(self.host, typ);
41 elseif self.type == "local" then
42 return ("VirtualHost %q"):format(self.host);
43 end
44 end
31 45
32 local hosts_loaded_once; 46 local hosts_loaded_once;
33 47
34 local function load_enabled_hosts(config) 48 local function load_enabled_hosts(config)
35 local defined_hosts = config or configmanager.getconfig(); 49 local defined_hosts = config or configmanager.getconfig();
67 s2sout = {}; 81 s2sout = {};
68 events = events_new(); 82 events = events_new();
69 send = host_send; 83 send = host_send;
70 modules = {}; 84 modules = {};
71 }; 85 };
86 setmetatable(host_session, host_mt);
72 if not host_config.component_module then -- host 87 if not host_config.component_module then -- host
73 host_session.type = "local"; 88 host_session.type = "local";
74 host_session.sessions = {}; 89 host_session.sessions = {};
75 else -- component 90 else -- component
76 host_session.type = "component"; 91 host_session.type = "component";