Software /
code /
prosody-modules
Comparison
mod_mam_muc/mod_mam_muc.lua @ 2720:454d038df9b4
mod_mam_muc: Remove fetching of total message counts (potentially very slow and only supported by SQL)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 23 Jun 2017 13:54:40 +0200 |
parent | 2719:7568157bf998 |
child | 2721:391c508e0b75 |
comparison
equal
deleted
inserted
replaced
2719:7568157bf998 | 2720:454d038df9b4 |
---|---|
220 local data, err = archive:find(room_node, { | 220 local data, err = archive:find(room_node, { |
221 start = qstart; ["end"] = qend; -- Time range | 221 start = qstart; ["end"] = qend; -- Time range |
222 limit = qmax + 1; | 222 limit = qmax + 1; |
223 before = before; after = after; | 223 before = before; after = after; |
224 reverse = reverse; | 224 reverse = reverse; |
225 total = true; | |
226 with = "message<groupchat"; | 225 with = "message<groupchat"; |
227 }); | 226 }); |
228 | 227 |
229 if not data then | 228 if not data then |
230 origin.send(st.error_reply(stanza, "cancel", "internal-server-error")); | 229 origin.send(st.error_reply(stanza, "cancel", "internal-server-error")); |
231 return true; | 230 return true; |
232 end | 231 end |
233 local total = tonumber(err); | |
234 | 232 |
235 local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to }; | 233 local msg_reply_attr = { to = stanza.attr.from, from = stanza.attr.to }; |
236 | 234 |
237 local results = {}; | 235 local results = {}; |
238 | 236 |
278 module:log("debug", "Archive query %s completed", tostring(qid)); | 276 module:log("debug", "Archive query %s completed", tostring(qid)); |
279 | 277 |
280 origin.send(st.reply(stanza) | 278 origin.send(st.reply(stanza) |
281 :tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete }) | 279 :tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete }) |
282 :add_child(rsm.generate { | 280 :add_child(rsm.generate { |
283 first = first, last = last, count = total })); | 281 first = first, last = last })); |
284 return true; | 282 return true; |
285 end); | 283 end); |
286 | 284 |
287 module:hook("muc-get-history", function (event) | 285 module:hook("muc-get-history", function (event) |
288 local room = event.room; | 286 local room = event.room; |