Software /
code /
prosody
Comparison
util/pubsub.lua @ 6791:e813e8cf6046
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Aug 2015 13:05:22 +0200 |
parent | 6516:ecd8d6437053 |
parent | 6777:5de6b93d0190 |
child | 7697:bd854e762875 |
comparison
equal
deleted
inserted
replaced
6776:4412a2307c89 | 6791:e813e8cf6046 |
---|---|
1 local events = require "util.events"; | 1 local events = require "util.events"; |
2 local t_remove = table.remove; | 2 local t_remove = table.remove; |
3 | |
4 module("pubsub", package.seeall); | |
5 | 3 |
6 local service = {}; | 4 local service = {}; |
7 local service_mt = { __index = service }; | 5 local service_mt = { __index = service }; |
8 | 6 |
9 local default_config = { __index = { | 7 local default_config = { __index = { |
13 } }; | 11 } }; |
14 local default_node_config = { __index = { | 12 local default_node_config = { __index = { |
15 ["pubsub#max_items"] = "20"; | 13 ["pubsub#max_items"] = "20"; |
16 } }; | 14 } }; |
17 | 15 |
18 function new(config) | 16 local function new(config) |
19 config = config or {}; | 17 config = config or {}; |
20 return setmetatable({ | 18 return setmetatable({ |
21 config = setmetatable(config, default_config); | 19 config = setmetatable(config, default_config); |
22 node_defaults = setmetatable(config.node_defaults or {}, default_node_config); | 20 node_defaults = setmetatable(config.node_defaults or {}, default_node_config); |
23 affiliations = {}; | 21 affiliations = {}; |
440 trim_items(self.data[node], node_obj.config["pubsub#max_items"]); | 438 trim_items(self.data[node], node_obj.config["pubsub#max_items"]); |
441 | 439 |
442 return true; | 440 return true; |
443 end | 441 end |
444 | 442 |
445 return _M; | 443 return { |
444 new = new; | |
445 }; |