From 999f3233bbcaa5a82c3bfeec2f54f6a3b630c366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Wed, 25 Jun 2008 13:27:03 +0000 Subject: [PATCH] Fix short JID comparison in get_subscribed_and_online; it was using 'undefined' instead of empty strings. SVN Revision: 1381 --- ChangeLog | 3 +++ src/ejabberd_c2s.erl | 9 +++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9790c3f08..e49553877 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * src/ejabberd_c2s.erl: Finish ejabberd_c2s conversion with the functions related to offline stanzas. + * src/ejabberd_c2s.erl (get_subscribed_and_online): Fix short JID + comparison; it was using 'undefined' instead of empty strings. + 2008-06-24 Jean-Sébastien Pédron * src/ejabberd_c2s.erl: The handle_info clause that treats routing diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 1f87d2a25..c847506be 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -981,16 +981,13 @@ handle_sync_event({get_presence}, _From, StateName, StateData) -> handle_sync_event(get_subscribed_and_online, _From, StateName, StateData) -> Subscribed = StateData#state.pres_f, Online = StateData#state.pres_available, + % XXX OLF FORMAT: short JID with empty string(s). Pred = fun({U, S, _R} = User, _Caps) -> - ?SETS:is_element({U, S, undefined}, + ?SETS:is_element({U, S, ""}, Subscribed) orelse ?SETS:is_element(User, Subscribed) end, - % XXX OLD FORMAT: Resource is "". - Old = fun({U, S, undefined}, _Caps) -> {U, S, ""}; - (User, _Caps) -> User - end, - SubscribedAndOnline = ?DICT:map(Old, ?DICT:filter(Pred, Online)), + SubscribedAndOnline = ?DICT:filter(Pred, Online), io:format("===== SubscribedAndOnline = ~p~n", [SubscribedAndOnline]), {reply, ?DICT:to_list(SubscribedAndOnline), StateName, StateData};