Comparison

plugins/mod_muc_mam.lua @ 11817:a67b4d4f8eef

mod_muc_mam: Merge main and RSM-specific log message into a single one
author Kim Alvefur <zash@zash.se>
date Thu, 23 Sep 2021 15:53:39 +0200
parent 11816:eff0eeece24d
child 11818:c443abff04d8
comparison
equal deleted inserted replaced
11816:eff0eeece24d 11817:a67b4d4f8eef
173 return true; 173 return true;
174 end 174 end
175 qstart, qend = vstart, vend; 175 qstart, qend = vstart, vend;
176 end 176 end
177 177
178 module:log("debug", "Archive query by %s id=%s when=%s...%s",
179 from,
180 qid or stanza.attr.id,
181 qstart and timestamp(qstart) or "",
182 qend and timestamp(qend) or "");
183
184 -- RSM stuff 178 -- RSM stuff
185 local qset = rsm.get(query); 179 local qset = rsm.get(query);
186 local qmax = m_min(qset and qset.max or default_max_items, max_max_items); 180 local qmax = m_min(qset and qset.max or default_max_items, max_max_items);
187 local reverse = qset and qset.before or false; 181 local reverse = qset and qset.before or false;
188 182
189 local before, after = qset and qset.before or qbefore, qset and qset.after or qafter; 183 local before, after = qset and qset.before or qbefore, qset and qset.after or qafter;
190 if type(before) ~= "string" then before = nil; end 184 if type(before) ~= "string" then before = nil; end
191 if qset then
192 module:log("debug", "Archive query id=%s rsm=%q", qid or stanza.attr.id, qset);
193 end
194 -- A reverse query needs to be flipped 185 -- A reverse query needs to be flipped
195 local flip = reverse; 186 local flip = reverse;
196 -- A flip-page query needs to be the opposite of that. 187 -- A flip-page query needs to be the opposite of that.
197 if query:get_child("flip-page") then flip = not flip end 188 if query:get_child("flip-page") then flip = not flip end
189
190 module:log("debug", "Archive query by %s id=%s when=%s...%s rsm=%q",
191 from,
192 qid or stanza.attr.id,
193 qstart and timestamp(qstart) or "",
194 qend and timestamp(qend) or "",
195 qset);
198 196
199 -- Load all the data! 197 -- Load all the data!
200 local data, err = archive:find(room_node, { 198 local data, err = archive:find(room_node, {
201 start = qstart; ["end"] = qend; -- Time range 199 start = qstart; ["end"] = qend; -- Time range
202 limit = qmax + 1; 200 limit = qmax + 1;