core/stanza_router.lua

changeset 1900
93a94ec05ebe
parent 1887
e3c790060c03
parent 1899
ccb7d9ccbf24
child 1971
91420df04d5b
equal deleted inserted replaced
1896:e7ac9be5c90c 1900:93a94ec05ebe
24 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end 24 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end
25 25
26 -- TODO verify validity of stanza (as well as JID validity) 26 -- TODO verify validity of stanza (as well as JID validity)
27 if stanza.attr.type == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log 27 if stanza.attr.type == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log
28 if stanza.name == "iq" then 28 if stanza.name == "iq" then
29 if (stanza.attr.type == "set" or stanza.attr.type == "get") and #stanza.tags ~= 1 then 29 local can_reply = stanza.attr.type == "set" or stanza.attr.type == "get"
30 local missing_id = not stanza.attr.id;
31 if can_reply and (#stanza.tags ~= 1 or missing_id) then
30 origin.send(st.error_reply(stanza, "modify", "bad-request")); 32 origin.send(st.error_reply(stanza, "modify", "bad-request"));
33 return;
34 elseif missing_id then
31 return; 35 return;
32 end 36 end
33 end 37 end
34 38
35 if origin.type == "c2s" then 39 if origin.type == "c2s" then

mercurial