Software /
code /
prosody-modules
Changeset
1685:cd87a2eba8f2
mod_mam: Reverse the order of reversed queries back to chronological order
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 03 May 2015 13:34:23 +0200 |
parents | 1684:838150167871 |
children | 1689:06f9ab0c078c |
files | mod_mam/mod_mam.lua |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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));