mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-12 21:52:07 +02:00
mod_mam: Don't store resent messages
Make sure messages that were resent by the stream management code aren't stored in MAM.
This commit is contained in:
parent
e09afe367f
commit
469e93f37b
|
@ -363,6 +363,10 @@ should_archive(#xmlel{name = <<"message">>} = Pkt) ->
|
||||||
<<"groupchat">> ->
|
<<"groupchat">> ->
|
||||||
false;
|
false;
|
||||||
_ ->
|
_ ->
|
||||||
|
case is_resent(Pkt) of
|
||||||
|
true ->
|
||||||
|
false;
|
||||||
|
false ->
|
||||||
case check_store_hint(Pkt) of
|
case check_store_hint(Pkt) of
|
||||||
store ->
|
store ->
|
||||||
true;
|
true;
|
||||||
|
@ -377,6 +381,7 @@ should_archive(#xmlel{name = <<"message">>} = Pkt) ->
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
should_archive(#xmlel{}) ->
|
should_archive(#xmlel{}) ->
|
||||||
false.
|
false.
|
||||||
|
@ -458,6 +463,14 @@ has_no_store_hint(Message) ->
|
||||||
xml:get_subtag_with_xmlns(Message, <<"no-permanent-storage">>, ?NS_HINTS)
|
xml:get_subtag_with_xmlns(Message, <<"no-permanent-storage">>, ?NS_HINTS)
|
||||||
/= false.
|
/= false.
|
||||||
|
|
||||||
|
is_resent(Pkt) ->
|
||||||
|
case xml:get_subtag_cdata(Pkt, <<"delay">>) of
|
||||||
|
<<>> ->
|
||||||
|
false;
|
||||||
|
Desc ->
|
||||||
|
binary:match(Desc, <<"Resent">>) =/= nomatch
|
||||||
|
end.
|
||||||
|
|
||||||
store_msg(C2SState, Pkt, LUser, LServer, Peer, Dir) ->
|
store_msg(C2SState, Pkt, LUser, LServer, Peer, Dir) ->
|
||||||
Prefs = get_prefs(LUser, LServer),
|
Prefs = get_prefs(LUser, LServer),
|
||||||
case should_archive_peer(C2SState, Prefs, Peer) of
|
case should_archive_peer(C2SState, Prefs, Peer) of
|
||||||
|
|
Loading…
Reference in New Issue
Block a user