- -- TODO verify validity of stanza (as well as JID validity)
- if stanza.attr.type == "error" and #stanza.tags == 0 then return; end -- TODO invalid stanza, log
- if stanza.name == "iq" then
- if not stanza.attr.id then stanza.attr.id = ""; end -- COMPAT Jabiru doesn't send the id attribute on roster requests
- if not iq_types[stanza.attr.type] or ((stanza.attr.type == "set" or stanza.attr.type == "get") and (#stanza.tags ~= 1)) then
- origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children"));
- return;
+ if origin.type == "c2s" and not stanza.attr.xmlns then
+ local name, st_type = stanza.name, stanza.attr.type;
+ if st_type == "error" and #stanza.tags == 0 then
+ return handle_unhandled_stanza(origin.host, origin, stanza);
+ end
+ if name == "iq" then
+ if not stanza.attr.id then stanza.attr.id = ""; end -- COMPAT Jabiru doesn't send the id attribute on roster requests
+ if not iq_types[st_type] or (st_type ~= "result" and #stanza.tags ~= 1) then
+ origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children"));
+ return;
+ end