From b9a80e5643ba79038c4e29525f837ce5a368e61d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 6 Jun 2019 18:13:46 +0200 Subject: util.pubsub: Pass subscribers trough a filter callback --- util/pubsub.lua | 2 ++ 1 file changed, 2 insertions(+) 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 -- cgit v1.2.3