aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-06-06 18:13:46 +0200
committerKim Alvefur <zash@zash.se>2019-06-06 18:13:46 +0200
commitf6592c459e17da5073b32f1f0a1b93ef458863ef (patch)
tree2282024f1d3297cd10023a935a79a8c7ad22232d /util
parent9be2ed1c4bf4eda2f0537cc20a486fb71aba921f (diff)
downloadprosody-f6592c459e17da5073b32f1f0a1b93ef458863ef.tar.gz
prosody-f6592c459e17da5073b32f1f0a1b93ef458863ef.zip
util.pubsub: Pass subscribers trough a filter callback
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 24f1f41d..1674b9a7 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -6,6 +6,7 @@ local service_mt = {};
local default_config = {
itemstore = function (config, _) return cache.new(config["max_items"]) end;
broadcaster = function () end;
+ subscriber_filter = function (subs) return subs end;
itemcheck = function () return true; end;
get_affiliation = function () end;
normalize_jid = function (jid) return jid; end;
@@ -567,6 +568,7 @@ function service:publish(node, actor, id, item, requested_config) --> ok, err
end
function service:broadcast(event, node, subscribers, item, actor, node_obj)
+ subscribers = self.config.subscriber_filter(subscribers, node, event);
return self.config.broadcaster(event, node, subscribers, item, actor, node_obj, self);
end