aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/history.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-07-19 17:07:59 +0200
committerKim Alvefur <zash@zash.se>2021-07-19 17:07:59 +0200
commit20d3403a84f1fe42f6dfcc1bbe80ede8432e8f85 (patch)
treea28e25db240a242e1d5229c2d340d39a04b0f465 /plugins/muc/history.lib.lua
parent07ef92dbd8e01a3ad2f20fc085a7b974ff6bfeb4 (diff)
downloadprosody-20d3403a84f1fe42f6dfcc1bbe80ede8432e8f85.tar.gz
prosody-20d3403a84f1fe42f6dfcc1bbe80ede8432e8f85.zip
MUC: Skip adding to history when it's set to zero
Optimizes away all the processing on every message in case the end-result is zero history.
Diffstat (limited to 'plugins/muc/history.lib.lua')
-rw-r--r--plugins/muc/history.lib.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua
index fdf65365..075b1890 100644
--- a/plugins/muc/history.lib.lua
+++ b/plugins/muc/history.lib.lua
@@ -173,6 +173,10 @@ end, 50); -- Before subject(20)
-- add to history
module:hook("muc-add-history", function(event)
local room = event.room
+ if get_historylength(room) == 0 then
+ room._history = nil;
+ return;
+ end
local history = room._history;
if not history then history = {}; room._history = history; end
local stanza = st.clone(event.stanza);