From 9e1f3862cbdb8001da6c92558ac0c2a869664f15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Thu, 19 Nov 2020 09:31:14 +0100 Subject: [PATCH] Fix room_unused_destroy on hibernated rooms --- src/mod_muc_admin.erl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mod_muc_admin.erl b/src/mod_muc_admin.erl index f818dd1ec..7de833cc2 100644 --- a/src/mod_muc_admin.erl +++ b/src/mod_muc_admin.erl @@ -932,13 +932,20 @@ act_on_rooms(Method, Action, Rooms) -> end, lists:foreach(Delete, Rooms). -act_on_room(Method, destroy, {N, H, SH, Pid}) -> +act_on_room(Method, destroy, {N, H, _SH, Pid}) -> Message = iolist_to_binary(io_lib:format( <<"Room destroyed by rooms_~s_destroy.">>, [Method])), - mod_muc_room:destroy(Pid, Message), - mod_muc:room_destroyed(H, N, Pid, SH), - mod_muc:forget_room(SH, H, N); - + case Pid of + V when is_pid(V) -> + mod_muc_room:destroy(Pid, Message); + _ -> + case get_room_pid(N, H) of + Pid2 when is_pid(Pid2) -> + mod_muc_room:destroy(Pid2, Message); + _ -> + ok + end + end; act_on_room(_Method, list, _) -> ok.