* src/mod_pubsub/mod_pubsub.erl: Discovery query on an item does

no more return an "item not found error". Discovery stop
correctly at the item level (Thanks to Christophe Romain) (EJAB-105).

SVN Revision: 578
This commit is contained in:
Mickaël Rémond 2006-06-07 14:07:18 +00:00
parent 9dcd3f4080
commit b80002a8bb
2 changed files with 35 additions and 15 deletions

View File

@ -1,11 +1,15 @@
2006-06-07 Mickael Remond <mickael.remond@process-one.net> 2006-06-07 Mickael Remond <mickael.remond@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: Support for pubsub node creation ACL. * src/mod_pubsub/mod_pubsub.erl: Support for pubsub node creation
It is now possible to limit the node creation rights using an ACL from ACL. It is now possible to limit the node creation rights using an
ejabberd config file (Thanks to Christophe Romain). ACL from ejabberd config file (Thanks to Christophe Romain).
* doc/guide.tex: Likewise. * doc/guide.tex: Likewise.
* src/ejabberd.cfg.example. * src/ejabberd.cfg.example.
* src/mod_pubsub/mod_pubsub.erl: Discovery query on an item does
no more return an "item not found error". Discovery stop correctly
at the item level (Thanks to Christophe Romain).
2006-06-02 Mickael Remond <mickael.remond@process-one.net> 2006-06-02 Mickael Remond <mickael.remond@process-one.net>
* src/web/ejabberd_http_poll.erl: Messages polled between the * src/web/ejabberd_http_poll.erl: Messages polled between the

View File

@ -328,32 +328,50 @@ iq_disco_info(SNode) ->
[] []
end. end.
iq_disco_items(Host, From, SNode) -> iq_disco_items(Host, From, SNode) ->
Node = string:tokens(SNode, "/"), {Node,ItemID} = case SNode of
[] ->
{[],none};
_ ->
Tokens = string:tokens(SNode, "!"),
NodeList = string:tokens(lists:nth(1, Tokens), "/"),
ItemName = case length(Tokens) of
2 -> lists:nth(2, Tokens);
_ -> none
end,
{NodeList, ItemName}
end,
NodeFull = string:tokens(SNode,"/"),
F = fun() -> F = fun() ->
case mnesia:read({pubsub_node, {Host, Node}}) of case mnesia:read({pubsub_node, {Host, Node}}) of
[#pubsub_node{info = Info}] -> [#pubsub_node{info = Info}] ->
SubNodes = mnesia:index_read(pubsub_node, case ItemID of
none ->
SubNodes = mnesia:index_read(pubsub_node,
{Host, Node}, {Host, Node},
#pubsub_node.host_parent), #pubsub_node.host_parent),
SubItems = SubItems = lists:map(fun(#pubsub_node{host_node = {_, N}}) ->
lists:map(fun(#pubsub_node{host_node = {_, N}}) ->
SN = node_to_string(N), SN = node_to_string(N),
{xmlelement, "item", {xmlelement, "item",
[{"jid", Host}, [{"jid", Host},
{"node", SN}, {"node", SN},
{"name", lists:last(N)}], []} {"name", lists:last(N)}], []}
end, SubNodes), end, SubNodes),
SN = node_to_string(Node), SN = node_to_string(Node),
Items = Items = lists:map(fun(#item{id = Name}) ->
lists:map(fun(#item{id = Name}) -> RealName = case Name of
[] -> "item";
_ -> Name
end,
{xmlelement, "item", {xmlelement, "item",
[{"jid", Host}, [{"jid", Host},
{"node", SN ++ "!" ++ Name}, {"node", SN ++ "!" ++ Name},
{"name", Name}], []} {"name", RealName}], []}
end, Info#nodeinfo.items), end, Info#nodeinfo.items),
SubItems ++ Items; SubItems ++ Items;
_ ->
[]
end;
[] -> [] ->
case Node of case Node of
[] -> [] ->
@ -384,8 +402,6 @@ iq_disco_items(Host, From, SNode) ->
{error, ?ERR_INTERNAL_SERVER_ERROR} {error, ?ERR_INTERNAL_SERVER_ERROR}
end. end.
iq_get_vcard(Lang) -> iq_get_vcard(Lang) ->
[{xmlelement, "FN", [], [{xmlelement, "FN", [],
[{xmlcdata, "ejabberd/mod_pubsub"}]}, [{xmlcdata, "ejabberd/mod_pubsub"}]},