Changeset

9133:2c1d68b54c91

mod_pep: Save non-presence based subscriptions to storage
author Kim Alvefur <zash@zash.se>
date Sun, 05 Aug 2018 01:57:02 +0200
parents 9132:2aaa192e3da5
children 9134:4aa786a180f5
files plugins/mod_pep.lua
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pep.lua	Sun Aug 05 01:56:36 2018 +0200
+++ b/plugins/mod_pep.lua	Sun Aug 05 01:57:02 2018 +0200
@@ -81,12 +81,17 @@
 	function store:set(node, data)
 		if data then
 			-- Save the data without subscriptions
-			-- TODO Save explicit subscriptions maybe?
+			local subscribers = {};
+			for jid, sub in pairs(data.subscribers) do
+				if type(sub) ~= "table" or not sub.presence then
+					subscribers[jid] = sub;
+				end
+			end
 			data = {
 				name = data.name;
 				config = data.config;
 				affiliations = data.affiliations;
-				subscribers = {};
+				subscribers = subscribers;
 			};
 		end
 		return node_config:set(username, node, data);