diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2009-10-27 14:07:35 +0000 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2009-10-27 14:07:35 +0000 |
commit | 3d5fe6a337d248a882dd00bb454417e89f30d2f9 (patch) | |
tree | 9ae406f51d61ad5d9e4329cc7b4d8264c0b89570 | |
parent | Mention in Release Notes the three changes in SQL databases (EJAB-1078) (diff) |
fix disco bugs, thanks to Brian Cully (EJAB-1088)
SVN Revision: 2710
-rw-r--r-- | src/mod_pubsub/mod_pubsub.erl | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index d7d1fffe3..8ab29ea05 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -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, _}}) -> |