Changeset

10519:641e3b7a6a39 0.11

util.pubsub: Pass subscribers trough a filter callback
author Kim Alvefur <zash@zash.se>
date Thu, 06 Jun 2019 18:13:46 +0200
parents 10518:9f50489c2033
children 10520:225fade2ab4d
files util/pubsub.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/pubsub.lua	Thu Jun 06 17:37:15 2019 +0200
+++ b/util/pubsub.lua	Thu Jun 06 18:13:46 2019 +0200
@@ -6,6 +6,7 @@
 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 @@
 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