X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fpubsub.lua;h=6d12690aa8488ab4852a2ab12d5830e315012920;hb=544e05fb68f869526b71194c3bed3edd7311f3fe;hp=2f8525b6b3e528950ec4ed008e0c6712f0ac3aea;hpb=e59d6ea986ec9c67fdda12f1861ed430ec2ea591;p=prosody.git diff --git a/util/pubsub.lua b/util/pubsub.lua index 2f8525b6..6d12690a 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -1,8 +1,6 @@ local events = require "util.events"; local t_remove = table.remove; -module("pubsub", package.seeall); - local service = {}; local service_mt = { __index = service }; @@ -15,7 +13,7 @@ local default_node_config = { __index = { ["pubsub#max_items"] = "20"; } }; -function new(config) +local function new(config) config = config or {}; return setmetatable({ config = setmetatable(config, default_config); @@ -294,7 +292,7 @@ function service:publish(node, actor, id, item) node_data[id] = item; trim_items(node_data, node_obj.config["pubsub#max_items"]); self.events.fire_event("item-published", { node = node, actor = actor, id = id, item = item }); - self.config.broadcaster("items", node, node_obj.subscribers, item); + self.config.broadcaster("items", node, node_obj.subscribers, item, actor); return true; end @@ -442,4 +440,6 @@ function service:set_node_config(node, actor, new_config) return true; end -return _M; +return { + new = new; +};