# HG changeset patch # User Kim Alvefur # Date 1487543993 -3600 # Node ID 92b70a921acbbd2a27e642c5f5fb1bdd72c40211 # Parent fc859aed92795e24715181d97a43aeb5bc78f447 mod_mam: Strip stanza-id tags after carbons diff -r fc859aed9279 -r 92b70a921acb plugins/mod_mam/mod_mam.lua --- a/plugins/mod_mam/mod_mam.lua Sun Feb 19 13:44:47 2017 +0100 +++ b/plugins/mod_mam/mod_mam.lua Sun Feb 19 23:39:53 2017 +0100 @@ -307,6 +307,19 @@ return message_handler(event, true); end + +local function strip_stanza_id(event) + local strip_by = jid_bare(event.origin.full_jid); + event.stanza:maptags(function(tag) + if not ( tag.attr.xmlns == xmlns_st_id and tag.attr.by == strip_by ) then + return tag; + end + end); +end + +module:hook("pre-message/bare", strip_stanza_id, -1); +module:hook("pre-message/full", strip_stanza_id, -1); + local cleanup_after = module:get_option_string("archive_expires_after", "1w"); local cleanup_interval = module:get_option_number("archive_cleanup_interval", 4 * 60 * 60); if cleanup_after ~= "never" then