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 |