Software /
code /
prosody
Comparison
util/pubsub.lua @ 9742:18eca6afb367 0.11
util.pubsub: Restore subscription index from stored data (fixes #1281)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 29 Dec 2018 21:47:51 +0100 |
parent | 9539:b30455212f89 |
child | 9816:7f84d7f77a00 |
comparison
equal
deleted
inserted
replaced
9729:4f6413ec08a8 | 9742:18eca6afb367 |
---|---|
175 -- Load nodes from storage, if we have a store and it supports iterating over stored items | 175 -- Load nodes from storage, if we have a store and it supports iterating over stored items |
176 if config.nodestore and config.nodestore.users then | 176 if config.nodestore and config.nodestore.users then |
177 for node_name in config.nodestore:users() do | 177 for node_name in config.nodestore:users() do |
178 service.nodes[node_name] = load_node_from_store(service, node_name); | 178 service.nodes[node_name] = load_node_from_store(service, node_name); |
179 service.data[node_name] = config.itemstore(service.nodes[node_name].config, node_name); | 179 service.data[node_name] = config.itemstore(service.nodes[node_name].config, node_name); |
180 | |
181 for jid in pairs(service.nodes[node_name].subscribers) do | |
182 local normal_jid = service.config.normalize_jid(jid); | |
183 local subs = service.subscriptions[normal_jid]; | |
184 if subs then | |
185 if not subs[jid] then | |
186 subs[jid] = { [node_name] = true }; | |
187 else | |
188 subs[jid][node_name] = true; | |
189 end | |
190 else | |
191 service.subscriptions[normal_jid] = { [jid] = { [node_name] = true } }; | |
192 end | |
193 end | |
180 end | 194 end |
181 end | 195 end |
182 | 196 |
183 return service; | 197 return service; |
184 end | 198 end |