+end
+
+local iq_types = { set=true, get=true, result=true, error=true };
+function core_process_stanza(origin, stanza)
+ (origin.log or log)("debug", "Received[%s]: %s", origin.type, stanza:top_tag())
+
+ 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 iq_types[st_type] or ((st_type == "set" or st_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;
+ end
+ end