core/stanza_router.lua

changeset 3998
13a5a8df7c34
parent 3586
78ed7ad330ab
equal deleted inserted replaced
3997:ed70d20fc133 3998:13a5a8df7c34
27 else 27 else
28 log("debug", "Discarding %s from %s of type: %s", name, origin_type, stanza.attr.type); 28 log("debug", "Discarding %s from %s of type: %s", name, origin_type, stanza.attr.type);
29 return true; 29 return true;
30 end 30 end
31 end 31 end
32 if stanza.attr.xmlns == nil then 32 if not stanza.attr.xmlns then
33 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it 33 log("debug", "Unhandled %s stanza: %s; xmlns=%s", origin.type, stanza.name, xmlns); -- we didn't handle it
34 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then 34 if stanza.attr.type ~= "error" and stanza.attr.type ~= "result" then
35 origin.send(st.error_reply(stanza, "cancel", "service-unavailable")); 35 origin.send(st.error_reply(stanza, "cancel", "service-unavailable"));
36 end 36 end
37 elseif not((name == "features" or name == "error") and xmlns == "http://etherx.jabber.org/streams") then -- FIXME remove check once we handle S2S features 37 elseif not((name == "features" or name == "error") and xmlns == "http://etherx.jabber.org/streams") then -- FIXME remove check once we handle S2S features
107 --[[if to and not(hosts[to]) and not(hosts[to_bare]) and (hosts[host] and hosts[host].type ~= "local") then -- not for us? 107 --[[if to and not(hosts[to]) and not(hosts[to_bare]) and (hosts[host] and hosts[host].type ~= "local") then -- not for us?
108 log("warn", "stanza recieved for a non-local server"); 108 log("warn", "stanza recieved for a non-local server");
109 return; -- FIXME what should we do here? 109 return; -- FIXME what should we do here?
110 end]] -- FIXME 110 end]] -- FIXME
111 111
112 if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and xmlns == nil then 112 if (origin.type == "s2sin" or origin.type == "c2s" or origin.type == "component") and not xmlns then
113 if origin.type == "s2sin" and not origin.dummy then 113 if origin.type == "s2sin" and not origin.dummy then
114 local host_status = origin.hosts[from_host]; 114 local host_status = origin.hosts[from_host];
115 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server? 115 if not host_status or not host_status.authed then -- remote server trying to impersonate some other server?
116 log("warn", "Received a stanza claiming to be from %s, over a stream authed for %s!", from_host, origin.from_host); 116 log("warn", "Received a stanza claiming to be from %s, over a stream authed for %s!", from_host, origin.from_host);
117 return; -- FIXME what should we do here? does this work with subdomains? 117 return; -- FIXME what should we do here? does this work with subdomains?
120 core_post_stanza(origin, stanza, origin.full_jid); 120 core_post_stanza(origin, stanza, origin.full_jid);
121 else 121 else
122 local h = hosts[stanza.attr.to or origin.host or origin.to_host]; 122 local h = hosts[stanza.attr.to or origin.host or origin.to_host];
123 if h then 123 if h then
124 local event; 124 local event;
125 if xmlns == nil then 125 if not xmlns then
126 if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") then 126 if stanza.name == "iq" and (stanza.attr.type == "set" or stanza.attr.type == "get") then
127 event = "stanza/iq/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name; 127 event = "stanza/iq/"..stanza.tags[1].attr.xmlns..":"..stanza.tags[1].name;
128 else 128 else
129 event = "stanza/"..stanza.name; 129 event = "stanza/"..stanza.name;
130 end 130 end

mercurial