]> granicus.if.org Git - ejabberd/commitdiff
Fix mnesia call in mam archive management function
authorPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 20 Apr 2018 11:36:54 +0000 (13:36 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Fri, 20 Apr 2018 11:36:54 +0000 (13:36 +0200)
src/mod_mam.erl
src/mod_mam_mnesia.erl

index 7912be30dca39d3d00a8ae0ed6eef17fb03f987b..791bcd16f7b37e6ecb5d2f59b017599147cb6062 100644 (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),
index 53d390cb7afe2c546752f0218baa4897195f7a4e..55154f6bbe5ffb48a317ea5317d0ea69e06d35c2 100644 (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