core/componentmanager.lua

changeset 610
d98106902f74
parent 519
cccd610a0ef9
child 615
4ae3e81513f3
equal deleted inserted replaced
609:64849cfa9869 610:d98106902f74
18 -- 18 --
19 19
20 20
21 21
22 22
23 local log = require "util.logger".init("componentmanager") 23 local log = require "util.logger".init("componentmanager");
24 local module_load = require "core.modulemanager".load;
24 local jid_split = require "util.jid".split; 25 local jid_split = require "util.jid".split;
25 local hosts = hosts; 26 local hosts = hosts;
26 27
27 local components = {}; 28 local components = {};
28 29
43 44
44 function register_component(host, component) 45 function register_component(host, component)
45 if not hosts[host] then 46 if not hosts[host] then
46 -- TODO check for host well-formedness 47 -- TODO check for host well-formedness
47 components[host] = component; 48 components[host] = component;
48 hosts[host] = {type = "component", host = host, connected = true, s2sout = {} }; 49 hosts[host] = { type = "component", host = host, connected = true, s2sout = {} };
50 -- FIXME only load for a.b.c if b.c has dialback, and/or check in config
51 module_load(host, "dialback");
49 log("debug", "component added: "..host); 52 log("debug", "component added: "..host);
50 return hosts[host]; 53 return hosts[host];
51 else 54 else
52 log("error", "Attempt to set component for existing host: "..host); 55 log("error", "Attempt to set component for existing host: "..host);
53 end 56 end

mercurial