Mercurial > prosody-hg
comparison plugins/mod_pubsub/mod_pubsub.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 |
| parents | 5735f931f5c4 |
| children | 376522fb3f52 |
comparison
equal
deleted
inserted
replaced
| 11855:8890eaa69446 | 11856:14a679588b7b |
|---|---|
| 44 local function tonumber_max_items(n) | 44 local function tonumber_max_items(n) |
| 45 if n == "max" then | 45 if n == "max" then |
| 46 return max_max_items; | 46 return max_max_items; |
| 47 end | 47 end |
| 48 return tonumber(n); | 48 return tonumber(n); |
| 49 end | |
| 50 | |
| 51 for _, field in ipairs(lib_pubsub.node_config_form) do | |
| 52 if field.var == "pubsub#max_items" then | |
| 53 field.range_max = max_max_items; | |
| 54 break; | |
| 55 end | |
| 49 end | 56 end |
| 50 | 57 |
| 51 local node_store = module:open_store(module.name.."_nodes"); | 58 local node_store = module:open_store(module.name.."_nodes"); |
| 52 | 59 |
| 53 local function create_simple_itemstore(node_config, node_name) --> util.cache like object | 60 local function create_simple_itemstore(node_config, node_name) --> util.cache like object |
