Comparison

core/stanza_router.lua @ 279:76bad8b64018

Merging.
author Tobias Markmann <tm@ayena.de>
date Mon, 10 Nov 2008 16:29:19 +0100
parent 237:c1e9b3f3f3a7
child 249:1fc47cf5d144
comparison
equal deleted inserted replaced
278:770a78cd38d7 279:76bad8b64018
31 local print = print; 31 local print = print;
32 32
33 function core_process_stanza(origin, stanza) 33 function core_process_stanza(origin, stanza)
34 log("debug", "Received["..origin.type.."]: "..tostring(st.reply(st.reply(stanza)))) 34 log("debug", "Received["..origin.type.."]: "..tostring(st.reply(st.reply(stanza))))
35 35
36 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end -- FIXME Hack. This should be removed when we fix namespace handling.
36 -- TODO verify validity of stanza (as well as JID validity) 37 -- TODO verify validity of stanza (as well as JID validity)
37 if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then 38 if stanza.name == "iq" and not(#stanza.tags == 1 and stanza.tags[1].attr.xmlns) then
38 if stanza.attr.type == "set" or stanza.attr.type == "get" then 39 if stanza.attr.type == "set" or stanza.attr.type == "get" then
39 error("Invalid IQ"); 40 error("Invalid IQ");
40 elseif #stanza.tags > 1 and not(stanza.attr.type == "error" or stanza.attr.type == "result") then 41 elseif #stanza.tags > 1 and not(stanza.attr.type == "error" or stanza.attr.type == "result") then
325 recipients = {session}; 326 recipients = {session};
326 elseif p == priority then 327 elseif p == priority then
327 t_insert(recipients, session); 328 t_insert(recipients, session);
328 end 329 end
329 end 330 end
330 for _, session in pairs(recipient) do 331 for _, session in pairs(recipients) do
331 session.send(stanza); 332 session.send(stanza);
332 end 333 end
333 else 334 else
334 -- TODO send IQ error 335 -- TODO send IQ error
335 end 336 end