equal
deleted
inserted
replaced
7 -- |
7 -- |
8 |
8 |
9 local configmanager = require "core.configmanager"; |
9 local configmanager = require "core.configmanager"; |
10 local modulemanager = require "core.modulemanager"; |
10 local modulemanager = require "core.modulemanager"; |
11 local events_new = require "util.events".new; |
11 local events_new = require "util.events".new; |
|
12 local disco_items = require "util.multitable".new(); |
|
13 local NULL = {}; |
12 |
14 |
13 local uuid_gen = require "util.uuid".generate; |
15 local uuid_gen = require "util.uuid".generate; |
14 |
16 |
15 local log = require "util.logger".init("hostmanager"); |
17 local log = require "util.logger".init("hostmanager"); |
16 |
18 |
67 end |
69 end |
68 else -- component |
70 else -- component |
69 host_session.type = "component"; |
71 host_session.type = "component"; |
70 end |
72 end |
71 hosts[host] = host_session; |
73 hosts[host] = host_session; |
|
74 disco_items:set(host:match("%.(.*)") or "*", host, true); |
72 for option_name in pairs(host_config.core) do |
75 for option_name in pairs(host_config.core) do |
73 if option_name:match("_ports$") or option_name:match("_interface$") then |
76 if option_name:match("_ports$") or option_name:match("_interface$") then |
74 log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name); |
77 log("warn", "%s: Option '%s' has no effect for virtual hosts - put it in the server-wide section instead", host, option_name); |
75 end |
78 end |
76 end |
79 end |
117 modulemanager.unload(host, module); |
120 modulemanager.unload(host, module); |
118 end |
121 end |
119 end |
122 end |
120 |
123 |
121 hosts[host] = nil; |
124 hosts[host] = nil; |
|
125 disco_items:remove(host:match("%.(.*)") or "*", host); |
122 prosody_events.fire_event("host-deactivated", host); |
126 prosody_events.fire_event("host-deactivated", host); |
123 log("info", "Deactivated host: %s", host); |
127 log("info", "Deactivated host: %s", host); |
124 end |
128 end |
125 |
129 |
126 function getconfig(name) |
130 function get_children(host) |
|
131 return disco_items:get(host) or NULL; |
127 end |
132 end |
128 |
133 |
129 return _M; |
134 return _M; |