Diff

plugins/mod_pep_plus.lua @ 8215:835bb32c36b4

mod_pep_plus: Add item persistency.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 15 Apr 2017 09:35:33 +0100
parent 8214:da8bc600902a
child 8218:2c75a5ba58fc
line wrap: on
line diff
--- a/plugins/mod_pep_plus.lua	Sat Apr 15 01:26:19 2017 +0100
+++ b/plugins/mod_pep_plus.lua	Sat Apr 15 09:35:33 2017 +0100
@@ -19,6 +19,8 @@
 local recipients = {};
 local hash_map = {};
 
+local archive = module:open_store("pubsub", "archive");
+
 function module.save()
 	return { services = services };
 end
@@ -34,6 +36,10 @@
 	return is_contact_subscribed(username, host, recipient_bare);
 end
 
+local function simple_itemstore(config, node)
+	return lib_pubsub.simple_itemstore(archive, config, node, false);
+end
+
 local function get_broadcaster(name)
 	local function simple_broadcast(kind, node, jids, item)
 		if item then
@@ -160,6 +166,7 @@
 		autocreate_on_publish = true;
 		autocreate_on_subscribe = true;
 
+		itemstore = simple_itemstore;
 		broadcaster = get_broadcaster(name);
 		get_affiliation = function (jid)
 			if jid_bare(jid) == name then