diff --git a/rebar.config b/rebar.config index bc8fc4d05..c04b075b7 100644 --- a/rebar.config +++ b/rebar.config @@ -24,7 +24,7 @@ {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.10"}}}, {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.7"}}}, {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}}, - {xmpp, ".*", {git, "https://github.com/processone/xmpp", "f5cbd6dc0f3ec786b33a7e708979ed27dfbbb0ec"}}, + {xmpp, ".*", {git, "https://github.com/processone/xmpp", "4aaed37a16fc21be505553aabf9f47a48b8af027"}}, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.9"}}}, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.10"}}}, {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.8"}}}, diff --git a/src/xmpp_stream_in.erl b/src/xmpp_stream_in.erl index 501db04ef..84576bd2f 100644 --- a/src/xmpp_stream_in.erl +++ b/src/xmpp_stream_in.erl @@ -592,25 +592,17 @@ process_authenticated_packet(Pkt, #{mod := Mod} = State) -> -spec process_bind(xmpp_element(), state()) -> state(). process_bind(#iq{type = set, sub_els = [_]} = Pkt, - #{xmlns := ?NS_CLIENT, mod := Mod, lang := Lang} = State) -> + #{xmlns := ?NS_CLIENT, mod := Mod} = State) -> case xmpp:get_subtag(Pkt, #bind{}) of #bind{resource = R} -> - case jid:resourceprep(R) of - error -> - Txt = <<"Malformed resource">>, - Err = xmpp:err_bad_request(Txt, Lang), - send_error(State, Pkt, Err); - _ -> - case Mod:bind(R, State) of - {ok, #{user := U, - server := S, - resource := NewR} = State1} when NewR /= <<"">> -> - Reply = #bind{jid = jid:make(U, S, NewR)}, - State2 = send_pkt(State1, xmpp:make_iq_result(Pkt, Reply)), - process_stream_established(State2); - {error, #stanza_error{} = Err, State1} -> - send_error(State1, Pkt, Err) - end + case Mod:bind(R, State) of + {ok, #{user := U, server := S, resource := NewR} = State1} + when NewR /= <<"">> -> + Reply = #bind{jid = jid:make(U, S, NewR)}, + State2 = send_pkt(State1, xmpp:make_iq_result(Pkt, Reply)), + process_stream_established(State2); + {error, #stanza_error{} = Err, State1} -> + send_error(State1, Pkt, Err) end; _ -> try Mod:handle_unbinded_packet(Pkt, State)