From afc7f5aa37dd852b7d2885279ed65a4cf0ec6200 Mon Sep 17 00:00:00 2001 From: Badlop Date: Mon, 9 Jan 2017 15:56:25 +0100 Subject: [PATCH] Simplify setting allow_subscription (#1404) --- src/mod_muc_room.erl | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mod_muc_room.erl b/src/mod_muc_room.erl index daf02a34e..ceb834d35 100644 --- a/src/mod_muc_room.erl +++ b/src/mod_muc_room.erl @@ -3731,7 +3731,7 @@ process_iq_mucsub(From, NewStateData = set_subscriber(From, Nick, Nodes, StateData), {result, subscribe_result(Packet), NewStateData}; error -> - SD2 = maybe_enable_subscriptions(StateData), + SD2 = StateData#state{config = (StateData#state.config)#config{allow_subscription = true}}, add_new_user(From, Nick, Packet, SD2) end; process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]}, @@ -3771,11 +3771,6 @@ process_iq_mucsub(_From, #iq{type = get, lang = Lang}, _StateData) -> Txt = <<"Value 'get' of 'type' attribute is not allowed">>, {error, xmpp:err_bad_request(Txt, Lang)}. -maybe_enable_subscriptions(#state{just_created = JC, config = #config{allow_subscription = AS}} = SD) -> - SD#state{config = (SD#state.config)#config{allow_subscription = true}}; -maybe_enable_subscriptions(SD) -> - SD. - remove_subscriptions(StateData) -> if not (StateData#state.config)#config.allow_subscription -> StateData#state{subscribers = ?DICT:new(), -- 2.40.0