Software /
code /
prosody
Diff
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 |
line wrap: on
line diff
--- a/util/pubsub.lua Sun Dec 23 15:22:49 2018 +0100 +++ b/util/pubsub.lua Sat Dec 29 21:47:51 2018 +0100 @@ -177,6 +177,20 @@ for node_name in config.nodestore:users() do service.nodes[node_name] = load_node_from_store(service, node_name); service.data[node_name] = config.itemstore(service.nodes[node_name].config, node_name); + + for jid in pairs(service.nodes[node_name].subscribers) do + local normal_jid = service.config.normalize_jid(jid); + local subs = service.subscriptions[normal_jid]; + if subs then + if not subs[jid] then + subs[jid] = { [node_name] = true }; + else + subs[jid][node_name] = true; + end + else + service.subscriptions[normal_jid] = { [jid] = { [node_name] = true } }; + end + end end end