Software /
code /
prosody
Changeset
8783:79133eca0656
mod_muc_mam: Tweak calculation of max history to retrieve
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 28 Apr 2018 00:44:28 +0200 (2018-04-27) |
parents | 8782:daa518a22c34 |
children | 8784:64b78e3deb96 |
files | plugins/mod_muc_mam.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_muc_mam.lua Mon Apr 30 18:08:09 2018 +0100 +++ b/plugins/mod_muc_mam.lua Sat Apr 28 00:44:28 2018 +0200 @@ -241,14 +241,18 @@ 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";