aboutsummaryrefslogtreecommitdiffstats
path: root/util/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 /util/pubsub.lua
parent9f39499470e0a0dc1e91afdcb071e48413baa96a (diff)
downloadprosody-5cfdac70c61ae6562f72868ef7b55129b166aa80.tar.gz
prosody-5cfdac70c61ae6562f72868ef7b55129b166aa80.zip
mod_pubsub, util.pubsub: Add delete action
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 3d97d4ed..e7fc86b1 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -226,6 +226,18 @@ function service:create(node, actor)
return ok, err;
end
+function service:delete(node, actor)
+ -- Access checking
+ if not self:may(node, actor, "delete") then
+ return false, "forbidden";
+ end
+ --
+ local node_obj = self.nodes[node];
+ self.nodes[node] = nil;
+ self.config.broadcaster("delete", node, node_obj.subscribers);
+ return true;
+end
+
function service:publish(node, actor, id, item)
-- Access checking
if not self:may(node, actor, "publish") then