allow unsubscribe with 'all' SubId, as mod_pubsub already does

SVN Revision: 2884
This commit is contained in:
Christophe Romain 2010-01-12 14:39:52 +00:00
parent 392ea78acf
commit 6ddff15b39
2 changed files with 8 additions and 0 deletions

View File

@ -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 ->

View File

@ -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 ->