aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-01-21 17:18:16 +0100
committerKim Alvefur <zash@zash.se>2023-01-21 17:18:16 +0100
commitdbbde4a0f0f4d266d87aed950c17857510148fff (patch)
tree9c32e4fcbe5a9d1128efb0b3e4f60f8d36c23358 /plugins/mod_mam
parent2a5953f569ae40b3a20498d51336323dd2d54136 (diff)
parent81fd03356fbb451c5a7089a2520ebb7fbf6caf30 (diff)
downloadprosody-dbbde4a0f0f4d266d87aed950c17857510148fff.tar.gz
prosody-dbbde4a0f0f4d266d87aed950c17857510148fff.zip
Merge 0.12->trunk
Diffstat (limited to 'plugins/mod_mam')
-rw-r--r--plugins/mod_mam/mod_mam.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 4d830332..a726746c 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -142,9 +142,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,
@@ -154,11 +159,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