Changeset

5376:ad6e9b0fd15b

mod_remote_roster: Set id on generated iq stanzas (thanks @agwa) Fixes 'iq stanzas require an id attribute' error from util.stanza.
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Apr 2023 16:58:48 +0100
parents 5375:8b7d97f0ae8a
children 5377:ca477408f90b
files mod_remote_roster/mod_remote_roster.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_remote_roster/mod_remote_roster.lua	Wed Apr 26 23:41:49 2023 +0200
+++ b/mod_remote_roster/mod_remote_roster.lua	Thu Apr 27 16:58:48 2023 +0100
@@ -19,6 +19,7 @@
 local rm_roster_push = require "core.rostermanager".roster_push;
 local user_exists = require "core.usermanager".user_exists;
 local add_task = require "util.timer".add_task;
+local new_id = require "util.id".short;
 
 module:hook("iq-get/bare/jabber:iq:roster:query", function(event)
 	local origin, stanza = event.origin, event.stanza;
@@ -138,7 +139,7 @@
 	if roster then
 		local item = roster[jid];
 		local contact_node, contact_host = jid_split(jid);
-		local stanza = st.iq({ type="set", from=node.."@"..host, to=contact_host }):query("jabber:iq:roster");
+		local stanza = st.iq({ type="set", from=node.."@"..host, to=contact_host, id = new_id() }):query("jabber:iq:roster");
 		if item then
 			stanza:tag("item", { jid = jid, subscription = item.subscription, name = item.name, ask = item.ask });
 			for group in pairs(item.groups) do