# HG changeset patch # User Kim Alvefur # Date 1634743954 -7200 # Node ID 14a679588b7b55855b6516382b154f1077567e3b # Parent 8890eaa6944614f2a1feef8bdbdd07cafb8ab92f mod_pubsub,mod_pep: Advertise maximum number of items via XEP-0122 Clients would generally be using the "max" symbol instead of discovering this, but this also gets us validation and earlier rejection of out of bounds values. diff -r 8890eaa69446 -r 14a679588b7b plugins/mod_pep.lua --- a/plugins/mod_pep.lua Wed Oct 20 17:31:24 2021 +0200 +++ b/plugins/mod_pep.lua Wed Oct 20 17:32:34 2021 +0200 @@ -41,6 +41,13 @@ return tonumber(n); end +for _, field in ipairs(lib_pubsub.node_config_form) do + if field.var == "pubsub#max_items" then + field.range_max = max_max_items; + break; + end +end + function module.save() return { services = services; diff -r 8890eaa69446 -r 14a679588b7b plugins/mod_pubsub/mod_pubsub.lua --- a/plugins/mod_pubsub/mod_pubsub.lua Wed Oct 20 17:31:24 2021 +0200 +++ b/plugins/mod_pubsub/mod_pubsub.lua Wed Oct 20 17:32:34 2021 +0200 @@ -48,6 +48,13 @@ return tonumber(n); end +for _, field in ipairs(lib_pubsub.node_config_form) do + if field.var == "pubsub#max_items" then + field.range_max = max_max_items; + break; + end +end + local node_store = module:open_store(module.name.."_nodes"); local function create_simple_itemstore(node_config, node_name) --> util.cache like object diff -r 8890eaa69446 -r 14a679588b7b spec/scansion/pubsub_config.scs --- a/spec/scansion/pubsub_config.scs Wed Oct 20 17:31:24 2021 +0200 +++ b/spec/scansion/pubsub_config.scs Wed Oct 20 17:32:34 2021 +0200 @@ -49,7 +49,7 @@ - + 1 @@ -139,7 +139,7 @@ - + 1 diff -r 8890eaa69446 -r 14a679588b7b spec/scansion/pubsub_max_items.scs --- a/spec/scansion/pubsub_max_items.scs Wed Oct 20 17:31:24 2021 +0200 +++ b/spec/scansion/pubsub_max_items.scs Wed Oct 20 17:32:34 2021 +0200 @@ -44,7 +44,7 @@ - + 20 diff -r 8890eaa69446 -r 14a679588b7b spec/scansion/pubsub_multi_items.scs --- a/spec/scansion/pubsub_multi_items.scs Wed Oct 20 17:31:24 2021 +0200 +++ b/spec/scansion/pubsub_multi_items.scs Wed Oct 20 17:32:34 2021 +0200 @@ -44,7 +44,7 @@ - + 20 diff -r 8890eaa69446 -r 14a679588b7b spec/scansion/pubsub_preconditions.scs --- a/spec/scansion/pubsub_preconditions.scs Wed Oct 20 17:31:24 2021 +0200 +++ b/spec/scansion/pubsub_preconditions.scs Wed Oct 20 17:32:34 2021 +0200 @@ -48,7 +48,7 @@ - + 1 @@ -138,7 +138,7 @@ - + 1