aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2010-12-05 04:19:23 +0100
committerFlorian Zeitz <florob@babelmonkeys.de>2010-12-05 04:19:23 +0100
commit02f5edae680279be548800ce74496626eaf92d14 (patch)
tree13fb1985daa9b2732135a1d00bbaefa4bf8ebfa3 /util
parent95db0579ab3d60f61d51a30e5a6535194d3cc8a3 (diff)
downloadprosody-02f5edae680279be548800ce74496626eaf92d14.tar.gz
prosody-02f5edae680279be548800ce74496626eaf92d14.zip
mod_pubsub: Support item retraction
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 4789dff9..02e845e1 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -54,6 +54,18 @@ function service:publish(node, actor, id, item)
return true;
end
+function service:retract(node, actor, id, retract)
+ local node_obj = self.nodes[node];
+ if (not node_obj) or (not node_obj.data[id]) then
+ return false, "item-not-found";
+ end
+ node_obj.data[id] = nil;
+ if retract then
+ self.cb.broadcaster(node, node_obj.subscribers, retract);
+ end
+ return true
+end
+
function service:get(node, actor, id)
local node_obj = self.nodes[node];
if node_obj then