Comparison

plugins/mod_pubsub/mod_pubsub.lua @ 8313:21466b778bf1

mod_pubsub: Hide item persistence behind option (at least until affiliations are also persisted)
author Kim Alvefur <zash@zash.se>
date Mon, 09 Oct 2017 02:08:41 +0200
parent 8311:df8c82d285dc
child 8318:d0a7fc7614de
comparison
equal deleted inserted replaced
8312:6fd36e73082b 8313:21466b778bf1
9 9
10 local autocreate_on_publish = module:get_option_boolean("autocreate_on_publish", false); 10 local autocreate_on_publish = module:get_option_boolean("autocreate_on_publish", false);
11 local autocreate_on_subscribe = module:get_option_boolean("autocreate_on_subscribe", false); 11 local autocreate_on_subscribe = module:get_option_boolean("autocreate_on_subscribe", false);
12 local pubsub_disco_name = module:get_option_string("name", "Prosody PubSub Service"); 12 local pubsub_disco_name = module:get_option_string("name", "Prosody PubSub Service");
13 local expose_publisher = module:get_option_boolean("expose_publisher", false) 13 local expose_publisher = module:get_option_boolean("expose_publisher", false)
14
15 local enable_persistence = module:get_option_boolean("experimental_pubsub_item_persistence", false);
14 16
15 local service; 17 local service;
16 18
17 local lib_pubsub = module:require "pubsub"; 19 local lib_pubsub = module:require "pubsub";
18 local handlers = lib_pubsub.handlers; 20 local handlers = lib_pubsub.handlers;
38 40
39 local function simple_itemstore(config, node) 41 local function simple_itemstore(config, node)
40 local archive = module:open_store("pubsub_"..node, "archive"); 42 local archive = module:open_store("pubsub_"..node, "archive");
41 return lib_pubsub.simple_itemstore(archive, config, nil, node, expose_publisher); 43 return lib_pubsub.simple_itemstore(archive, config, nil, node, expose_publisher);
42 end 44 end
45
46 if enable_persistence then
47 module:log("warn", "Item persistence is an experimental feature. Note that ownership information is lost on restart.")
48 else
49 simple_itemstore = nil;
50 end
51
43 52
44 function simple_broadcast(kind, node, jids, item, actor) 53 function simple_broadcast(kind, node, jids, item, actor)
45 if item then 54 if item then
46 item = st.clone(item); 55 item = st.clone(item);
47 item.attr.xmlns = nil; -- Clear the pubsub namespace 56 item.attr.xmlns = nil; -- Clear the pubsub namespace