25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Fix remove_mam_for_user_with_peer when removing room archive (#3536)

This commit is contained in:
Badlop 2021-03-01 22:19:20 +01:00
parent c46bf7d56b
commit 31884f6c9d

View File

@ -326,7 +326,7 @@ remove_mam_for_user_with_peer(User, Server, Peer) ->
LServer = jid:nameprep(Server),
try jid:decode(Peer) of
Jid ->
Mod = gen_mod:db_mod(LServer, ?MODULE),
Mod = get_module_host(LServer),
case Mod:remove_from_archive(LUser, LServer, Jid) of
ok ->
{ok, <<"MAM archive removed">>};
@ -339,6 +339,12 @@ remove_mam_for_user_with_peer(User, Server, Peer) ->
{error, <<"Invalid peer JID">>}
end.
get_module_host(LServer) ->
try gen_mod:db_mod(LServer, ?MODULE)
catch error:{module_not_loaded, ?MODULE, LServer} ->
gen_mod:db_mod(ejabberd_router:host_of_route(LServer), ?MODULE)
end.
-spec get_room_config([muc_roomconfig:property()], mod_muc_room:state(),
jid(), binary()) -> [muc_roomconfig:property()].
get_room_config(Fields, RoomState, _From, _Lang) ->