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
1 changed files with 14 additions and 7 deletions

View File

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