15 local core_route_stanza = core_route_stanza; |
15 local core_route_stanza = core_route_stanza; |
16 local jid_split = require "util.jid".split; |
16 local jid_split = require "util.jid".split; |
17 local events_new = require "util.events".new; |
17 local events_new = require "util.events".new; |
18 local st = require "util.stanza"; |
18 local st = require "util.stanza"; |
19 local hosts = hosts; |
19 local hosts = hosts; |
|
20 local serialize = require "util.serialization".serialize |
20 |
21 |
21 local pairs, type, tostring = pairs, type, tostring; |
22 local pairs, type, tostring = pairs, type, tostring; |
22 |
23 |
23 local components = {}; |
24 local components = {}; |
24 |
25 |
73 end |
74 end |
74 if component then |
75 if component then |
75 log("debug", "%s stanza being handled by component: %s", stanza.name, host); |
76 log("debug", "%s stanza being handled by component: %s", stanza.name, host); |
76 component(origin, stanza, hosts[host]); |
77 component(origin, stanza, hosts[host]); |
77 else |
78 else |
78 log("error", "Component manager recieved a stanza for a non-existing component: " .. (stanza.attr.to or stanza)); |
79 log("error", "Component manager recieved a stanza for a non-existing component: " .. (stanza.attr.to or serialize(stanza))); |
79 end |
80 end |
80 end |
81 end |
81 |
82 |
82 function create_component(host, component) |
83 function create_component(host, component) |
83 -- TODO check for host well-formedness |
84 -- TODO check for host well-formedness |