diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2015-12-16 12:56:06 +0100 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2015-12-16 12:56:06 +0100 |
commit | 08b0530164bd0907536f3c0a00467908451cea20 (patch) | |
tree | 68a4ec9a819c9bdd71fc6d88e6e7642d38e95433 /src/mod_pubsub.erl | |
parent | Advertise MAM in disco info for account/room JID (diff) |
Don't read pubsub options when plugin does not use them
This also revert commit 6052f7b
Diffstat (limited to 'src/mod_pubsub.erl')
-rw-r--r-- | src/mod_pubsub.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index c0b613d6..a3494067 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -3424,12 +3424,19 @@ get_node_subs_by_depth(Host, Node, From) -> [{Depth, [{N, get_node_subs(Host, N)} || N <- Nodes]} || {Depth, Nodes} <- ParentTree]. get_node_subs(Host, #pubsub_node{type = Type, id = Nidx}) -> + WithOptions = lists:member(<<"subscription-options">>, plugin_features(Host, Type)), case node_call(Host, Type, get_node_subscriptions, [Nidx]) of - {result, Subs} -> get_options_for_subs(Host, Nidx, Subs); + {result, Subs} -> get_options_for_subs(Host, Nidx, Subs, WithOptions); Other -> Other end. -get_options_for_subs(Host, Nidx, Subs) -> +get_options_for_subs(_Host, _Nidx, Subs, false) -> + lists:foldl(fun({JID, subscribed, SubID}, Acc) -> + [{JID, SubID, []} | Acc]; + (_, Acc) -> + Acc + end, [], Subs); +get_options_for_subs(Host, Nidx, Subs, true) -> SubModule = subscription_plugin(Host), lists:foldl(fun({JID, subscribed, SubID}, Acc) -> case SubModule:get_subscription(JID, Nidx, SubID) of |