aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-01-24 00:58:03 +0100
committerKim Alvefur <zash@zash.se>2013-01-24 00:58:03 +0100
commit40709658994b6603968042c9dfebff7363f6ea71 (patch)
tree78a916a081a9dce7b30bc01cd1554382d337f875 /util
parent6ea2c47577027a1821aedd45428b4d24ebde82f6 (diff)
downloadprosody-40709658994b6603968042c9dfebff7363f6ea71.tar.gz
prosody-40709658994b6603968042c9dfebff7363f6ea71.zip
mod_pubsub, util.pubsub: Implement the purge action
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 8ff458e7..17795cf1 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -259,13 +259,21 @@ function service:retract(node, actor, id, retract)
if (not node_obj) or (not node_obj.data[id]) then
return false, "item-not-found";
end
- node_obj.data[id] = nil;
+ if id then
+ node_obj.data[id] = nil;
+ else
+ node_obj.data = {}; -- Purge
+ end
if retract then
self.config.broadcaster(node, node_obj.subscribers, retract);
end
return true
end
+function service:purge(node, actor, purge)
+ return self:retract(node, actor, nil, purge);
+end
+
function service:get_items(node, actor, id)
-- Access checking
if not self:may(node, actor, "get_items") then