mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Support to provide password when subscribing to a room (#1306)
This commit is contained in:
parent
bd060bc1bb
commit
566ac872fe
@ -4653,7 +4653,8 @@ process_iq_mucsub(From, Packet,
|
|||||||
NewStateData = set_subscriber(From, Nick, Nodes, StateData),
|
NewStateData = set_subscriber(From, Nick, Nodes, StateData),
|
||||||
{result, subscription_nodes_to_events(Nodes), NewStateData};
|
{result, subscription_nodes_to_events(Nodes), NewStateData};
|
||||||
error ->
|
error ->
|
||||||
add_new_user(From, Nick, Packet, StateData)
|
Packet2 = copy_password_xelement(Packet),
|
||||||
|
add_new_user(From, Nick, Packet2, StateData)
|
||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
Err = ?ERRT_NOT_ALLOWED(Lang, <<"Subscriptions are not allowed">>),
|
Err = ?ERRT_NOT_ALLOWED(Lang, <<"Subscriptions are not allowed">>),
|
||||||
@ -4697,6 +4698,11 @@ process_iq_mucsub(_From, _Packet, #iq{lang = Lang}, _StateData) ->
|
|||||||
Txt = <<"Unrecognized subscription command">>,
|
Txt = <<"Unrecognized subscription command">>,
|
||||||
{error, ?ERRT_BAD_REQUEST(Lang, Txt)}.
|
{error, ?ERRT_BAD_REQUEST(Lang, Txt)}.
|
||||||
|
|
||||||
|
copy_password_xelement(Packet) ->
|
||||||
|
SubsEl = fxml:get_subtag_with_xmlns(Packet, <<"subscribe">>, ?NS_MUCSUB),
|
||||||
|
XEl = fxml:get_subtag_with_xmlns(SubsEl, <<"x">>, ?NS_MUC),
|
||||||
|
fxml:append_subtags(Packet, [XEl]).
|
||||||
|
|
||||||
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…
Reference in New Issue
Block a user