diff options
author | Kim Alvefur <zash@zash.se> | 2023-01-21 16:54:43 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-01-21 16:54:43 +0100 |
commit | 4830568435f6f07e3c3241861cc901adc6b53977 (patch) | |
tree | 1878faf97776d9bfda2655c347aef798569d07e4 /plugins/mod_mam/mod_mam.lua | |
parent | 67b6440d9ba5c66fc1f7e51df911540c33177138 (diff) | |
download | prosody-4830568435f6f07e3c3241861cc901adc6b53977.tar.gz prosody-4830568435f6f07e3c3241861cc901adc6b53977.zip |
mod_mam,mod_muc_mam: Minimize differences (reorder, copy some comments)
Should have no functional difference, but makes it easier keeping
mod_mam and mod_muc_mam in sync.
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-rw-r--r-- | plugins/mod_mam/mod_mam.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index 50095e2f..bebee812 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -138,9 +138,14 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event) local qset = rsm.get(query); local qmax = m_min(qset and qset.max or default_max_items, max_max_items); local reverse = qset and qset.before or false; + local before, after = qset and qset.before or qbefore, qset and qset.after or qafter; if type(before) ~= "string" then before = nil; end + -- A reverse query needs to be flipped + local flip = reverse; + -- A flip-page query needs to be the opposite of that. + if query:get_child("flip-page") then flip = not flip end module:log("debug", "Archive query by %s id=%s with=%s when=%s...%s rsm=%q", origin.username, @@ -150,11 +155,6 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event) qend and timestamp(qend) or "", qset); - -- A reverse query needs to be flipped - local flip = reverse; - -- A flip-page query needs to be the opposite of that. - if query:get_child("flip-page") then flip = not flip end - -- Load all the data! local data, err = archive:find(origin.username, { start = qstart; ["end"] = qend; -- Time range |