Changeset

5897:a88c43de648c

mod_privilege: Fix IQ privileges advertising for multiple namespaces Before this fix, the namespaces element were wrongly nested.
author nicoco <nicoco@nicoco.fr>
date Fri, 22 Mar 2024 11:02:04 +0100
parents 5896:8aec430ba205
children 5898:f8b9095f7862
files mod_privilege/mod_privilege.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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