diff options
author | Christophe Romain <chris.romain@gmail.com> | 2010-03-05 10:40:34 +0100 |
---|---|---|
committer | Christophe Romain <chris.romain@gmail.com> | 2010-03-05 10:40:34 +0100 |
commit | c3edcd057546f3a0af023b0e1cb0b71552d6c39b (patch) | |
tree | 5b56ab1172b0fa4dbc20024165a4f2c3de0b5070 /src | |
parent | mod_caps optimizations (thanks evgeniy) (diff) |
fix pubsub#title option (EJAB-1190) (thanks karim)
Diffstat (limited to 'src')
-rw-r--r-- | src/mod_pubsub/mod_pubsub.erl | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl index d8d3fdfe2..592d11d35 100644 --- a/src/mod_pubsub/mod_pubsub.erl +++ b/src/mod_pubsub/mod_pubsub.erl @@ -1095,10 +1095,15 @@ iq_disco_items(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)], []} + fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) -> + Attrs = + case get_option(Options, title) of + false -> + [{"jid", Host} |nodeAttr(SubNode)]; + Title -> + [{"jid", Host}, {"name", Title}|nodeAttr(SubNode)] + end, + {xmlelement, "item", Attrs, []} end, Nodes)}; Other -> Other @@ -1124,10 +1129,15 @@ iq_disco_items(Host, Item, From) -> _ -> [] end, Nodes = lists:map( - fun(#pubsub_node{nodeid = {_, SubNode}}) -> - {result, Path} = node_call(Type, node_to_path, [SubNode]), - [Name|_] = lists:reverse(Path), - {xmlelement, "item", [{"jid", Host}, {"name", Name}|nodeAttr(SubNode)], []} + fun(#pubsub_node{nodeid = {_, SubNode}, options = Options}) -> + Attrs = + case get_option(Options, title) of + 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])), Items = lists:map( fun(#pubsub_item{itemid = {RN, _}}) -> |