Mercurial > prosody-modules
comparison mod_privilege/mod_privilege.lua @ 5873: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 | cce12a660b98 |
| children |
comparison
equal
deleted
inserted
replaced
| 5872:8aec430ba205 | 5873:a88c43de648c |
|---|---|
| 67 message:tag("perm", {access=perm, type=perms[perm]}):up() | 67 message:tag("perm", {access=perm, type=perms[perm]}):up() |
| 68 end | 68 end |
| 69 end | 69 end |
| 70 local iq_perm = perms["iq"] | 70 local iq_perm = perms["iq"] |
| 71 if iq_perm ~= nil then | 71 if iq_perm ~= nil then |
| 72 message:tag("perm", {access="iq"}) | 72 local perm_el = st.stanza("perm", {access="iq"}) |
| 73 for namespace, ns_perm in pairs(iq_perm) do | 73 for namespace, ns_perm in pairs(iq_perm) do |
| 74 local perm_type | 74 local perm_type |
| 75 if ns_perm.set and ns_perm.get then | 75 if ns_perm.set and ns_perm.get then |
| 76 perm_type = "both" | 76 perm_type = "both" |
| 77 elseif ns_perm.set then | 77 elseif ns_perm.set then |
| 79 elseif ns_perm.get then | 79 elseif ns_perm.get then |
| 80 perm_type = "get" | 80 perm_type = "get" |
| 81 else | 81 else |
| 82 perm_type = nil | 82 perm_type = nil |
| 83 end | 83 end |
| 84 message:tag("namespace", {ns=namespace, type=perm_type}) | 84 perm_el:tag("namespace", {ns=namespace, type=perm_type}):up() |
| 85 end | 85 end |
| 86 message:add_child(perm_el) | |
| 86 end | 87 end |
| 87 session.send(message) | 88 session.send(message) |
| 88 end | 89 end |
| 89 | 90 |
| 90 local function set_presence_perm_set(to_jid, perms) | 91 local function set_presence_perm_set(to_jid, perms) |
