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

fix pubsub#title option (EJAB-1190) (thanks karim)

This commit is contained in:
Christophe Romain 2010-03-05 10:40:34 +01:00
parent 6fb99fbb48
commit c3edcd0575

View File

@ -1095,10 +1095,15 @@ iq_disco_items(Host, [], From) ->
case tree_action(Host, get_subnodes, [Host, <<>>, From]) of case tree_action(Host, get_subnodes, [Host, <<>>, From]) of
Nodes when is_list(Nodes) -> Nodes when is_list(Nodes) ->
{result, lists:map( {result, lists:map(
fun(#pubsub_node{nodeid = {_, SubNode}, type = Type}) -> fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) ->
{result, Path} = node_call(Type, node_to_path, [SubNode]), Attrs =
[Name|_] = lists:reverse(Path), case get_option(Options, title) of
{xmlelement, "item", [{"jid", Host}, {"name", Name}|nodeAttr(SubNode)], []} false ->
[{"jid", Host} |nodeAttr(SubNode)];
Title ->
[{"jid", Host}, {"name", Title}|nodeAttr(SubNode)]
end,
{xmlelement, "item", Attrs, []}
end, Nodes)}; end, Nodes)};
Other -> Other ->
Other Other
@ -1124,10 +1129,15 @@ iq_disco_items(Host, Item, From) ->
_ -> [] _ -> []
end, end,
Nodes = lists:map( Nodes = lists:map(
fun(#pubsub_node{nodeid = {_, SubNode}}) -> fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) ->
{result, Path} = node_call(Type, node_to_path, [SubNode]), Attrs =
[Name|_] = lists:reverse(Path), case get_option(Options, title) of
{xmlelement, "item", [{"jid", Host}, {"name", Name}|nodeAttr(SubNode)], []} false ->
[{"jid", Host} |nodeAttr(SubNode)];
Title ->
[{"jid", Host}, {"name", Title}|nodeAttr(SubNode)]
end,
{xmlelement, "item", Attrs, []}
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, _}}) ->