Software /
code /
prosody-modules
Comparison
mod_mam_muc/mod_mam_muc.lua @ 2831:d65868fed77a
mod_mam_muc: Copy max_archive_query_results option from mod_mam
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 18 Nov 2017 00:46:44 +0100 |
parent | 2723:ec02ee02a04b |
child | 2832:15a9d508c5f7 |
comparison
equal
deleted
inserted
replaced
2830:92f6f82397c9 | 2831:d65868fed77a |
---|---|
39 local is_stanza = st.is_stanza; | 39 local is_stanza = st.is_stanza; |
40 local tostring = tostring; | 40 local tostring = tostring; |
41 local time_now = os.time; | 41 local time_now = os.time; |
42 local m_min = math.min; | 42 local m_min = math.min; |
43 local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse; | 43 local timestamp, timestamp_parse = require "util.datetime".datetime, require "util.datetime".parse; |
44 local default_max_items, max_max_items = 20, module:get_option_number("max_archive_query_results", 50); | |
44 | 45 |
45 local default_history_length = 20; | 46 local default_history_length = 20; |
46 local max_history_length = module:get_option_number("max_history_messages", math.huge); | 47 local max_history_length = module:get_option_number("max_history_messages", math.huge); |
47 | 48 |
48 local function get_historylength(room) | 49 local function get_historylength(room) |
209 qstart and timestamp(qstart) or "the dawn of time", | 210 qstart and timestamp(qstart) or "the dawn of time", |
210 qend and timestamp(qend) or "now"); | 211 qend and timestamp(qend) or "now"); |
211 | 212 |
212 -- RSM stuff | 213 -- RSM stuff |
213 local qset = rsm.get(query); | 214 local qset = rsm.get(query); |
214 local qmax = m_min(qset and qset.max or 20, 20); | 215 local qmax = m_min(qset and qset.max or default_max_items, max_max_items); |
215 local reverse = qset and qset.before or false; | 216 local reverse = qset and qset.before or false; |
216 | 217 |
217 local before, after = qset and qset.before, qset and qset.after; | 218 local before, after = qset and qset.before, qset and qset.after; |
218 if type(before) ~= "string" then before = nil; end | 219 if type(before) ~= "string" then before = nil; end |
219 | 220 |