From dd159242e3e17ea668854c0abad0c23d6a0cb84c Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 12 Jan 2010 14:42:23 +0000 Subject: [PATCH] allow unsubscribe with 'all' SubId, as mod_pubsub already does SVN Revision: 2885 --- src/mod_pubsub/node_hometree.erl | 4 ++++ src/mod_pubsub/node_hometree_odbc.erl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/mod_pubsub/node_hometree.erl b/src/mod_pubsub/node_hometree.erl index c8bb61982..433523a4e 100644 --- a/src/mod_pubsub/node_hometree.erl +++ b/src/mod_pubsub/node_hometree.erl @@ -396,6 +396,10 @@ unsubscribe_node(NodeId, Sender, Subscriber, SubId) -> {error, ?ERR_EXTENDED('unexpected-request', "not-subscribed")} end; + %% Asking to remove all subscriptions to the given node + SubId == all -> + [delete_subscription(SubKey, NodeId, S, SubState) || S <- Subscriptions], + {result, default}; %% No subid supplied, but there's only one matching %% subscription, so use that. length(Subscriptions) == 1 -> diff --git a/src/mod_pubsub/node_hometree_odbc.erl b/src/mod_pubsub/node_hometree_odbc.erl index 9e4414077..b2eeaeacd 100644 --- a/src/mod_pubsub/node_hometree_odbc.erl +++ b/src/mod_pubsub/node_hometree_odbc.erl @@ -400,6 +400,10 @@ unsubscribe_node(NodeId, Sender, Subscriber, SubId) -> false -> {error, ?ERR_EXTENDED('unexpected-request', "not-subscribed")} end; + %% Asking to remove all subscriptions to the given node + SubId == all -> + [delete_subscription(SubKey, NodeId, S, Affiliation, Subscriptions) || S <- Subscriptions], + {result, default}; %% No subid supplied, but there's only one matching %% subscription, so use that. length(Subscriptions) == 1 ->