Diff

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
parent 11732:5735f931f5c4
child 12021:376522fb3f52
line wrap: on
line diff
--- 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