# HG changeset patch # User Kim Alvefur # Date 1632868004 -7200 # Node ID a8af632daf4815073e3dbf4fae88e0d3499bbfec # Parent 4157773ed4d3e05b4c862e9fcce121edc6c904ff mod_rest: Support returning multiple replies in an container Allows retrieving MAM results and possibly other things. diff -r 4157773ed4d3 -r a8af632daf48 mod_rest/mod_rest.lua --- a/mod_rest/mod_rest.lua Sat Sep 25 11:43:31 2021 +0000 +++ b/mod_rest/mod_rest.lua Wed Sep 29 00:26:44 2021 +0200 @@ -293,8 +293,9 @@ end if payload.name == "iq" then + local responses = st.stanza("xmpp"); function origin.send(stanza) - module:send(stanza); + responses:add_direct_child(stanza); end if payload.attr.type ~= "get" and payload.attr.type ~= "set" then @@ -307,6 +308,9 @@ function (result) module:log("debug", "Sending[rest]: %s", result.stanza:top_tag()); response.headers.content_type = send_type; + if responses[2] then + return encode(send_type, responses); + end return encode(send_type, result.stanza); end, function (error)