aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-12-21 03:22:40 +0000
committerMatthew Wild <mwild1@gmail.com>2010-12-21 03:22:40 +0000
commit503c9d4255d0adaeb1aadecca2572facff57ecb0 (patch)
tree28e42eaccbbd2657d62077f884cce44ef2837fa9 /util/pubsub.lua
parent224333805425866e33c721ec9f5435ec38ad0e0b (diff)
downloadprosody-503c9d4255d0adaeb1aadecca2572facff57ecb0.tar.gz
prosody-503c9d4255d0adaeb1aadecca2572facff57ecb0.zip
util.pubsub: Modify new() to take a config, and add a default config via a metatable
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua15
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)