Comparison

plugins/mod_pep.lua @ 11856:14a679588b7b

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.
author Kim Alvefur <zash@zash.se>
date Wed, 20 Oct 2021 17:32:34 +0200
parent 11854:b605cbd5f13b
child 12022:eedd3eff0768
comparison
equal deleted inserted replaced
11855:8890eaa69446 11856:14a679588b7b
37 local function tonumber_max_items(n) 37 local function tonumber_max_items(n)
38 if n == "max" then 38 if n == "max" then
39 return max_max_items; 39 return max_max_items;
40 end 40 end
41 return tonumber(n); 41 return tonumber(n);
42 end
43
44 for _, field in ipairs(lib_pubsub.node_config_form) do
45 if field.var == "pubsub#max_items" then
46 field.range_max = max_max_items;
47 break;
48 end
42 end 49 end
43 50
44 function module.save() 51 function module.save()
45 return { 52 return {
46 services = services; 53 services = services;