From d7e1f6d7b38a69391edb13c0de34a917148af2e3 Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 1 Dec 2016 22:09:57 +0100 Subject: [PATCH] When unsubscribes, check if room should get closed (#1396) --- src/mod_muc_room.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index b66748e64..c5c0c0fac 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -3745,7 +3745,11 @@ process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]}, NewStateData = StateData#state{subscribers = Subscribers, subscriber_nicks = Nicks}, store_room(NewStateData), - {result, undefined, NewStateData}; + NewStateData2 = case close_room_if_temporary_and_empty(NewStateData) of + {stop, normal, _} -> stop; + {next_state, normal_state, SD} -> SD + end, + {result, undefined, NewStateData2}; _ -> {result, undefined, StateData} end; -- 2.40.0