diff options
author | Kim Alvefur <zash@zash.se> | 2021-12-10 22:25:34 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-12-10 22:25:34 +0100 |
commit | ab4991e8297bf1055bee64d7eca9651b010046bf (patch) | |
tree | a71d62c607db9d2e45577fba2eb1977e8361b930 /plugins/mod_mam/mod_mam.lua | |
parent | 449311b2d112182be22ab9bef06ae00d200726e9 (diff) | |
download | prosody-ab4991e8297bf1055bee64d7eca9651b010046bf.tar.gz prosody-ab4991e8297bf1055bee64d7eca9651b010046bf.zip |
mod_mam: Avoid storing bounces for messages from the bare account (thanks Ge0rG)
This should rule out error replies to PEP notifications, which come from
the account bare JID, and would be reflected back to it if they can't be
delivered for some reason, e.g. s2s problems.
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-rw-r--r-- | plugins/mod_mam/mod_mam.lua | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index afbd6500..92b49fcd 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -24,6 +24,7 @@ local prefs_to_stanza = module:require"mamprefsxml".tostanza; local prefs_from_stanza = module:require"mamprefsxml".fromstanza; local jid_bare = require "util.jid".bare; local jid_split = require "util.jid".split; +local jid_resource = require "util.jid".resource; local jid_prepped_split = require "util.jid".prepped_split; local dataform = require "util.dataforms".new; local get_form_type = require "util.dataforms".get_type; @@ -320,8 +321,17 @@ local function should_store(stanza, c2s) --> boolean, reason: string return false, "headline"; end 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"; + -- Errors not sent sent from a local client + -- Why would a client send an error anyway? + if jid_resource(stanza.attr.to) then + -- Store delivery failure notifications so you know if your own messages + -- were not delivered. + return true, "bounce"; + else + -- Skip errors for messages that come from your account, such as PEP + -- notifications. + return false, "bounce"; + end end if st_type == "groupchat" then -- MUC messages always go to the full JID, usually archived by the MUC |