Software /
code /
prosody
Comparison
plugins/mod_mam/mod_mam.lua @ 12860:38b3cd292ee5
Merge 0.12->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 21 Jan 2023 17:18:16 +0100 |
parent | 12630:781772c8b6d9 |
parent | 12857:cc86d77481fc |
child | 12977:74b9e05af71e |
comparison
equal
deleted
inserted
replaced
12856:89bc598c7051 | 12860:38b3cd292ee5 |
---|---|
140 | 140 |
141 -- RSM stuff | 141 -- RSM stuff |
142 local qset = rsm.get(query); | 142 local qset = rsm.get(query); |
143 local qmax = m_min(qset and qset.max or default_max_items, max_max_items); | 143 local qmax = m_min(qset and qset.max or default_max_items, max_max_items); |
144 local reverse = qset and qset.before or false; | 144 local reverse = qset and qset.before or false; |
145 | |
145 local before, after = qset and qset.before or qbefore, qset and qset.after or qafter; | 146 local before, after = qset and qset.before or qbefore, qset and qset.after or qafter; |
146 if type(before) ~= "string" then before = nil; end | 147 if type(before) ~= "string" then before = nil; end |
147 | 148 |
149 -- A reverse query needs to be flipped | |
150 local flip = reverse; | |
151 -- A flip-page query needs to be the opposite of that. | |
152 if query:get_child("flip-page") then flip = not flip end | |
148 | 153 |
149 module:log("debug", "Archive query by %s id=%s with=%s when=%s...%s rsm=%q", | 154 module:log("debug", "Archive query by %s id=%s with=%s when=%s...%s rsm=%q", |
150 origin.username, | 155 origin.username, |
151 qid or stanza.attr.id, | 156 qid or stanza.attr.id, |
152 qwith or "*", | 157 qwith or "*", |
153 qstart and timestamp(qstart) or "", | 158 qstart and timestamp(qstart) or "", |
154 qend and timestamp(qend) or "", | 159 qend and timestamp(qend) or "", |
155 qset); | 160 qset); |
156 | |
157 -- A reverse query needs to be flipped | |
158 local flip = reverse; | |
159 -- A flip-page query needs to be the opposite of that. | |
160 if query:get_child("flip-page") then flip = not flip end | |
161 | 161 |
162 -- Load all the data! | 162 -- Load all the data! |
163 local data, err = archive:find(origin.username, { | 163 local data, err = archive:find(origin.username, { |
164 start = qstart; ["end"] = qend; -- Time range | 164 start = qstart; ["end"] = qend; -- Time range |
165 with = qwith; | 165 with = qwith; |