aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_mam/mod_mam.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 383ed162..d4dae6cc 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -238,6 +238,7 @@ local function message_handler(event, c2s)
log("debug", "Not archiving stanza: %s (type)", stanza:top_tag());
return;
end
+
-- or if hints suggest we shouldn't
if stanza:get_child("no-permanent-storage", "urn:xmpp:hints") -- The XEP needs to decide on "store" or "storage"
or stanza:get_child("no-permanent-store", "urn:xmpp:hints")
@@ -291,14 +292,20 @@ if cleanup_after ~= "never" then
return false;
end
+ -- Set of known users to do message expiry for
+ -- Populated either below or when new messages are added
cleanup = {};
+ -- Iterating over users is not supported by all authentication modules
+ -- Catch and ignore error if not supported
pcall(function ()
+ -- If this works, then we schedule cleanup for all known known
for user in um.users(module.host) do
cleanup[user] = true;
end
end);
+ -- At odd intervals, delete old messages for one user
module:add_timer(math.random(10, 60), function()
local user = next(cleanup);
if user then