Mercurial > prosody-hg
comparison core/hostmanager.lua @ 6779:6236668da30a
core.*: Remove use of module() function
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 21 Feb 2015 10:42:19 +0100 |
| parents | 60c692828cf6 |
| children | e813e8cf6046 cb2d86f4b511 |
comparison
equal
deleted
inserted
replaced
| 6778:4009ae66e0f0 | 6779:6236668da30a |
|---|---|
| 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 |
| 162 prosody_events.fire_event("host-deactivated", host); | 164 prosody_events.fire_event("host-deactivated", host); |
| 163 log("info", "Deactivated host: %s", host); | 165 log("info", "Deactivated host: %s", host); |
| 164 return true; | 166 return true; |
| 165 end | 167 end |
| 166 | 168 |
| 167 function get_children(host) | 169 local function get_children(host) |
| 168 return disco_items:get(host) or NULL; | 170 return disco_items:get(host) or NULL; |
| 169 end | 171 end |
| 170 | 172 |
| 171 return _M; | 173 return { |
| 174 activate = activate; | |
| 175 deactivate = deactivate; | |
| 176 get_children = get_children; | |
| 177 } |
