Software /
code /
prosody
Comparison
plugins/mod_pubsub/pubsub.lib.lua @ 8938:384ef9732b81
mod_pubsub: Support for setting affiliations (#622)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 26 Jun 2018 20:29:33 +0200 |
parent | 8937:0ae46e6ea647 |
child | 8939:849c4683eaa0 |
comparison
equal
deleted
inserted
replaced
8937:0ae46e6ea647 | 8938:384ef9732b81 |
---|---|
86 node_defaults = { "retrieve-default" }; | 86 node_defaults = { "retrieve-default" }; |
87 publish = { "publish" }; | 87 publish = { "publish" }; |
88 purge = { "purge-nodes" }; | 88 purge = { "purge-nodes" }; |
89 retract = { "delete-items", "retract-items" }; | 89 retract = { "delete-items", "retract-items" }; |
90 set_node_config = { "config-node" }; | 90 set_node_config = { "config-node" }; |
91 -- TODO -- set_affiliation = { "modify-affiliations" }; | 91 set_affiliation = { "modify-affiliations" }; |
92 }; | 92 }; |
93 local service_config_feature_map = { | 93 local service_config_feature_map = { |
94 autocreate_on_publish = { "auto-create" }; | 94 autocreate_on_publish = { "auto-create" }; |
95 }; | 95 }; |
96 | 96 |
498 if not node_obj then | 498 if not node_obj then |
499 origin.send(pubsub_error_reply(stanza, "item-not-found")); | 499 origin.send(pubsub_error_reply(stanza, "item-not-found")); |
500 return true; | 500 return true; |
501 end | 501 end |
502 | 502 |
503 local reply = st.error_reply(stanza, "wait", "not-implemented", "yet"); | 503 for affiliation_tag in affiliations:childtags("affiliation") do |
504 local jid = affiliation_tag.attr.jid; | |
505 local affiliation = affiliation_tag.attr.affiliation; | |
506 | |
507 if affiliation == "none" then affiliation = nil; end | |
508 | |
509 local ok, err = service:set_affiliation(node, stanza.attr.from, jid, affiliation); | |
510 end | |
511 | |
512 local reply = st.reply(stanza); | |
504 origin.send(reply); | 513 origin.send(reply); |
505 return true; | 514 return true; |
506 end | 515 end |
507 | 516 |
508 local function create_encapsulating_item(id, payload) | 517 local function create_encapsulating_item(id, payload) |