diff --git a/rebar.config b/rebar.config index c7ffe7f8c..748bdd3c9 100644 --- a/rebar.config +++ b/rebar.config @@ -24,8 +24,8 @@ {cache_tab, ".*", {git, "https://github.com/processone/cache_tab", {tag, "1.0.12"}}}, {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.17"}}}, {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.10"}}}, - {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.25"}}}, - {xmpp, ".*", {git, "https://github.com/processone/xmpp", "a893ee1"}}, + {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", "724ec0a"}}, + {xmpp, ".*", {git, "https://github.com/processone/xmpp", "dbbaed4edfc"}}, {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.12"}}}, {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}}, {p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.2"}}}, diff --git a/src/mod_mix.erl b/src/mod_mix.erl index 90507665b..4562e037c 100644 --- a/src/mod_mix.erl +++ b/src/mod_mix.erl @@ -310,11 +310,8 @@ is_item_not_found({error, #stanza_error{reason = 'item-not-found'}}) -> true; is_item_not_found({error, _}) -> false. -spec is_not_subscribed({error, stanza_error()}) -> boolean(). -is_not_subscribed({error, #stanza_error{sub_els = Els}}) -> - %% TODO: make xmpp:get_els function working for any XMPP element - %% with sub_els field - xmpp:has_subtag(#message{sub_els = Els}, - #ps_error{type = 'not-subscribed'}). +is_not_subscribed({error, StanzaError}) -> + xmpp:has_subtag(StanzaError, #ps_error{type = 'not-subscribed'}). depends(_Host, _Opts) -> [{mod_pubsub, hard}]. diff --git a/src/mod_s2s_dialback.erl b/src/mod_s2s_dialback.erl index b4c2ed9df..1bf04af35 100644 --- a/src/mod_s2s_dialback.erl +++ b/src/mod_s2s_dialback.erl @@ -334,9 +334,8 @@ mk_error(_) -> -spec format_error(db_result()) -> binary(). format_error(#db_result{type = invalid}) -> <<"invalid dialback key">>; -format_error(#db_result{type = error, sub_els = Els}) -> - %% TODO: improve xmpp.erl - case xmpp:get_error(#message{sub_els = Els}) of +format_error(#db_result{type = error} = Result) -> + case xmpp:get_error(Result) of #stanza_error{} = Err -> format_stanza_error(Err); undefined -> diff --git a/src/xmpp_stream_out.erl b/src/xmpp_stream_out.erl index 7ddc183bf..335984975 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 ->