25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Merge pull request #937 from Iperity/fix-presence-based-delivery

Fix presence-based delivery
This commit is contained in:
Christophe Romain 2016-02-02 15:41:21 +01:00
commit 59c471aad5

View File

@ -3170,17 +3170,15 @@ sub_option_can_deliver(_, _, _) -> true.
presence_can_deliver(_, false) ->
true;
presence_can_deliver({User, Server, Resource}, true) ->
case mnesia:dirty_match_object({session, '_', '_', {User, Server}, '_', '_'}) of
case ejabberd_sm:get_user_present_resources(User, Server) of
[] ->
false;
Ss ->
lists:foldl(fun
(_, true) ->
true;
({session, _, _, _, undefined, _}, _Acc) ->
false;
({session, {_, _, R}, _, _, _Priority, _}, _Acc) ->
case Resource of
({_, R}, _Acc) ->
case Resource of
<<>> -> true;
R -> true;
_ -> false