Comparison

core/componentmanager.lua @ 3586:78ed7ad330ab

componentmanager, stanza_router: Get rid of componentmanager.handle_stanza().
author Waqas Hussain <waqas20@gmail.com>
date Wed, 10 Nov 2010 02:51:36 +0500
parent 3584:5d880c365dd4
child 3587:d94aacb2771a
comparison
equal deleted inserted replaced
3585:c8ce9923c315 3586:78ed7ad330ab
53 end 53 end
54 end 54 end
55 55
56 if prosody and prosody.events then 56 if prosody and prosody.events then
57 prosody.events.add_handler("server-starting", load_enabled_components); 57 prosody.events.add_handler("server-starting", load_enabled_components);
58 end
59
60 function handle_stanza(origin, stanza)
61 local node, host = jid_split(stanza.attr.to);
62 local component = nil;
63 if host then
64 if node then component = components[node.."@"..host]; end -- hack to allow hooking node@server
65 if not component then component = components[host]; end
66 end
67 if component then
68 log("debug", "%s stanza being handled by component: %s", stanza.name, host);
69 component(origin, stanza, hosts[host]);
70 else
71 log("error", "Component manager recieved a stanza for a non-existing component: "..tostring(stanza));
72 default_component_handler(origin, stanza);
73 end
74 end 58 end
75 59
76 function create_component(host, component, events) 60 function create_component(host, component, events)
77 -- TODO check for host well-formedness 61 -- TODO check for host well-formedness
78 return { type = "component", host = host, connected = true, s2sout = {}, 62 return { type = "component", host = host, connected = true, s2sout = {},