# HG changeset patch # User Kim Alvefur # Date 1579913723 -3600 # Node ID 29c39876c4afe20f5f64248f18decd8eac913c10 # Parent 8752e5b5dd0803859d238fd5f508e9dea1603625 mod_rest: Ensure iq responses have type result if they're not errors diff -r 8752e5b5dd08 -r 29c39876c4af mod_rest/mod_rest.lua --- a/mod_rest/mod_rest.lua Sat Jan 25 01:31:49 2020 +0100 +++ b/mod_rest/mod_rest.lua Sat Jan 25 01:55:23 2020 +0100 @@ -229,8 +229,14 @@ if parsed.name == "message" and parsed.attr.type == "groupchat" then parsed.attr.to = jid.bare(stanza.attr.from); end - if parsed.name == "iq" or parsed.attr.type == "error" then + if not stanza.attr.type and parsed:get_child("error") then + parsed.attr.type = "error"; + end + if parsed.attr.type == "error" then parsed.attr.id = stanza.attr.id; + elseif parsed.name == "iq" then + parsed.attr.id = stanza.attr.id; + parsed.attr.type = "result"; end reply = parsed; end