aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2018-12-05 18:25:40 +0100
committerHolger Weiss <holger@zedat.fu-berlin.de>2018-12-05 18:25:40 +0100
commit074ebd80f6ed2af4b01032a4e72fabd8054c47ef (patch)
tree9d00c74282bf501f08dbc7c1c8865d022c76bb68
parentRemove useless config file (#2665) (diff)
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.
-rw-r--r--src/mod_pubsub.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl
index 3367c192e..72edea9ce 100644
--- a/src/mod_pubsub.erl
+++ b/src/mod_pubsub.erl
@@ -2990,6 +2990,7 @@ send_last_pep(From, To) ->
Host = host(ServerHost),
Publisher = jid:tolower(From),
Owner = jid:remove_resource(Publisher),
+ RecipientIsOwner = jid:remove_resource(jid:tolower(To)) == Owner,
lists:foreach(
fun(#pubsub_node{nodeid = {_, Node}, type = Type, id = Nidx, options = Options}) ->
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
open -> true;
presence -> true;
- whitelist -> false; % subscribers are added manually
- authorize -> false; % likewise
+ %% TODO: Fix the 'whitelist'/'authorize'
+ %% cases. Currently, only node owners
+ %% receive last PEP notifications.
+ whitelist -> RecipientIsOwner;
+ authorize -> RecipientIsOwner;
roster ->
Grps = get_option(Options, roster_groups_allowed, []),
{OU, OS, _} = Owner,