Software /
code /
prosody
Changeset
8937:0ae46e6ea647
mod_pubsub: Add boilerplate for changing affiliations
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 26 Jun 2018 20:00:07 +0200 |
parents | 8936:7b75c7ec926e |
children | 8938:384ef9732b81 |
files | plugins/mod_pubsub/pubsub.lib.lua |
diffstat | 1 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua Tue Jun 26 19:49:29 2018 +0200 +++ b/plugins/mod_pubsub/pubsub.lib.lua Tue Jun 26 20:00:07 2018 +0200 @@ -483,10 +483,27 @@ return true; end ---[[ TODO function handlers.owner_set_affiliations(origin, stanza, affiliations, service) + local node = affiliations.attr.node; + if not node then + origin.send(pubsub_error_reply(stanza, "nodeid-required")); + return true; + end + if not service:may(node, stanza.attr.from, "set_affiliation") then + origin.send(pubsub_error_reply(stanza, "forbidden")); + return true; + end + + local node_obj = service.nodes[node]; + if not node_obj then + origin.send(pubsub_error_reply(stanza, "item-not-found")); + return true; + end + + local reply = st.error_reply(stanza, "wait", "not-implemented", "yet"); + origin.send(reply); + return true; end ---]] local function create_encapsulating_item(id, payload) local item = st.stanza("item", { id = id, xmlns = xmlns_pubsub });