mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
fix is_last_item_cache_enabled issue with PEP, and fix indentation
SVN Revision: 2416
This commit is contained in:
parent
fc0209fec9
commit
9fbef39193
@ -2936,16 +2936,9 @@ broadcast_config_notification(Host, Node, NodeId, Type, NodeOptions, Lang) ->
|
||||
end.
|
||||
|
||||
get_collection_subscriptions(Host, Node) ->
|
||||
case mnesia:transaction(fun tree_call/3,
|
||||
[Host, get_parentnodes_tree,
|
||||
[Host, Node, service_jid(Host)]]) of
|
||||
{atomic, NodesByDepth} when is_list(NodesByDepth) ->
|
||||
lists:map(fun ({Depth, Nodes}) ->
|
||||
{Depth, [{N, get_node_subs(N)} || N <- Nodes]}
|
||||
end, NodesByDepth);
|
||||
Other ->
|
||||
Other
|
||||
end.
|
||||
end, tree_action(Host, get_parentnodes_tree, [Host, Node, service_jid(Host)])).
|
||||
|
||||
get_node_subs(#pubsub_node{type = Type,
|
||||
nodeid = {Host, Node},
|
||||
@ -2957,6 +2950,14 @@ get_node_subs(#pubsub_node{type = Type,
|
||||
Other
|
||||
end.
|
||||
|
||||
get_options_for_subs(_Host, Node, NodeID, Subs) ->
|
||||
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
||||
{result, #pubsub_subscription{options = Options}} = pubsub_subscription:get_subscription(JID, NodeID, SubID),
|
||||
[{JID, Node, Options} | Acc];
|
||||
(_, Acc) ->
|
||||
Acc
|
||||
end, [], Subs).
|
||||
|
||||
% TODO: merge broadcast code that way
|
||||
%broadcast(Host, Node, NodeId, Type, NodeOptions, Feature, Force, ElName, SubEls) ->
|
||||
% case (get_option(NodeOptions, Feature) or Force) of
|
||||
@ -3296,14 +3297,6 @@ set_configure(Host, Node, From, Els, Lang) ->
|
||||
{error, ?ERR_BAD_REQUEST}
|
||||
end.
|
||||
|
||||
get_options_for_subs(_Host, Node, NodeID, Subs) ->
|
||||
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
||||
{result, #pubsub_subscription{options = Options}} = pubsub_subscription:get_subscription(JID, NodeID, SubID),
|
||||
[{JID, Node, Options} | Acc];
|
||||
(_, Acc) ->
|
||||
Acc
|
||||
end, [], Subs).
|
||||
|
||||
add_opt(Key, Value, Opts) ->
|
||||
Opts1 = lists:keydelete(Key, 1, Opts),
|
||||
[{Key, Value} | Opts1].
|
||||
@ -3395,6 +3388,8 @@ set_xoption([_ | Opts], NewOpts) ->
|
||||
|
||||
%%%% last item cache handling
|
||||
|
||||
is_last_item_cache_enabled({_, ServerHost, _}) ->
|
||||
is_last_item_cache_enabled(ServerHost);
|
||||
is_last_item_cache_enabled(Host) ->
|
||||
case ets:lookup(gen_mod:get_module_proc(Host, config), last_item_cache) of
|
||||
[{last_item_cache, true}] -> true;
|
||||
|
Loading…
Reference in New Issue
Block a user