Comparison

core/stanza_router.lua @ 222:6153462397d8

Redirecting all stanzas not from origin of type s2sin and c2s to core_handle_stanza
author Waqas Hussain <waqas20@gmail.com>
date Sat, 08 Nov 2008 05:06:22 +0500
parent 221:641dbdf3b751
child 223:d5dffc919b33
comparison
equal deleted inserted replaced
221:641dbdf3b751 222:6153462397d8
69 log("warn", "stanza recieved for a non-local server"); 69 log("warn", "stanza recieved for a non-local server");
70 return; -- FIXME what should we do here? 70 return; -- FIXME what should we do here?
71 end]] -- FIXME 71 end]] -- FIXME
72 72
73 -- FIXME do stanzas not of jabber:client get handled by components? 73 -- FIXME do stanzas not of jabber:client get handled by components?
74 if not to then 74 if origin.type == "s2sin" or origin.type == "c2s" then
75 if not to then
76 core_handle_stanza(origin, stanza);
77 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server
78 core_handle_stanza(origin, stanza);
79 elseif stanza.attr.xmlns and stanza.attr.xmlns ~= "jabber:client" and stanza.attr.xmlns ~= "jabber:server" then
80 modules_handle_stanza(origin, stanza);
81 elseif hosts[to_bare] and hosts[to_bare].type == "component" then -- hack to allow components to handle node@server
82 component_handle_stanza(origin, stanza);
83 elseif hosts[to] and hosts[to].type == "component" then -- hack to allow components to handle node@server/resource and server/resource
84 component_handle_stanza(origin, stanza);
85 elseif hosts[host] and hosts[host].type == "component" then -- directed at a component
86 component_handle_stanza(origin, stanza);
87 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
88 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare);
89 elseif stanza.name == "iq" and not resource then -- directed at bare JID
90 core_handle_stanza(origin, stanza);
91 else
92 core_route_stanza(origin, stanza);
93 end
94 else
75 core_handle_stanza(origin, stanza); 95 core_handle_stanza(origin, stanza);
76 elseif hosts[to] and hosts[to].type == "local" then -- directed at a local server
77 core_handle_stanza(origin, stanza);
78 elseif stanza.attr.xmlns and stanza.attr.xmlns ~= "jabber:client" and stanza.attr.xmlns ~= "jabber:server" then
79 modules_handle_stanza(origin, stanza);
80 elseif hosts[to_bare] and hosts[to_bare].type == "component" then -- hack to allow components to handle node@server
81 component_handle_stanza(origin, stanza);
82 elseif hosts[to] and hosts[to].type == "component" then -- hack to allow components to handle node@server/resource and server/resource
83 component_handle_stanza(origin, stanza);
84 elseif hosts[host] and hosts[host].type == "component" then -- directed at a component
85 component_handle_stanza(origin, stanza);
86 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
87 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare);
88 elseif stanza.name == "iq" and not resource then -- directed at bare JID
89 core_handle_stanza(origin, stanza);
90 elseif origin.type == "c2s" or origin.type == "s2sin" then
91 core_route_stanza(origin, stanza);
92 else
93 log("warn", "stanza not processed");
94 end 96 end
95 end 97 end
96 98
97 -- This function handles stanzas which are not routed any further, 99 -- This function handles stanzas which are not routed any further,
98 -- that is, they are handled by this server 100 -- that is, they are handled by this server