Software /
code /
prosody
Comparison
util/pubsub.lua @ 8501:8d9e2c2095dd
util.pubsub: Move service methods object creation (just code reorganisation)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 02 Feb 2018 19:29:17 +0000 |
parent | 8500:9bf00d0734c8 |
child | 8502:6c2c2fc4b8dd |
comparison
equal
deleted
inserted
replaced
8500:9bf00d0734c8 | 8501:8d9e2c2095dd |
---|---|
1 local events = require "util.events"; | 1 local events = require "util.events"; |
2 local cache = require "util.cache"; | 2 local cache = require "util.cache"; |
3 | 3 |
4 local service = {}; | 4 local service_mt = {}; |
5 local service_mt = { __index = service }; | |
6 | 5 |
7 local default_config = { | 6 local default_config = { |
8 itemstore = function (config, _) return cache.new(config["max_items"]) end; | 7 itemstore = function (config, _) return cache.new(config["max_items"]) end; |
9 broadcaster = function () end; | 8 broadcaster = function () end; |
10 get_affiliation = function () end; | 9 get_affiliation = function () end; |
28 nodes = {}; | 27 nodes = {}; |
29 data = {}; | 28 data = {}; |
30 events = events.new(); | 29 events = events.new(); |
31 }, service_mt); | 30 }, service_mt); |
32 end | 31 end |
32 | |
33 --- Service methods | |
34 | |
35 local service = {}; | |
36 service_mt.__index = service; | |
33 | 37 |
34 function service:jids_equal(jid1, jid2) | 38 function service:jids_equal(jid1, jid2) |
35 local normalize = self.config.normalize_jid; | 39 local normalize = self.config.normalize_jid; |
36 return normalize(jid1) == normalize(jid2); | 40 return normalize(jid1) == normalize(jid2); |
37 end | 41 end |