Mercurial > prosody-hg
changeset 13992:9cfc62b4625b 13.0
mod_mam: Add send_legacy_offline_messages_to_mam_clients config option
To prevent modern MAM-capable clients from receiving messages twice (MAM +
offline), Prosody has long suppressed offline messages for clients that
query the MAM archive before initial presence (which is the trigger for
sending offline messages).
From Conversations 2.19.2, it is now sending MAM queries before initial
presence, apparently for the first time, triggering the Prosody feature.
However, this has caused some undesired observable effects in certain edge
cases.
For example, if MAM is enabled on the server, but the user has disabled
archiving for their account, their archive may be empty while they have
actually have pending offline messages.
The long term goal remains to move towards smart retention in MAM, and
the deprecation and removal of the legacy offline messages mechanism.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Thu, 04 Dec 2025 11:12:23 +0000 |
| parents | 837d47c24e3f |
| children | a8c1dd9154d1 8d90a83603d6 |
| files | plugins/mod_mam/mod_mam.lua |
| diffstat | 1 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua Fri Oct 10 17:18:51 2025 +0200 +++ b/plugins/mod_mam/mod_mam.lua Thu Dec 04 11:12:23 2025 +0000 @@ -39,6 +39,7 @@ local timestamp, datestamp = import( "util.datetime", "datetime", "date"); local default_max_items, max_max_items = 20, module:get_option_integer("max_archive_query_results", 50, 0); local strip_tags = module:get_option_set("dont_archive_namespaces", { "http://jabber.org/protocol/chatstates" }); +local send_legacy_offline_to_mam_clients = module:get_option_boolean("send_legacy_offline_messages_to_mam_clients", false); local archive_store = module:get_option_string("archive_store", "archive"); local archive = module:open_store(archive_store, "archive"); @@ -495,12 +496,14 @@ 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 not send_legacy_offline_to_mam_clients then + -- 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); +end if cleanup_after ~= math.huge then local cleanup_storage = module:open_store("archive_cleanup");
