aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2010-12-05 02:46:08 +0100
committerFlorian Zeitz <florob@babelmonkeys.de>2010-12-05 02:46:08 +0100
commit95db0579ab3d60f61d51a30e5a6535194d3cc8a3 (patch)
tree1706275ec482e6288106e9f22f49d93f9e109432 /util
parent3dce149c8b1eaafc7ec2a5ff8e263bc30a36bfe0 (diff)
downloadprosody-95db0579ab3d60f61d51a30e5a6535194d3cc8a3.tar.gz
prosody-95db0579ab3d60f61d51a30e5a6535194d3cc8a3.zip
mod_pubsub, util.pubsub: Support for unsubscribing
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index dc3f3432..4789dff9 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -17,7 +17,14 @@ function service:add_subscription(node, actor, jid)
end
function service:remove_subscription(node, actor, jid)
- self.nodes[node].subscribers[jid] = nil;
+ local node_obj = self.nodes[node];
+ if not node_obj then
+ return false, "item-not-found";
+ end
+ if not node_obj.subscribers[jid] then
+ return false, "not-subscribed";
+ end
+ node_obj.subscribers[jid] = nil;
return true;
end