mirror of
https://github.com/processone/ejabberd
synced 2025-10-03 17:59:31 +02:00
Simplify setting allow_subscription (#1404)
This commit is contained in:
parent
f14a966680
commit
afc7f5aa37
1 changed files with 1 additions and 6 deletions
|
@ -3731,7 +3731,7 @@ process_iq_mucsub(From,
|
||||||
NewStateData = set_subscriber(From, Nick, Nodes, StateData),
|
NewStateData = set_subscriber(From, Nick, Nodes, StateData),
|
||||||
{result, subscribe_result(Packet), NewStateData};
|
{result, subscribe_result(Packet), NewStateData};
|
||||||
error ->
|
error ->
|
||||||
SD2 = maybe_enable_subscriptions(StateData),
|
SD2 = StateData#state{config = (StateData#state.config)#config{allow_subscription = true}},
|
||||||
add_new_user(From, Nick, Packet, SD2)
|
add_new_user(From, Nick, Packet, SD2)
|
||||||
end;
|
end;
|
||||||
process_iq_mucsub(From, #iq{type = set, sub_els = [#muc_unsubscribe{}]},
|
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">>,
|
Txt = <<"Value 'get' of 'type' attribute is not allowed">>,
|
||||||
{error, xmpp:err_bad_request(Txt, Lang)}.
|
{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) ->
|
remove_subscriptions(StateData) ->
|
||||||
if not (StateData#state.config)#config.allow_subscription ->
|
if not (StateData#state.config)#config.allow_subscription ->
|
||||||
StateData#state{subscribers = ?DICT:new(),
|
StateData#state{subscribers = ?DICT:new(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue