false ->
[]
end,
+ StreamFeatures1 = TLSFeature ++ CompressFeature ++ Mechs,
+ StreamFeatures = ejabberd_hooks:run_fold(c2s_stream_features,
+ Server, StreamFeatures1, [Server]),
send_element(StateData,
#xmlel{name = <<"stream:features">>,
attrs = [],
children =
- TLSFeature ++ CompressFeature ++ Mechs
- ++
- ejabberd_hooks:run_fold(c2s_stream_features,
- Server, [], [Server])}),
+ StreamFeatures}),
fsm_next_state(wait_for_feature_request,
StateData#state{
server = Server,
false ->
[]
end,
- StreamFeatures = [#xmlel{name = <<"bind">>,
+ StreamFeatures1 = [#xmlel{name = <<"bind">>,
attrs = [{<<"xmlns">>, ?NS_BIND}],
children = []},
#xmlel{name = <<"session">>,
RosterVersioningFeature ++
StreamManagementFeature ++
ejabberd_hooks:run_fold(c2s_post_auth_features,
- Server, [], [Server]) ++
- ejabberd_hooks:run_fold(c2s_stream_features,
Server, [], [Server]),
+ StreamFeatures = ejabberd_hooks:run_fold(c2s_stream_features,
+ Server, StreamFeatures1, [Server]),
send_element(StateData,
#xmlel{name = <<"stream:features">>,
attrs = [],
?NS_REGISTER).
stream_feature_register(Acc, _Host) ->
- [#xmlel{name = <<"register">>,
- attrs = [{<<"xmlns">>, ?NS_FEATURE_IQREGISTER}],
- children = []}
- | Acc].
+ case lists:keymember(<<"mechanisms">>, 2, Acc) of
+ true ->
+ [#xmlel{name = <<"register">>,
+ attrs = [{<<"xmlns">>, ?NS_FEATURE_IQREGISTER}],
+ children = []}
+ | Acc];
+ false ->
+ Acc
+ end.
unauthenticated_iq_register(_Acc, Server,
#iq{xmlns = ?NS_REGISTER} = IQ, IP) ->