25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-26 16:26:24 +01:00

Fixed node type (thanks to saczawap) (#435)

This commit is contained in:
Christophe Romain 2015-04-21 15:02:20 +02:00
parent e0563e3918
commit 747d25b4ad

View File

@ -1057,27 +1057,21 @@ command_disco_info(_Host, ?NS_PUBSUB_GET_PENDING, _From) ->
node_disco_info(Host, Node, From) -> node_disco_info(Host, Node, From) ->
node_disco_info(Host, Node, From, true, true). node_disco_info(Host, Node, From, true, true).
node_disco_info(Host, Node, From, _Identity, _Features) -> node_disco_info(Host, Node, _From, _Identity, _Features) ->
Action = fun (#pubsub_node{type = Type, id = Nidx}) -> Action = fun (#pubsub_node{type = Type, options = Options}) ->
Types = case tree_call(Host, get_subnodes, [Host, Node, From]) of NodeType = case get_option(Options, node_type) of
[] -> collection -> <<"collection">>;
[<<"leaf">>]; _ -> <<"leaf">>
_ ->
case node_call(Host, Type, get_items, [Nidx, From, none]) of
{result, {[], _}} -> [<<"collection">>];
{result, _} -> [<<"leaf">>, <<"collection">>];
_ -> []
end
end, end,
I = [#xmlel{name = <<"identity">>, I = #xmlel{name = <<"identity">>,
attrs = [{<<"category">>, <<"pubsub">>}, {<<"type">>, T}]} attrs = [{<<"category">>, <<"pubsub">>},
|| T <- Types], {<<"type">>, NodeType}]},
F = [#xmlel{name = <<"feature">>, F = [#xmlel{name = <<"feature">>,
attrs = [{<<"var">>, ?NS_PUBSUB}]} attrs = [{<<"var">>, ?NS_PUBSUB}]}
| [#xmlel{name = <<"feature">>, | [#xmlel{name = <<"feature">>,
attrs = [{<<"var">>, feature(F)}]} attrs = [{<<"var">>, feature(F)}]}
|| F <- plugin_features(Host, Type)]], || F <- plugin_features(Host, Type)]],
{result, I ++ F} {result, [I | F]}
end, end,
case transaction(Host, Node, Action, sync_dirty) of case transaction(Host, Node, Action, sync_dirty) of
{result, {_, Result}} -> {result, Result}; {result, {_, Result}} -> {result, Result};