mod_pep: Save non-presence based subscriptions to storage
authorKim Alvefur <zash@zash.se>
Sun, 05 Aug 2018 01:57:02 +0200
changeset 9136 2c1d68b54c91
parent 9135 2aaa192e3da5
child 9137 4aa786a180f5
mod_pep: Save non-presence based subscriptions to storage
plugins/mod_pep.lua
--- 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);