mod_privilege: Fix IQ privileges advertising for multiple namespaces
Before this fix, the namespaces element were wrongly nested.
--- a/mod_privilege/mod_privilege.lua Thu Mar 21 19:44:27 2024 +0100
+++ b/mod_privilege/mod_privilege.lua Fri Mar 22 11:02:04 2024 +0100
@@ -69,7 +69,7 @@
end
local iq_perm = perms["iq"]
if iq_perm ~= nil then
- message:tag("perm", {access="iq"})
+ local perm_el = st.stanza("perm", {access="iq"})
for namespace, ns_perm in pairs(iq_perm) do
local perm_type
if ns_perm.set and ns_perm.get then
@@ -81,8 +81,9 @@
else
perm_type = nil
end
- message:tag("namespace", {ns=namespace, type=perm_type})
+ perm_el:tag("namespace", {ns=namespace, type=perm_type}):up()
end
+ message:add_child(perm_el)
end
session.send(message)
end