# HG changeset patch # User Kim Alvefur # Date 1587904080 -7200 # Node ID 3e1046b39484e987fb9f890b0510b8bde4f569b2 # Parent 31e702c5f475abbbc2a846c661bdd23034a5b07a mod_mam: Store only incoming errors Unclear if clients normally ever send error messages, but there may be locally generated bounces sent on behalf of local sessions. diff -r 31e702c5f475 -r 3e1046b39484 plugins/mod_mam/mod_mam.lua --- a/plugins/mod_mam/mod_mam.lua Sun Apr 26 11:40:48 2020 +0200 +++ b/plugins/mod_mam/mod_mam.lua Sun Apr 26 14:28:00 2020 +0200 @@ -263,7 +263,7 @@ return stanza; end -local function should_store(stanza) --> boolean, reason: string +local function should_store(stanza, c2s) --> boolean, reason: string local st_type = stanza.attr.type or "normal"; -- FIXME pass direction of stanza and use that along with bare/full JID addressing -- for more accurate MUC / type=groupchat check @@ -272,7 +272,8 @@ -- Headline messages are ephemeral by definition return false, "headline"; end - if st_type == "error" then + if st_type == "error" and not c2s then + -- Store delivery failure notifications so you know if your own messages were not delivered return true, "bounce"; end if st_type == "groupchat" then @@ -334,7 +335,7 @@ -- Filter out that claim to be from us event.stanza = strip_stanza_id(stanza, store_user); - local should, why = should_store(stanza); + local should, why = should_store(stanza, c2s); if not should then log("debug", "Not archiving stanza: %s (%s)", stanza:top_tag(), why); return;