NewStateData = set_subscriber(From, Nick, Nodes, StateData),
{result, subscription_nodes_to_events(Nodes), NewStateData};
error ->
- add_new_user(From, Nick, Packet, StateData)
+ Packet2 = copy_password_xelement(Packet),
+ add_new_user(From, Nick, Packet2, StateData)
end;
_ ->
Err = ?ERRT_NOT_ALLOWED(Lang, <<"Subscriptions are not allowed">>),
Txt = <<"Unrecognized subscription command">>,
{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) ->
if not (StateData#state.config)#config.allow_subscription ->
StateData#state{subscribers = ?DICT:new(),