Diff

plugins/mod_pubsub/pubsub.lib.lua @ 11714:d783716103c1

mod_pubsub: Fix inclusion of publisher (fixes #1399)
author Kim Alvefur <zash@zash.se>
date Wed, 01 May 2019 22:33:22 +0200
parent 11631:6641ca266d94
child 11715:ddd6e21e58bf
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Fri Jul 23 17:13:06 2021 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Wed May 01 22:33:22 2019 +0200
@@ -607,6 +607,9 @@
 			item.attr.id = id;
 		end
 	end
+	if item then
+		item.attr.publisher = service.config.normalize_jid(stanza.attr.from);
+	end
 	local ok, ret = service:publish(node, stanza.attr.from, id, item, required_config);
 	local reply;
 	if ok then
@@ -795,8 +798,8 @@
 	return true;
 end
 
-local function create_encapsulating_item(id, payload)
-	local item = st.stanza("item", { id = id, xmlns = xmlns_pubsub });
+local function create_encapsulating_item(id, payload, publisher)
+	local item = st.stanza("item", { id = id, publisher = publisher, xmlns = xmlns_pubsub });
 	item:add_child(payload);
 	return item;
 end