25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Fix presence-based delivery

This commit is contained in:
Nathan Bruning 2016-01-19 23:48:48 +01:00
parent fa55ac5c8f
commit 80fc34fb0c

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