# HG changeset patch # User Kim Alvefur # Date 1559837626 -7200 # Node ID 641e3b7a6a3950dce9da9b05d6fad8259228da69 # Parent 9f50489c20334e7fd8043504b014a2f1274dea86 util.pubsub: Pass subscribers trough a filter callback diff -r 9f50489c2033 -r 641e3b7a6a39 util/pubsub.lua --- 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