core/stanza_router.lua

changeset 274
9e68a697435d
parent 264
a296b61baad8
child 321
31fe15ce6fac
equal deleted inserted replaced
273:b4c6b124c06f 274:9e68a697435d
48 and not(stanza.name == "iq" and stanza.tags[1].name == "bind" 48 and not(stanza.name == "iq" and stanza.tags[1].name == "bind"
49 and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then 49 and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
50 error("Client MUST bind resource after auth"); 50 error("Client MUST bind resource after auth");
51 end 51 end
52 52
53 -- TODO also, stazas should be returned to their original state before the function ends 53 -- TODO also, stanzas should be returned to their original state before the function ends
54 if origin.type == "c2s" then 54 if origin.type == "c2s" then
55 stanza.attr.from = origin.full_jid; 55 stanza.attr.from = origin.full_jid;
56 end 56 end
57 local to = stanza.attr.to; 57 local to = stanza.attr.to;
58 local node, host, resource = jid_split(to); 58 local node, host, resource = jid_split(to);
86 component_handle_stanza(origin, stanza); 86 component_handle_stanza(origin, stanza);
87 elseif hosts[host] and hosts[host].type == "component" then -- directed at a component 87 elseif hosts[host] and hosts[host].type == "component" then -- directed at a component
88 component_handle_stanza(origin, stanza); 88 component_handle_stanza(origin, stanza);
89 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then 89 elseif origin.type == "c2s" and stanza.name == "presence" and stanza.attr.type ~= nil and stanza.attr.type ~= "unavailable" then
90 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare); 90 handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_bare, to_bare);
91 elseif stanza.name == "iq" and not resource then -- directed at bare JID 91 elseif origin.type ~= "c2s" and stanza.name == "iq" and not resource then -- directed at bare JID
92 core_handle_stanza(origin, stanza); 92 core_handle_stanza(origin, stanza);
93 else 93 else
94 core_route_stanza(origin, stanza); 94 core_route_stanza(origin, stanza);
95 end 95 end
96 else 96 else

mercurial