mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-26 17:38:45 +01:00
enforce pubsub#presence_based_delivery (EJAB-1221) (thanks to Karim Gemayel)
This commit is contained in:
parent
951808658d
commit
7fc1207661
@ -2868,12 +2868,18 @@ node_to_deliver(LJID, NodeOptions) ->
|
|||||||
presence_can_deliver(LJID, PresenceDelivery).
|
presence_can_deliver(LJID, PresenceDelivery).
|
||||||
|
|
||||||
presence_can_deliver(_, false) -> true;
|
presence_can_deliver(_, false) -> true;
|
||||||
presence_can_deliver({User, Server, _}, true) ->
|
presence_can_deliver({User, Server, Resource}, true) ->
|
||||||
case mnesia:dirty_match_object({session, '_', '_', {User, Server}, '_', '_'}) of
|
case mnesia:dirty_match_object({session, '_', '_', {User, Server}, '_', '_'}) of
|
||||||
[] -> false;
|
[] -> false;
|
||||||
Ss ->
|
Ss ->
|
||||||
lists:foldl(fun({session, _, _, _, undefined, _}, Acc) -> Acc;
|
lists:foldl(fun(_, true) -> true;
|
||||||
({session, _, _, _, _Priority, _}, _Acc) -> true
|
({session, _, _ , _, undefined, _}, _Acc) -> false;
|
||||||
|
({session, _, {_, _, R}, _, _Priority, _}, _Acc) ->
|
||||||
|
case Resource of
|
||||||
|
[] -> true;
|
||||||
|
R -> true;
|
||||||
|
_ -> false
|
||||||
|
end
|
||||||
end, false, Ss)
|
end, false, Ss)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user