aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam/mod_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-08-31 11:38:09 +0200
committerKim Alvefur <zash@zash.se>2021-08-31 11:38:09 +0200
commit9eb707763c5b867b30f805f40eb979bf04001afc (patch)
tree84517c9a264201006ba0eaff82e56f63a9b62fc3 /plugins/mod_mam/mod_mam.lua
parentb430cda5c7c87b20ae26b1d78b61be0ae0013241 (diff)
downloadprosody-9eb707763c5b867b30f805f40eb979bf04001afc.tar.gz
prosody-9eb707763c5b867b30f805f40eb979bf04001afc.zip
mod_mam: Suppress offline message broadcast for MAM clients
MattJ on 09:34:24 > Zash: I think as a first step, offline messages should not be sent to > clients that request MAM https://chat.modernxmpp.org/log/modernxmpp/2021-08-31#2021-08-31-8518a542bd283686
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-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 50401aa1..f0f8c4ec 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -488,6 +488,13 @@ module:hook("message/offline/handle", function(event)
end
end, -2);
+-- Don't broadcast offline messages to clients that have queried the archive.
+module:hook("message/offline/broadcast", function (event)
+ if event.origin.mam_requested then
+ return true;
+ end
+end);
+
if cleanup_after ~= "never" then
local cleanup_storage = module:open_store("archive_cleanup");
local cleanup_map = module:open_store("archive_cleanup", "map");