Software /
code /
prosody-modules
Changeset
4719:5a06c711649c
mod_bookmarks2: Use max_items='max' on trunk, with fallback
check_node_config() throws an error attempting to compare the
pep_max_items number with the 'max' string, which allows detecting and
support using 'max' where available.
Unsure what happens when you upgrade, that seems a problem for a future
commit! :)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 20 Oct 2021 22:16:14 +0200 |
parents | 4718:6e3254e13fb7 |
children | 4720:71bec9c21dcd |
files | mod_bookmarks2/mod_bookmarks2.lua |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_bookmarks2/mod_bookmarks2.lua Tue Oct 19 11:05:13 2021 +0100 +++ b/mod_bookmarks2/mod_bookmarks2.lua Wed Oct 20 22:16:14 2021 +0200 @@ -14,11 +14,17 @@ local default_options = { ["persist_items"] = true; -- This should be much higher, the XEP recommends 10000 but mod_pep rejects that. - ["max_items"] = module:get_option_number("pep_max_items", 256); + ["max_items"] = "max"; ["send_last_published_item"] = "never"; ["access_model"] = "whitelist"; }; +if not pcall(mod_pep.check_node_config, nil, nil, default_options) then + -- 0.11 or earlier not supporting max_items="max" trows an error here + module:log("debug", "Setting max_items=pep_max_items because 'max' is not supported in this version"); + default_options["max_items"] = module:get_option_number("pep_max_items", 256); +end + module:hook("account-disco-info", function (event) -- This Time it’s Serious! event.reply:tag("feature", { var = namespace.."#compat" }):up();