aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam/mod_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-04-26 14:28:00 +0200
committerKim Alvefur <zash@zash.se>2020-04-26 14:28:00 +0200
commitf5761f46f2c4ee391d883b7b5c70de04065e514b (patch)
tree27126cab5b5cfdddc8d6be14e8fc4abe7005d8a9 /plugins/mod_mam/mod_mam.lua
parent99d495680bbc684dbca519f94d069c1dd92e223c (diff)
downloadprosody-f5761f46f2c4ee391d883b7b5c70de04065e514b.tar.gz
prosody-f5761f46f2c4ee391d883b7b5c70de04065e514b.zip
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.
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-rw-r--r--plugins/mod_mam/mod_mam.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index d61d4883..72b7639a 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -263,7 +263,7 @@ local function strip_stanza_id(stanza, user)
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 @@ local function should_store(stanza) --> boolean, reason: string
-- 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 @@ local function message_handler(event, c2s)
-- Filter out <stanza-id> 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;