From: Holger Weiss Date: Fri, 15 Jun 2018 22:43:22 +0000 (+0200) Subject: mod_mam: Don't replace existing stanza ID X-Git-Tag: 18.06~36 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb76da03ea373a694c5818ab4e75246b36f8706e;p=ejabberd mod_mam: Don't replace existing stanza ID Preserve the original stanza ID for resent messages. This avoids storing duplicates in the MAM archive. --- 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),