core/stanza_router.lua

changeset 1985
9b352c8a32e6
parent 1971
91420df04d5b
child 2132
20a52cfda988
child 2833
a82bd02d5918
equal deleted inserted replaced
1983:1f49d778bd98 1985:9b352c8a32e6
27 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end 27 if not stanza.attr.xmlns then stanza.attr.xmlns = "jabber:client"; end
28 28
29 -- TODO verify validity of stanza (as well as JID validity) 29 -- TODO verify validity of stanza (as well as JID validity)
30 if stanza.attr.type == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log 30 if stanza.attr.type == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log
31 if stanza.name == "iq" then 31 if stanza.name == "iq" then
32 local can_reply = stanza.attr.type == "set" or stanza.attr.type == "get" 32 if not stanza.attr.id then stanza.attr.id = ""; end -- COMPAT Jabiru doesn't send the id attribute on roster requests
33 local missing_id = not stanza.attr.id; 33 if (stanza.attr.type == "set" or stanza.attr.type == "get") and (#stanza.tags ~= 1) then
34 if can_reply and (#stanza.tags ~= 1 or missing_id) then
35 origin.send(st.error_reply(stanza, "modify", "bad-request")); 34 origin.send(st.error_reply(stanza, "modify", "bad-request"));
36 return;
37 elseif missing_id then
38 return; 35 return;
39 end 36 end
40 end 37 end
41 38
42 if origin.type == "c2s" then 39 if origin.type == "c2s" then

mercurial