aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-04-27 15:26:29 +0200
committerKim Alvefur <zash@zash.se>2018-04-27 15:26:29 +0200
commitd37e36dce4818b44a4d95acb74e0d91ab4f62b4d (patch)
treeece014b2e1dd941ea2c894ccd8ecdbad4fbc4cea
parentee8969e246406c99914365ea866ca60147c1117d (diff)
downloadprosody-d37e36dce4818b44a4d95acb74e0d91ab4f62b4d.tar.gz
prosody-d37e36dce4818b44a4d95acb74e0d91ab4f62b4d.zip
mod_muc_mam: Skip fetching history if built-in recent history is enough
-rw-r--r--plugins/mod_muc_mam.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index 8c5ea2aa..7e6c9838 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -254,6 +254,10 @@ module:hook("muc-get-history", function (event)
maxstanzas = get_historylength(room);
end
+ if room._history and #room._history >= maxstanzas then
+ return -- It can deal with this itself
+ end
+
-- Load all the data!
local query = {
limit = maxstanzas;