diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/pubsub.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index 811f4a15..f667295e 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -3,8 +3,19 @@ module("pubsub", package.seeall); local service = {}; local service_mt = { __index = service }; -function new(cb) - return setmetatable({ cb = cb or {}, nodes = {} }, service_mt); +local default_config = { + broadcaster = function () end; + get_affiliation = function () end; + capabilities = {}; +}; + +function new(config) + config = config or {}; + return setmetatable({ + config = setmetatable(config, { __index = default_config }); + affiliations = {}; + nodes = {}; + }, service_mt); end function service:add_subscription(node, actor, jid) |