25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Fix mnesia call in mam archive management function

This commit is contained in:
Paweł Chmielowski 2018-04-20 13:36:54 +02:00
parent 5be49cc0fa
commit 3bfa683586
2 changed files with 5 additions and 2 deletions

View File

@ -259,6 +259,8 @@ remove_room(LServer, Name, Host) ->
Mod:remove_room(LServer, LName, LHost),
ok.
-spec remove_mam_for_user(binary(), binary()) ->
{ok, binary()} | {error, binary()}.
remove_mam_for_user(User, Server) ->
LUser = jid:nodeprep(User),
LServer = jid:nameprep(Server),
@ -272,6 +274,8 @@ remove_mam_for_user(User, Server) ->
{error, <<"Db returned error">>}
end.
-spec remove_mam_for_user_with_peer(binary(), binary(), binary()) ->
{ok, binary()} | {error, binary()}.
remove_mam_for_user_with_peer(User, Server, Peer) ->
LUser = jid:nodeprep(User),
LServer = jid:nameprep(Server),

View File

@ -77,8 +77,7 @@ remove_from_archive(LUser, LServer, WithJid) ->
US = {LUser, LServer},
Peer = jid:remove_resource(jid:split(WithJid)),
F = fun () ->
Msgs = mnesia:match_object(archive_msg,
#archive_msg{us = US, bare_peer = Peer, _ = '_'}),
Msgs = mnesia:match_object(#archive_msg{us = US, bare_peer = Peer, _ = '_'}),
lists:foreach(fun mnesia:delete_object/1, Msgs)
end,
case mnesia:transaction(F) of