plugins/mod_pubsub/pubsub.lib.lua
changeset 11719 ddd6e21e58bf
parent 11718 d783716103c1
child 11727 3ead0967e04d
equal deleted inserted replaced
11718:d783716103c1 11719:ddd6e21e58bf
   326 	if not ok then
   326 	if not ok then
   327 		origin.send(pubsub_error_reply(stanza, results));
   327 		origin.send(pubsub_error_reply(stanza, results));
   328 		return true;
   328 		return true;
   329 	end
   329 	end
   330 
   330 
       
   331 	local expose_publisher = service.config.expose_publisher;
       
   332 
   331 	local data = st.stanza("items", { node = node });
   333 	local data = st.stanza("items", { node = node });
   332 	for _, id in ipairs(results) do
   334 	for _, id in ipairs(results) do
   333 		data:add_child(results[id]);
   335 		local item = results[id];
       
   336 		if not expose_publisher then
       
   337 			item = st.clone(item);
       
   338 			item.attr.publisher = nil;
       
   339 		end
       
   340 		data:add_child(item);
   334 	end
   341 	end
   335 	local reply = st.reply(stanza)
   342 	local reply = st.reply(stanza)
   336 		:tag("pubsub", { xmlns = xmlns_pubsub })
   343 		:tag("pubsub", { xmlns = xmlns_pubsub })
   337 			:add_child(data);
   344 			:add_child(data);
   338 	origin.send(reply);
   345 	origin.send(reply);