Comparison

core/hostmanager.lua @ 6791:e813e8cf6046

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 20 Aug 2015 13:05:22 +0200
parent 6721:3807af36d773
parent 6779:6236668da30a
child 7143:fa6cd0e9105d
comparison
equal deleted inserted replaced
6776:4412a2307c89 6791:e813e8cf6046
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 local setmetatable = setmetatable;
30 30
31 module "hostmanager" 31 local _ENV = nil;
32 32
33 local host_mt = { } 33 local host_mt = { }
34 function host_mt:__tostring() 34 function host_mt:__tostring()
35 if self.type == "component" then 35 if self.type == "component" then
36 local typ = configmanager.get(self.host, "component_module"); 36 local typ = configmanager.get(self.host, "component_module");
42 return ("VirtualHost %q"):format(self.host); 42 return ("VirtualHost %q"):format(self.host);
43 end 43 end
44 end 44 end
45 45
46 local hosts_loaded_once; 46 local hosts_loaded_once;
47
48 local activate, deactivate;
47 49
48 local function load_enabled_hosts(config) 50 local function load_enabled_hosts(config)
49 local defined_hosts = config or configmanager.getconfig(); 51 local defined_hosts = config or configmanager.getconfig();
50 local activated_any_host; 52 local activated_any_host;
51 53
155 prosody_events.fire_event("host-deactivated", host); 157 prosody_events.fire_event("host-deactivated", host);
156 log("info", "Deactivated host: %s", host); 158 log("info", "Deactivated host: %s", host);
157 return true; 159 return true;
158 end 160 end
159 161
160 function get_children(host) 162 local function get_children(host)
161 return disco_items:get(host) or NULL; 163 return disco_items:get(host) or NULL;
162 end 164 end
163 165
164 return _M; 166 return {
167 activate = activate;
168 deactivate = deactivate;
169 get_children = get_children;
170 }