]> granicus.if.org Git - ejabberd/commitdiff
When unsubscribes, check if room should get closed (#1396)
authorBadlop <badlop@process-one.net>
Thu, 1 Dec 2016 21:09:57 +0000 (22:09 +0100)
committerBadlop <badlop@process-one.net>
Thu, 1 Dec 2016 21:09:57 +0000 (22:09 +0100)
src/mod_muc_room.erl

index b66748e64db02ac560d28a3d0b73a83fe7d987f9..c5c0c0fac5e5a35fd34d16737d828cfe7b81ebe0 100644 (file)
@@ -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;