- -- 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 (stanza.attr.type == "set" or stanza.attr.type == "get") and (#stanza.tags ~= 1) then
- origin.send(st.error_reply(stanza, "modify", "bad-request"));
+local valid_stanzas = { message = true, presence = true, iq = true };
+local function handle_unhandled_stanza(host, origin, stanza) --luacheck: ignore 212/host
+ local name, xmlns, origin_type = stanza.name, stanza.attr.xmlns or "jabber:client", origin.type;
+ if xmlns == "jabber:client" and valid_stanzas[name] then
+ -- A normal stanza
+ local st_type = stanza.attr.type;
+ if st_type == "error" or (name == "iq" and st_type == "result") then
+ log("debug", "Discarding %s from %s of type: %s", name, origin_type, st_type or '<nil>');