# HG changeset patch # User Kim Alvefur # Date 1378388917 -7200 # Node ID d677d1807bb065a77e12dfc96c44d8681e3bfd65 # Parent a172e7389cf6670d1d2c472954880748f093be54 mod_mam: Stamp outgoing messages with as well, but remove it after they should have passed through mod_carbons diff -r a172e7389cf6 -r d677d1807bb0 mod_mam/mod_mam.lua --- a/mod_mam/mod_mam.lua Thu Sep 05 15:24:09 2013 +0200 +++ b/mod_mam/mod_mam.lua Thu Sep 05 15:48:37 2013 +0200 @@ -202,7 +202,7 @@ -- And stash it local ok, id = archive:append(store_user, time_now(), with, stanza); - if ok and not c2s then + if ok then stanza:tag("archived", { xmlns = xmlns_mam, by = store_user.."@"..host, id = id }):up(); end else @@ -221,5 +221,16 @@ module:hook("message/bare", message_handler, 2); module:hook("message/full", message_handler, 2); +local function post_carbons_handler(event) + event.stanza:maptags(function(tag) + if not ( tag.attr.xmlns == xmlns_mam and tag.name == "archived" ) then + return tag; + end + end); +end + +module:hook("pre-message/bare", post_carbons_handler, 0.9); +module:hook("pre-message/full", post_carbons_handler, 0.9); + module:add_feature(xmlns_mam);