# HG changeset patch # User Kim Alvefur # Date 1548636102 -3600 # Node ID 7aad9eb7f050c87093eaebce3cceff594f3d6526 # Parent 7f84d7f77a001033910c9413328789f8aeb9352d mod_pubsub: Support requests for multiple items (fixes #1305) diff -r 7f84d7f77a00 -r 7aad9eb7f050 plugins/mod_pubsub/pubsub.lib.lua --- a/plugins/mod_pubsub/pubsub.lib.lua Mon Jan 28 01:41:01 2019 +0100 +++ b/plugins/mod_pubsub/pubsub.lib.lua Mon Jan 28 01:41:42 2019 +0100 @@ -295,14 +295,20 @@ 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;