mod_register: Don't advertise IBR unconditionally

Don't advertise the IBR stream feature if registration is disabled in
the configuration.
This commit is contained in:
Holger Weiss 2018-12-01 07:21:41 +01:00
parent 59ce0ba6c8
commit 2eb907dc7f
1 changed files with 8 additions and 2 deletions

View File

@ -73,8 +73,14 @@ depends(_Host, _Opts) ->
[].
-spec stream_feature_register([xmpp_element()], binary()) -> [xmpp_element()].
stream_feature_register(Acc, _Host) ->
[#feature_register{}|Acc].
stream_feature_register(Acc, Host) ->
case {gen_mod:get_module_opt(Host, ?MODULE, access),
gen_mod:get_module_opt(Host, ?MODULE, ip_access),
gen_mod:get_module_opt(Host, ?MODULE, redirect_url)} of
{none, _, <<>>} -> Acc;
{_, none, <<>>} -> Acc;
{_, _, _} -> [#feature_register{}|Acc]
end.
c2s_unauthenticated_packet(#{ip := IP, server := Server} = State,
#iq{type = T, sub_els = [_]} = IQ)