From 6ddff15b390a0e4b45d10a92cb2e18655e102a98 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Tue, 12 Jan 2010 14:39:52 +0000 Subject: [PATCH] allow unsubscribe with 'all' SubId, as mod_pubsub already does SVN Revision: 2884 --- 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 5ce7b9724..6ba6bb910 100644 --- a/src/mod_pubsub/node_hometree.erl +++ b/src/mod_pubsub/node_hometree.erl @@ -395,6 +395,10 @@ unsubscribe_node(NodeId, Sender, Subscriber, SubId) -> {error, ?ERR_EXTENDED(?ERR_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 141d3275c..20f131062 100644 --- a/src/mod_pubsub/node_hometree_odbc.erl +++ b/src/mod_pubsub/node_hometree_odbc.erl @@ -394,6 +394,10 @@ unsubscribe_node(NodeId, Sender, Subscriber, SubId) -> false -> {error, ?ERR_EXTENDED(?ERR_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 ->