--- a/mod_mam/mod_mam.lua Sun May 03 13:21:51 2015 +0200
+++ b/mod_mam/mod_mam.lua Sun May 03 13:34:23 2015 +0200
@@ -139,6 +139,8 @@
origin.send(st.reply(stanza))
local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to };
+ local results = {};
+
-- Wrap it in stuff and deliver
local first, last;
local count = 0;
@@ -163,8 +165,18 @@
if not first then first = id; end
last = id;
- origin.send(fwd_st);
+ if reverse then
+ results[count] = fwd_st;
+ else
+ origin.send(fwd_st);
+ end
end
+ if reverse then
+ for i = #results, 1, -1 do
+ origin.send(results[i]);
+ end
+ end
+
-- That's all folks!
module:log("debug", "Archive query %s completed", tostring(qid));