Changeset

8811:f2d35eee69c9

mod_pubsub: Set an id attribute on outgoing event messages https://xmpp.org/extensions/xep-0060.html#impl-bounce > a pubsub service SHOULD ensure that the <message/> stanza for each > event notification it generates possesses an 'id' attribute with a > value
author Kim Alvefur <zash@zash.se>
date Mon, 21 May 2018 00:24:50 +0200
parents 8810:9f8a746f99c1
children 8812:3d7fceaff230
files plugins/mod_pubsub/mod_pubsub.lua
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_pubsub/mod_pubsub.lua	Sun May 20 15:21:57 2018 +0200
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Mon May 21 00:24:50 2018 +0200
@@ -2,6 +2,7 @@
 local st = require "util.stanza";
 local jid_bare = require "util.jid".bare;
 local usermanager = require "core.usermanager";
+local new_id = require "util.id".medium;
 
 local xmlns_pubsub = "http://jabber.org/protocol/pubsub";
 local xmlns_pubsub_event = "http://jabber.org/protocol/pubsub#event";
@@ -48,7 +49,9 @@
 			item.attr.publisher = actor
 		end
 	end
-	local message = st.message({ from = module.host, type = "headline" })
+
+	local id = new_id();
+	local message = st.message({ from = module.host, type = "headline", id = id })
 		:tag("event", { xmlns = xmlns_pubsub_event })
 			:tag(kind, { node = node })
 				:add_child(item);