aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-02-01 15:09:04 +0000
committerMatthew Wild <mwild1@gmail.com>2018-02-01 15:09:04 +0000
commit1f51b7920e1db51658e2b23704cc84ee4d0781c2 (patch)
tree82c30289103e1d2379273074248905868ab64a90 /util
parentdee4b0758338a3478bb61aec802cd4604d390084 (diff)
downloadprosody-1f51b7920e1db51658e2b23704cc84ee4d0781c2.tar.gz
prosody-1f51b7920e1db51658e2b23704cc84ee4d0781c2.zip
util.pubsub: For clarity, split config tables from their metatables
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 607ec49d..f606bdd8 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -4,22 +4,25 @@ local cache = require "util.cache";
local service = {};
local service_mt = { __index = service };
-local default_config = { __index = {
+local default_config = {
itemstore = function (config, _) return cache.new(config["max_items"]) end;
broadcaster = function () end;
get_affiliation = function () end;
capabilities = {};
-} };
-local default_node_config = { __index = {
+};
+local default_config_mt = { __index = default_config };
+
+local default_node_config = {
["persist_items"] = false;
["max_items"] = 20;
-} };
+};
+local default_node_config_mt = { __index = default_node_config };
local function new(config)
config = config or {};
return setmetatable({
- config = setmetatable(config, default_config);
- node_defaults = setmetatable(config.node_defaults or {}, default_node_config);
+ config = setmetatable(config, default_config_mt);
+ node_defaults = setmetatable(config.node_defaults or {}, default_node_config_mt);
affiliations = {};
subscriptions = {};
nodes = {};