Skip to content

Commit

Permalink
Support XEP-0424 in mod_mam_mnesia
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyshch committed Dec 27, 2023
1 parent 4f67306 commit 8d2d3a6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/mod_mam_mnesia.erl
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,27 @@ extended_fields() ->
[].

store(Pkt, _, {LUser, LServer}, Type, Peer, Nick, _Dir, TS,
OriginID, _Retract) ->
OriginID, Retract) ->
case Retract of
{true, RID} ->
mnesia:transaction(
fun () ->
{PUser, PServer, _} = jid:tolower(Peer),
Msgs = mnesia:select(
archive_msg,
ets:fun2ms(
fun(#archive_msg{
us = US1,
bare_peer = Peer1,
origin_id = OriginID1} = Msg)
when US1 == {LUser, LServer},
Peer1 == {PUser, PServer, <<>>},
OriginID1 == RID -> Msg
end)),
lists:foreach(fun mnesia:delete_object/1, Msgs)
end);
false -> ok
end,
case {mnesia:table_info(archive_msg, disc_only_copies),
mnesia:table_info(archive_msg, memory)} of
{[_|_], TableSize} when TableSize > ?TABLE_SIZE_LIMIT ->
Expand Down

0 comments on commit 8d2d3a6

Please sign in to comment.