aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-01-28 01:41:42 +0100
committerKim Alvefur <zash@zash.se>2019-01-28 01:41:42 +0100
commit9ea35767dd8e10e98bd758a53dbcf50a63d63f1a (patch)
treed44d8cdffa83285835de95fa47023ffe3726cb1e /plugins/mod_pubsub/pubsub.lib.lua
parentce083980dc98fbd7f40a2db3dcfa37ae8591ffee (diff)
downloadprosody-9ea35767dd8e10e98bd758a53dbcf50a63d63f1a.tar.gz
prosody-9ea35767dd8e10e98bd758a53dbcf50a63d63f1a.zip
mod_pubsub: Support requests for multiple items (fixes #1305)
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 1bd5fa33..50ef7ddf 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -295,14 +295,20 @@ end
function handlers.get_items(origin, stanza, items, service)
local node = items.attr.node;
- local item = items:get_child("item");
- local item_id = item and item.attr.id;
+
+ local requested_items = {};
+ for item in items:childtags("item") do
+ table.insert(requested_items, item.attr.id);
+ end
+ if requested_items[1] == nil then
+ requested_items = nil;
+ end
if not node then
origin.send(pubsub_error_reply(stanza, "nodeid-required"));
return true;
end
- local ok, results = service:get_items(node, stanza.attr.from, item_id);
+ local ok, results = service:get_items(node, stanza.attr.from, requested_items);
if not ok then
origin.send(pubsub_error_reply(stanza, results));
return true;