aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-01-31 18:41:01 +0100
committerKim Alvefur <zash@zash.se>2013-01-31 18:41:01 +0100
commit5cfdac70c61ae6562f72868ef7b55129b166aa80 (patch)
treea1d3fc24abd3048cb23d45b860640a83baa8c261 /plugins/mod_pubsub.lua
parent9f39499470e0a0dc1e91afdcb071e48413baa96a (diff)
downloadprosody-5cfdac70c61ae6562f72868ef7b55129b166aa80.tar.gz
prosody-5cfdac70c61ae6562f72868ef7b55129b166aa80.zip
mod_pubsub, util.pubsub: Add delete action
Diffstat (limited to 'plugins/mod_pubsub.lua')
-rw-r--r--plugins/mod_pubsub.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/mod_pubsub.lua b/plugins/mod_pubsub.lua
index 96a9eaae..fe6c0b0a 100644
--- a/plugins/mod_pubsub.lua
+++ b/plugins/mod_pubsub.lua
@@ -119,6 +119,22 @@ function handlers.set_create(origin, stanza, create)
return origin.send(reply);
end
+function handlers.set_delete(origin, stanza, delete)
+ local node = delete.attr.node;
+
+ local reply, notifier;
+ if not node then
+ return origin.send(pubsub_error_reply(stanza, "nodeid-required"));
+ end
+ local ok, ret = service:delete(node, stanza.attr.from);
+ if ok then
+ reply = st.reply(stanza);
+ else
+ reply = pubsub_error_reply(stanza, ret);
+ end
+ return origin.send(reply);
+end
+
function handlers.set_subscribe(origin, stanza, subscribe)
local node, jid = subscribe.attr.node, subscribe.attr.jid;
if not (node and jid) then
@@ -258,6 +274,7 @@ local feature_map = {
retract = { "delete-items", "retract-items" };
purge = { "purge-nodes" };
publish = { "publish", autocreate_on_publish and "auto-create" };
+ delete = { "delete-nodes" };
get_items = { "retrieve-items" };
add_subscription = { "subscribe" };
get_subscriptions = { "retrieve-subscriptions" };
@@ -418,6 +435,7 @@ set_service(pubsub.new({
create = true;
publish = true;
retract = true;
+ delete = true;
get_nodes = true;
subscribe = true;