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:
parent
5be49cc0fa
commit
3bfa683586
@ -259,6 +259,8 @@ remove_room(LServer, Name, Host) ->
|
|||||||
Mod:remove_room(LServer, LName, LHost),
|
Mod:remove_room(LServer, LName, LHost),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
-spec remove_mam_for_user(binary(), binary()) ->
|
||||||
|
{ok, binary()} | {error, binary()}.
|
||||||
remove_mam_for_user(User, Server) ->
|
remove_mam_for_user(User, Server) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
@ -272,6 +274,8 @@ remove_mam_for_user(User, Server) ->
|
|||||||
{error, <<"Db returned error">>}
|
{error, <<"Db returned error">>}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
-spec remove_mam_for_user_with_peer(binary(), binary(), binary()) ->
|
||||||
|
{ok, binary()} | {error, binary()}.
|
||||||
remove_mam_for_user_with_peer(User, Server, Peer) ->
|
remove_mam_for_user_with_peer(User, Server, Peer) ->
|
||||||
LUser = jid:nodeprep(User),
|
LUser = jid:nodeprep(User),
|
||||||
LServer = jid:nameprep(Server),
|
LServer = jid:nameprep(Server),
|
||||||
|
@ -77,8 +77,7 @@ remove_from_archive(LUser, LServer, WithJid) ->
|
|||||||
US = {LUser, LServer},
|
US = {LUser, LServer},
|
||||||
Peer = jid:remove_resource(jid:split(WithJid)),
|
Peer = jid:remove_resource(jid:split(WithJid)),
|
||||||
F = fun () ->
|
F = fun () ->
|
||||||
Msgs = mnesia:match_object(archive_msg,
|
Msgs = mnesia:match_object(#archive_msg{us = US, bare_peer = Peer, _ = '_'}),
|
||||||
#archive_msg{us = US, bare_peer = Peer, _ = '_'}),
|
|
||||||
lists:foreach(fun mnesia:delete_object/1, Msgs)
|
lists:foreach(fun mnesia:delete_object/1, Msgs)
|
||||||
end,
|
end,
|
||||||
case mnesia:transaction(F) of
|
case mnesia:transaction(F) of
|
||||||
|
Loading…
Reference in New Issue
Block a user