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