core/stanza_router.lua

changeset 236
eb4ac201aad2
parent 234
7c8313e055fb
child 237
c1e9b3f3f3a7
equal deleted inserted replaced
233:23585c323daa 236:eb4ac201aad2
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

mercurial