Software /
code /
prosody
Comparison
plugins/mod_pep_plus.lua @ 8300:7759eb130938
mod_pep_plus, mod_pubsub: Store node content in separate archive stores
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 08 Oct 2017 01:56:44 +0200 |
parent | 8218:2c75a5ba58fc |
child | 8303:053cf683c2c7 |
comparison
equal
deleted
inserted
replaced
8299:756a2a00e7e7 | 8300:7759eb130938 |
---|---|
17 | 17 |
18 local services = {}; | 18 local services = {}; |
19 local recipients = {}; | 19 local recipients = {}; |
20 local hash_map = {}; | 20 local hash_map = {}; |
21 | 21 |
22 local archive = module:open_store("pubsub", "archive"); | |
23 | |
24 function module.save() | 22 function module.save() |
25 return { services = services }; | 23 return { services = services }; |
26 end | 24 end |
27 | 25 |
28 function module.restore(data) | 26 function module.restore(data) |
36 return is_contact_subscribed(username, host, recipient_bare); | 34 return is_contact_subscribed(username, host, recipient_bare); |
37 end | 35 end |
38 | 36 |
39 local function simple_itemstore(user) | 37 local function simple_itemstore(user) |
40 return function (config, node) | 38 return function (config, node) |
39 module:log("debug", "new simple_itemstore(%q, %q)", user, node); | |
40 local archive = module:open_store("pep_"..node, "archive"); | |
41 return lib_pubsub.simple_itemstore(archive, config, user, node, false); | 41 return lib_pubsub.simple_itemstore(archive, config, user, node, false); |
42 end | 42 end |
43 end | 43 end |
44 | 44 |
45 local function get_broadcaster(name) | 45 local function get_broadcaster(name) |
60 end | 60 end |
61 return simple_broadcast; | 61 return simple_broadcast; |
62 end | 62 end |
63 | 63 |
64 function get_pep_service(name) | 64 function get_pep_service(name) |
65 module:log("debug", "get_pep_service(%q)"); | |
65 local service = services[name]; | 66 local service = services[name]; |
66 if service then | 67 if service then |
67 return service; | 68 return service; |
68 end | 69 end |
69 service = pubsub.new({ | 70 service = pubsub.new({ |