From 517296667e0fa74dd441892cf9750101ae31e814 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 31 Jan 2013 18:41:01 +0100 Subject: mod_pubsub, util.pubsub: Add delete action --- util/pubsub.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'util/pubsub.lua') 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 -- cgit v1.2.3