Software / code / prosody
Comparison
plugins/mod_pubsub/mod_pubsub.lua @ 8311:df8c82d285dc
mod_pubsub: Restore persistence with one archive per node
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 09 Oct 2017 01:45:20 +0200 |
| parent | 8221:4989a625419a |
| child | 8313:21466b778bf1 |
comparison
equal
deleted
inserted
replaced
| 8310:1759491b53db | 8311:df8c82d285dc |
|---|---|
| 18 local handlers = lib_pubsub.handlers; | 18 local handlers = lib_pubsub.handlers; |
| 19 | 19 |
| 20 module:depends("disco"); | 20 module:depends("disco"); |
| 21 module:add_identity("pubsub", "service", pubsub_disco_name); | 21 module:add_identity("pubsub", "service", pubsub_disco_name); |
| 22 module:add_feature("http://jabber.org/protocol/pubsub"); | 22 module:add_feature("http://jabber.org/protocol/pubsub"); |
| 23 | |
| 24 --[[ TODO Disabled until config persistence is implemented | |
| 25 local archive = module:open_store("pubsub", "archive"); | |
| 26 --]] | |
| 27 | 23 |
| 28 function handle_pubsub_iq(event) | 24 function handle_pubsub_iq(event) |
| 29 local origin, stanza = event.origin, event.stanza; | 25 local origin, stanza = event.origin, event.stanza; |
| 30 local pubsub_tag = stanza.tags[1]; | 26 local pubsub_tag = stanza.tags[1]; |
| 31 local action = pubsub_tag.tags[1]; | 27 local action = pubsub_tag.tags[1]; |
| 38 handler(origin, stanza, action, service); | 34 handler(origin, stanza, action, service); |
| 39 return true; | 35 return true; |
| 40 end | 36 end |
| 41 end | 37 end |
| 42 | 38 |
| 43 --[[ TODO Disabled until config persistence is implemented | |
| 44 local function simple_itemstore(config, node) | 39 local function simple_itemstore(config, node) |
| 40 local archive = module:open_store("pubsub_"..node, "archive"); | |
| 45 return lib_pubsub.simple_itemstore(archive, config, nil, node, expose_publisher); | 41 return lib_pubsub.simple_itemstore(archive, config, nil, node, expose_publisher); |
| 46 end | 42 end |
| 47 --]] | |
| 48 | 43 |
| 49 function simple_broadcast(kind, node, jids, item, actor) | 44 function simple_broadcast(kind, node, jids, item, actor) |
| 50 if item then | 45 if item then |
| 51 item = st.clone(item); | 46 item = st.clone(item); |
| 52 item.attr.xmlns = nil; -- Clear the pubsub namespace | 47 item.attr.xmlns = nil; -- Clear the pubsub namespace |
| 232 }; | 227 }; |
| 233 | 228 |
| 234 autocreate_on_publish = autocreate_on_publish; | 229 autocreate_on_publish = autocreate_on_publish; |
| 235 autocreate_on_subscribe = autocreate_on_subscribe; | 230 autocreate_on_subscribe = autocreate_on_subscribe; |
| 236 | 231 |
| 237 --[[ TODO Disabled until config persistence is implemented | |
| 238 itemstore = simple_itemstore; | 232 itemstore = simple_itemstore; |
| 239 --]] | |
| 240 broadcaster = simple_broadcast; | 233 broadcaster = simple_broadcast; |
| 241 get_affiliation = get_affiliation; | 234 get_affiliation = get_affiliation; |
| 242 | 235 |
| 243 normalize_jid = jid_bare; | 236 normalize_jid = jid_bare; |
| 244 })); | 237 })); |