diff options
author | Kim Alvefur <zash@zash.se> | 2018-04-28 00:44:28 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-04-28 00:44:28 +0200 |
commit | de89c2de1119f9b82953690fada3d86464216dca (patch) | |
tree | 367c15de5b9b794382d6a3cfc18f0c39aa1e1390 /plugins/mod_muc_mam.lua | |
parent | 07c3d8b47c06448fab5ae49f5b70ab4e48385ffc (diff) | |
download | prosody-de89c2de1119f9b82953690fada3d86464216dca.tar.gz prosody-de89c2de1119f9b82953690fada3d86464216dca.zip |
mod_muc_mam: Tweak calculation of max history to retrieve
Diffstat (limited to 'plugins/mod_muc_mam.lua')
-rw-r--r-- | plugins/mod_muc_mam.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua index bf3cae45..de59641c 100644 --- a/plugins/mod_muc_mam.lua +++ b/plugins/mod_muc_mam.lua @@ -241,14 +241,18 @@ module:hook("muc-get-history", function (event) local room = event.room; if not archiving_enabled(room) then return end local room_jid = room.jid; - local maxstanzas = event.maxstanzas or math.huge; + local maxstanzas = event.maxstanzas; local maxchars = event.maxchars; local since = event.since; local to = event.to; + if not maxstanzas or maxstanzas > get_historylength(room) then + maxstanzas = get_historylength(room); + end + -- Load all the data! local query = { - limit = math.min(maxstanzas, get_historylength(room)); + limit = maxstanzas; start = since; reverse = true; with = "message<groupchat"; |