From bb76da03ea373a694c5818ab4e75246b36f8706e Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sat, 16 Jun 2018 00:43:22 +0200 Subject: [PATCH] mod_mam: Don't replace existing stanza ID Preserve the original stanza ID for resent messages. This avoids storing duplicates in the MAM archive. --- src/mod_mam.erl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod_mam.erl b/src/mod_mam.erl index d971983ab..9595be99f 100644 --- a/src/mod_mam.erl +++ b/src/mod_mam.erl @@ -404,6 +404,8 @@ get_stanza_id(#message{meta = #{stanza_id := ID}}) -> ID. -spec init_stanza_id(stanza(), binary()) -> stanza(). +init_stanza_id(#message{meta = #{stanza_id := _ID}} = Pkt, _LServer) -> + Pkt; init_stanza_id(Pkt, LServer) -> ID = p1_time_compat:system_time(micro_seconds), Pkt1 = strip_my_stanza_id(Pkt, LServer),