aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-02-19 23:39:53 +0100
committerKim Alvefur <zash@zash.se>2017-02-19 23:39:53 +0100
commitf6dcf5996815a4b93eebb305d85390187cea2bc7 (patch)
tree2cf187e20b7ab7ff55640e97bc87bb251301e4b4 /plugins
parent9cde2e34c616d9d681df2c92ff8f7fc952ea680f (diff)
downloadprosody-f6dcf5996815a4b93eebb305d85390187cea2bc7.tar.gz
prosody-f6dcf5996815a4b93eebb305d85390187cea2bc7.zip
mod_mam: Strip stanza-id tags after carbons
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_mam/mod_mam.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index d7505f13..30e416ff 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -307,6 +307,19 @@ local function c2s_message_handler(event)
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