Software /
code /
prosody
Changeset
12030:9f8206e99b89
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 10 Dec 2021 22:25:34 +0100 |
parents | 12029:631b2afa7bc1 |
children | 12031:87bc26f23d9b |
files | plugins/mod_mam/mod_mam.lua |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua Wed Dec 08 21:55:25 2021 +0100 +++ b/plugins/mod_mam/mod_mam.lua Fri Dec 10 22:25:34 2021 +0100 @@ -24,6 +24,7 @@ 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 @@ 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