aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/pubsub.lib.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-26 20:29:33 +0200
committerKim Alvefur <zash@zash.se>2018-06-26 20:29:33 +0200
commit60239a64fdd524a0d46fefce942ceb64b986a2d7 (patch)
tree0cf34b11a8b2fc2ea1a4088621b474fd0d2c58f3 /plugins/mod_pubsub/pubsub.lib.lua
parent95757d103f04aee8991fbe00c8c54276a59ea8a0 (diff)
downloadprosody-60239a64fdd524a0d46fefce942ceb64b986a2d7.tar.gz
prosody-60239a64fdd524a0d46fefce942ceb64b986a2d7.zip
mod_pubsub: Support for setting affiliations (#622)
Diffstat (limited to 'plugins/mod_pubsub/pubsub.lib.lua')
-rw-r--r--plugins/mod_pubsub/pubsub.lib.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua
index 9ef9597b..a6b010fb 100644
--- a/plugins/mod_pubsub/pubsub.lib.lua
+++ b/plugins/mod_pubsub/pubsub.lib.lua
@@ -88,7 +88,7 @@ local service_method_feature_map = {
purge = { "purge-nodes" };
retract = { "delete-items", "retract-items" };
set_node_config = { "config-node" };
- -- TODO -- set_affiliation = { "modify-affiliations" };
+ set_affiliation = { "modify-affiliations" };
};
local service_config_feature_map = {
autocreate_on_publish = { "auto-create" };
@@ -500,7 +500,16 @@ function handlers.owner_set_affiliations(origin, stanza, affiliations, service)
return true;
end
- local reply = st.error_reply(stanza, "wait", "not-implemented", "yet");
+ for affiliation_tag in affiliations:childtags("affiliation") do
+ local jid = affiliation_tag.attr.jid;
+ local affiliation = affiliation_tag.attr.affiliation;
+
+ if affiliation == "none" then affiliation = nil; end
+
+ local ok, err = service:set_affiliation(node, stanza.attr.from, jid, affiliation);
+ end
+
+ local reply = st.reply(stanza);
origin.send(reply);
return true;
end