Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 9827:fd8aaab6669c 0.11
mod_pep: Simplify configuration for node data (fixes #1320)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 22 Feb 2019 07:35:44 +0100 |
parent | 9597:17d43543f9b6 |
child | 9829:fdc42f685557 |
child | 10036:045209b41b3a |
comparison
equal
deleted
inserted
replaced
9822:13c2707d2417 | 9827:fd8aaab6669c |
---|---|
6 local st = require "util.stanza"; | 6 local st = require "util.stanza"; |
7 local calculate_hash = require "util.caps".calculate_hash; | 7 local calculate_hash = require "util.caps".calculate_hash; |
8 local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; | 8 local is_contact_subscribed = require "core.rostermanager".is_contact_subscribed; |
9 local cache = require "util.cache"; | 9 local cache = require "util.cache"; |
10 local set = require "util.set"; | 10 local set = require "util.set"; |
11 local storagemanager = require "core.storagemanager"; | |
11 | 12 |
12 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; | 13 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; |
13 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event"; | 14 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event"; |
14 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; | 15 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; |
15 | 16 |
111 end | 112 end |
112 return store; | 113 return store; |
113 end | 114 end |
114 | 115 |
115 local function simple_itemstore(username) | 116 local function simple_itemstore(username) |
117 local driver = storagemanager.get_driver(module.host, "pep_data"); | |
116 return function (config, node) | 118 return function (config, node) |
117 if config["persist_items"] then | 119 if config["persist_items"] then |
118 module:log("debug", "Creating new persistent item store for user %s, node %q", username, node); | 120 module:log("debug", "Creating new persistent item store for user %s, node %q", username, node); |
119 local archive = module:open_store("pep_"..node, "archive"); | 121 local archive = driver:open("pep_"..node, "archive"); |
120 return lib_pubsub.archive_itemstore(archive, config, username, node, false); | 122 return lib_pubsub.archive_itemstore(archive, config, username, node, false); |
121 else | 123 else |
122 module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node); | 124 module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node); |
123 return cache.new(tonumber(config["max_items"])); | 125 return cache.new(tonumber(config["max_items"])); |
124 end | 126 end |