From 9fc8e18eb319c71df14d02204b6d3141d5f5dbec Mon Sep 17 00:00:00 2001 From: Alexey Shchepin Date: Wed, 26 Nov 2003 19:18:42 +0000 Subject: [PATCH] * src/ejabberd_c2s.erl: Fixed processing of presence probe from client SVN Revision: 177 --- ChangeLog | 5 +++++ src/ejabberd_c2s.erl | 21 +++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d6d3ed609..c36079fc0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-11-26 Alexey Shchepin + + * src/ejabberd_c2s.erl: Fixed processing of presence probe from + client + 2003-11-23 Alexey Shchepin * src/cyrsasl_digest.erl: Bugfix (thanks to Sergei Golovan) diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index fa7d8f726..e1ab806ab 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -879,16 +879,24 @@ get_auth_tags([], U, P, D, R) -> process_presence_probe(From, To, StateData) -> LFrom = jlib:jid_tolower(From), + LBFrom = setelement(3, LFrom, ""), case StateData#state.pres_last of undefined -> ok; _ -> Cond1 = (not StateData#state.pres_invis) - and ?SETS:is_element(LFrom, StateData#state.pres_f) - and (not ?SETS:is_element(LFrom, StateData#state.pres_i)), + andalso (?SETS:is_element(LFrom, StateData#state.pres_f) + orelse + ((LFrom /= LBFrom) andalso + ?SETS:is_element(LBFrom, StateData#state.pres_f))) + andalso (not + (?SETS:is_element(LFrom, StateData#state.pres_i) + orelse + ((LFrom /= LBFrom) andalso + ?SETS:is_element(LBFrom, StateData#state.pres_i)))), Cond2 = StateData#state.pres_invis - and ?SETS:is_element(LFrom, StateData#state.pres_f) - and ?SETS:is_element(LFrom, StateData#state.pres_a), + andalso ?SETS:is_element(LFrom, StateData#state.pres_f) + andalso ?SETS:is_element(LFrom, StateData#state.pres_a), if Cond1 -> Packet = StateData#state.pres_last, @@ -949,6 +957,8 @@ presence_update(From, Packet, StateData) -> NewState; "error" -> StateData; + "probe" -> + StateData; "subscribe" -> StateData; "subscribed" -> @@ -1022,6 +1032,9 @@ presence_track(From, To, Packet, StateData) -> "error" -> ejabberd_router:route(From, To, Packet), StateData; + "probe" -> + ejabberd_router:route(From, To, Packet), + StateData; _ -> %-ifdef(PRIVACY_SUPPORT). case catch mod_privacy:check_packet(