Comparison

util/pubsub.lua @ 8333:2abbb01cd756

pubsub: Distinguish internal representation of node config from XEP-0060 form (util.pubsub should be protocol-agnostic)
author Kim Alvefur <zash@zash.se>
date Tue, 17 Oct 2017 05:47:06 +0200
parent 8326:12408867bc86
child 8343:5df2f240173b
comparison
equal deleted inserted replaced
8332:e89b57d0d80a 8333:2abbb01cd756
3 3
4 local service = {}; 4 local service = {};
5 local service_mt = { __index = service }; 5 local service_mt = { __index = service };
6 6
7 local default_config = { __index = { 7 local default_config = { __index = {
8 itemstore = function (config, _) return cache.new(tonumber(config["pubsub#max_items"])) end; 8 itemstore = function (config, _) return cache.new(config["max_items"]) end;
9 broadcaster = function () end; 9 broadcaster = function () end;
10 get_affiliation = function () end; 10 get_affiliation = function () end;
11 capabilities = {}; 11 capabilities = {};
12 } }; 12 } };
13 local default_node_config = { __index = { 13 local default_node_config = { __index = {
14 ["pubsub#max_items"] = "20"; 14 ["persist_items"] = false;
15 ["max_items"] = 20;
15 } }; 16 } };
16 17
17 local function new(config) 18 local function new(config)
18 config = config or {}; 19 config = config or {};
19 return setmetatable({ 20 return setmetatable({