aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/mod_muc_mam.lua8
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";