Diff

plugins/mod_pubsub/pubsub.lib.lua @ 11768:aa6ab07544c2

mod_pubsub: Add support for limiting result size #1608
author Kim Alvefur <zash@zash.se>
date Sun, 05 Sep 2021 16:43:41 +0200
parent 11723:3ead0967e04d
child 11769:071715a18394
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sun Sep 05 16:21:10 2021 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sun Sep 05 16:43:41 2021 +0200
@@ -323,7 +323,11 @@
 		origin.send(pubsub_error_reply(stanza, "nodeid-required"));
 		return true;
 	end
-	local ok, results = service:get_items(node, stanza.attr.from, requested_items);
+	local resultspec; -- TODO rsm.get()
+	if items.attr.max_items then
+		resultspec = { max = tonumber(items.attr.max_items) };
+	end
+	local ok, results = service:get_items(node, stanza.attr.from, requested_items, resultspec);
 	if not ok then
 		origin.send(pubsub_error_reply(stanza, results));
 		return true;