From: Holger Weiss Date: Sun, 19 Feb 2017 21:43:10 +0000 (+0100) Subject: Let ejabberd_c2s handle IQ X-Git-Tag: 17.03-beta~31^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c159e38815a83ab677ace8e1a5b55cf8ff2ad37;p=ejabberd Let ejabberd_c2s handle IQ This fixes the counting of incoming stanzas for stream management. --- diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 036bea79e..dd0221496 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -448,6 +448,13 @@ handle_authenticated_packet(Pkt, #{lserver := LServer, jid := JID, case Pkt2 of drop -> State2; + #iq{type = set, sub_els = [_]} -> + case xmpp:get_subtag(Pkt1, #xmpp_session{}) of + #xmpp_session{} -> + send(State2, xmpp:make_iq_result(Pkt1)); + _ -> + check_privacy_then_route(State2, Pkt1) + end; #presence{to = #jid{luser = LUser, lserver = LServer, lresource = <<"">>}} -> process_self_presence(State2, Pkt2); diff --git a/src/xmpp_stream_in.erl b/src/xmpp_stream_in.erl index 7d9b0dc88..501db04ef 100644 --- a/src/xmpp_stream_in.erl +++ b/src/xmpp_stream_in.erl @@ -577,20 +577,9 @@ process_unauthenticated_packet(Pkt, #{mod := Mod} = State) -> end. -spec process_authenticated_packet(xmpp_element(), state()) -> state(). -process_authenticated_packet(Pkt, #{xmlns := NS, mod := Mod} = State) -> +process_authenticated_packet(Pkt, #{mod := Mod} = State) -> Pkt1 = set_lang(Pkt, State), case set_from_to(Pkt1, State) of - {ok, #iq{type = set, sub_els = [_]} = Pkt2} when NS == ?NS_CLIENT -> - case xmpp:get_subtag(Pkt2, #xmpp_session{}) of - #xmpp_session{} -> - send_pkt(State, xmpp:make_iq_result(Pkt2)); - _ -> - try Mod:handle_authenticated_packet(Pkt2, State) - catch _:undef -> - Err = xmpp:err_service_unavailable(), - send_error(State, Pkt, Err) - end - end; {ok, Pkt2} -> try Mod:handle_authenticated_packet(Pkt2, State) catch _:undef ->