Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 9829:fdc42f685557
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 22 Feb 2019 07:40:30 +0100 |
parent | 9723:3c6e266391a2 |
parent | 9827:fd8aaab6669c |
child | 10037:e01f38acde74 |
comparison
equal
deleted
inserted
replaced
9826:bdc2a024933b | 9829:fdc42f685557 |
---|---|
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 new_id = require "util.id".medium; | 11 local new_id = require "util.id".medium; |
12 local storagemanager = require "core.storagemanager"; | |
12 | 13 |
13 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; | 14 local xmlns_pubsub = "http://jabber.org/protocol/pubsub"; |
14 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event"; | 15 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event"; |
15 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; | 16 local xmlns_pubsub_owner = "http://jabber.org/protocol/pubsub#owner"; |
16 | 17 |
112 end | 113 end |
113 return store; | 114 return store; |
114 end | 115 end |
115 | 116 |
116 local function simple_itemstore(username) | 117 local function simple_itemstore(username) |
118 local driver = storagemanager.get_driver(module.host, "pep_data"); | |
117 return function (config, node) | 119 return function (config, node) |
118 if config["persist_items"] then | 120 if config["persist_items"] then |
119 module:log("debug", "Creating new persistent item store for user %s, node %q", username, node); | 121 module:log("debug", "Creating new persistent item store for user %s, node %q", username, node); |
120 local archive = module:open_store("pep_"..node, "archive"); | 122 local archive = driver:open("pep_"..node, "archive"); |
121 return lib_pubsub.archive_itemstore(archive, config, username, node, false); | 123 return lib_pubsub.archive_itemstore(archive, config, username, node, false); |
122 else | 124 else |
123 module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node); | 125 module:log("debug", "Creating new ephemeral item store for user %s, node %q", username, node); |
124 return cache.new(tonumber(config["max_items"])); | 126 return cache.new(tonumber(config["max_items"])); |
125 end | 127 end |