mod_pubsub: Improve PEP behavior for 'whitelist'
If a PEP node's access_model is set to 'whitelist' (or 'authorize'), send last PEP notifications to the node owner.
This commit is contained in:
parent
1ed788d00c
commit
074ebd80f6
|
@ -2990,6 +2990,7 @@ send_last_pep(From, To) ->
|
||||||
Host = host(ServerHost),
|
Host = host(ServerHost),
|
||||||
Publisher = jid:tolower(From),
|
Publisher = jid:tolower(From),
|
||||||
Owner = jid:remove_resource(Publisher),
|
Owner = jid:remove_resource(Publisher),
|
||||||
|
RecipientIsOwner = jid:remove_resource(jid:tolower(To)) == Owner,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(#pubsub_node{nodeid = {_, Node}, type = Type, id = Nidx, options = Options}) ->
|
fun(#pubsub_node{nodeid = {_, Node}, type = Type, id = Nidx, options = Options}) ->
|
||||||
case match_option(Options, send_last_published_item, on_sub_and_presence) of
|
case match_option(Options, send_last_published_item, on_sub_and_presence) of
|
||||||
|
@ -2998,8 +2999,11 @@ send_last_pep(From, To) ->
|
||||||
Subscribed = case get_option(Options, access_model) of
|
Subscribed = case get_option(Options, access_model) of
|
||||||
open -> true;
|
open -> true;
|
||||||
presence -> true;
|
presence -> true;
|
||||||
whitelist -> false; % subscribers are added manually
|
%% TODO: Fix the 'whitelist'/'authorize'
|
||||||
authorize -> false; % likewise
|
%% cases. Currently, only node owners
|
||||||
|
%% receive last PEP notifications.
|
||||||
|
whitelist -> RecipientIsOwner;
|
||||||
|
authorize -> RecipientIsOwner;
|
||||||
roster ->
|
roster ->
|
||||||
Grps = get_option(Options, roster_groups_allowed, []),
|
Grps = get_option(Options, roster_groups_allowed, []),
|
||||||
{OU, OS, _} = Owner,
|
{OU, OS, _} = Owner,
|
||||||
|
|
Loading…
Reference in New Issue