Software /
code /
prosody
Diff
util/pubsub.lua @ 3699:150e58d69e60
mod_pubsub: Support item retraction
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Sun, 05 Dec 2010 04:19:23 +0100 |
parent | 3698:77171fd1dc3c |
child | 3759:1f7305784e12 |
line wrap: on
line diff
--- a/util/pubsub.lua Sun Dec 05 02:46:08 2010 +0100 +++ b/util/pubsub.lua Sun Dec 05 04:19:23 2010 +0100 @@ -54,6 +54,18 @@ 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