Comparison

plugins/mod_pep.lua @ 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
parent 9132:2aaa192e3da5
child 9139:24a1e7a9d463
comparison
equal deleted inserted replaced
9132:2aaa192e3da5 9133:2c1d68b54c91
79 return data, err; 79 return data, err;
80 end 80 end
81 function store:set(node, data) 81 function store:set(node, data)
82 if data then 82 if data then
83 -- Save the data without subscriptions 83 -- Save the data without subscriptions
84 -- TODO Save explicit subscriptions maybe? 84 local subscribers = {};
85 for jid, sub in pairs(data.subscribers) do
86 if type(sub) ~= "table" or not sub.presence then
87 subscribers[jid] = sub;
88 end
89 end
85 data = { 90 data = {
86 name = data.name; 91 name = data.name;
87 config = data.config; 92 config = data.config;
88 affiliations = data.affiliations; 93 affiliations = data.affiliations;
89 subscribers = {}; 94 subscribers = subscribers;
90 }; 95 };
91 end 96 end
92 return node_config:set(username, node, data); 97 return node_config:set(username, node, data);
93 end 98 end
94 function store:users() 99 function store:users()