diff options
author | Kim Alvefur <zash@zash.se> | 2018-12-29 21:47:51 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-12-29 21:47:51 +0100 |
commit | 9061782b9a97df2ef95437d632335ae67eb7ffb6 (patch) | |
tree | a5c384ecfd17b457aed5a6abb5289375eeed8b9b /util | |
parent | 09cee9f95866a2f928ee77f49bcdf08cc9e5f9e8 (diff) | |
download | prosody-9061782b9a97df2ef95437d632335ae67eb7ffb6.tar.gz prosody-9061782b9a97df2ef95437d632335ae67eb7ffb6.zip |
util.pubsub: Restore subscription index from stored data (fixes #1281)
Diffstat (limited to 'util')
-rw-r--r-- | util/pubsub.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index fafae50a..47e526a7 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -177,6 +177,20 @@ local function new(config) 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 |