Comparison

plugins/mod_pubsub/pubsub.lib.lua @ 8937:0ae46e6ea647

mod_pubsub: Add boilerplate for changing affiliations
author Kim Alvefur <zash@zash.se>
date Tue, 26 Jun 2018 20:00:07 +0200
parent 8935:a825ef6de45a
child 8938:384ef9732b81
comparison
equal deleted inserted replaced
8936:7b75c7ec926e 8937:0ae46e6ea647
481 481
482 origin.send(reply); 482 origin.send(reply);
483 return true; 483 return true;
484 end 484 end
485 485
486 --[[ TODO
487 function handlers.owner_set_affiliations(origin, stanza, affiliations, service) 486 function handlers.owner_set_affiliations(origin, stanza, affiliations, service)
488 end 487 local node = affiliations.attr.node;
489 --]] 488 if not node then
489 origin.send(pubsub_error_reply(stanza, "nodeid-required"));
490 return true;
491 end
492 if not service:may(node, stanza.attr.from, "set_affiliation") then
493 origin.send(pubsub_error_reply(stanza, "forbidden"));
494 return true;
495 end
496
497 local node_obj = service.nodes[node];
498 if not node_obj then
499 origin.send(pubsub_error_reply(stanza, "item-not-found"));
500 return true;
501 end
502
503 local reply = st.error_reply(stanza, "wait", "not-implemented", "yet");
504 origin.send(reply);
505 return true;
506 end
490 507
491 local function create_encapsulating_item(id, payload) 508 local function create_encapsulating_item(id, payload)
492 local item = st.stanza("item", { id = id, xmlns = xmlns_pubsub }); 509 local item = st.stanza("item", { id = id, xmlns = xmlns_pubsub });
493 item:add_child(payload); 510 item:add_child(payload);
494 return item; 511 return item;