diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-12-06 17:21:57 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-12-06 17:21:57 +0300 |
commit | 7a9d2cabc0a1e24dd887707dd4bfc08c6e66b83c (patch) | |
tree | 32b783d52575e2b360ec5af35e9e3e103bd86ba1 /src/xmpp_stream_out.erl | |
parent | Use ejabberd_cluster:send() in SM/C2S (diff) |
Improve code using new xmpp API
Diffstat (limited to 'src/xmpp_stream_out.erl')
-rw-r--r-- | src/xmpp_stream_out.erl | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/xmpp_stream_out.erl b/src/xmpp_stream_out.erl index 7ddc183b..33598497 100644 --- a/src/xmpp_stream_out.erl +++ b/src/xmpp_stream_out.erl @@ -511,7 +511,7 @@ process_features(StreamFeatures, catch _:undef -> State end, process_stream_established(State1); -process_features(#stream_features{sub_els = Els} = StreamFeatures, +process_features(StreamFeatures, #{stream_encrypted := Encrypted, mod := Mod, lang := Lang} = State) -> State1 = try Mod:handle_unauthenticated_features(StreamFeatures, State) @@ -522,9 +522,7 @@ process_features(#stream_features{sub_els = Els} = StreamFeatures, false -> TLSRequired = is_starttls_required(State1), TLSAvailable = is_starttls_available(State1), - %% TODO: improve xmpp.erl - Msg = #message{sub_els = Els}, - case xmpp:get_subtag(Msg, #starttls{}) of + case xmpp:get_subtag(StreamFeatures, #starttls{}) of false when TLSRequired and not Encrypted -> Txt = <<"Use of STARTTLS required">>, send_pkt(State1, xmpp:serr_policy_violation(Txt, Lang)); @@ -545,7 +543,7 @@ process_features(#stream_features{sub_els = Els} = StreamFeatures, case is_disconnected(State2) of true -> State2; false -> - case xmpp:get_subtag(Msg, #sasl_mechanisms{}) of + case xmpp:get_subtag(StreamFeatures, #sasl_mechanisms{}) of #sasl_mechanisms{list = Mechs} -> process_sasl_mechanisms(Mechs, State2); false -> |