25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Merge pull request #1555 from weiss/count-session-iq

Let ejabberd_c2s handle <session/> IQ
This commit is contained in:
Evgeny Khramtsov 2017-02-20 10:21:16 +04:00 committed by GitHub
commit a664d6389e
2 changed files with 8 additions and 12 deletions

View File

@ -448,6 +448,13 @@ handle_authenticated_packet(Pkt, #{lserver := LServer, jid := JID,
case Pkt2 of case Pkt2 of
drop -> drop ->
State2; 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, #presence{to = #jid{luser = LUser, lserver = LServer,
lresource = <<"">>}} -> lresource = <<"">>}} ->
process_self_presence(State2, Pkt2); process_self_presence(State2, Pkt2);

View File

@ -577,20 +577,9 @@ process_unauthenticated_packet(Pkt, #{mod := Mod} = State) ->
end. end.
-spec process_authenticated_packet(xmpp_element(), state()) -> state(). -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), Pkt1 = set_lang(Pkt, State),
case set_from_to(Pkt1, State) of 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} -> {ok, Pkt2} ->
try Mod:handle_authenticated_packet(Pkt2, State) try Mod:handle_authenticated_packet(Pkt2, State)
catch _:undef -> catch _:undef ->