25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

fix disco bugs, thanks to Brian Cully (EJAB-1088)

SVN Revision: 2710
This commit is contained in:
Christophe Romain 2009-10-27 14:07:35 +00:00
parent 0906a68c27
commit 3d5fe6a337

View File

@ -1101,12 +1101,17 @@ iq_disco_info(Host, SNode, From, Lang) ->
end. end.
iq_disco_items(Host, [], From) -> iq_disco_items(Host, [], From) ->
{result, lists:map( case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
fun(#pubsub_node{nodeid = {_, SubNode}, type = Type}) -> Nodes when is_list(Nodes) ->
{result, Path} = node_call(Type, node_to_path, [SubNode]), {result, lists:map(
[Name|_] = lists:reverse(Path), fun(#pubsub_node{nodeid = {_, SubNode}, type = Type}) ->
{xmlelement, "item", [{"jid", Host}, {"name", Name}|nodeAttr(SubNode)], []} {result, Path} = node_call(Type, node_to_path, [SubNode]),
end, tree_action(Host, get_subnodes, [Host, <<>>, From]))}; [Name|_] = lists:reverse(Path),
{xmlelement, "item", [{"jid", Host}, {"name", Name}|nodeAttr(SubNode)], []}
end, Nodes)};
Other ->
Other
end;
iq_disco_items(Host, Item, From) -> iq_disco_items(Host, Item, From) ->
case string:tokens(Item, "!") of case string:tokens(Item, "!") of
[_SNode, _ItemID] -> [_SNode, _ItemID] ->
@ -1122,7 +1127,9 @@ iq_disco_items(Host, Item, From) ->
end, end,
Nodes = lists:map( Nodes = lists:map(
fun(#pubsub_node{nodeid = {_, SubNode}}) -> fun(#pubsub_node{nodeid = {_, SubNode}}) ->
{xmlelement, "item", [{"jid", Host}|nodeAttr(SubNode)], []} {result, Path} = node_call(Type, node_to_path, [SubNode]),
[Name|_] = lists:reverse(Path),
{xmlelement, "item", [{"jid", Host}, {"name", Name}|nodeAttr(SubNode)], []}
end, tree_call(Host, get_subnodes, [Host, Node, From])), end, tree_call(Host, get_subnodes, [Host, Node, From])),
Items = lists:map( Items = lists:map(
fun(#pubsub_item{itemid = {RN, _}}) -> fun(#pubsub_item{itemid = {RN, _}}) ->