26
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

populate pubsub#roster_groups_allowed in node configuration options (thanks to Karim Gemayel)(EJAB-1344)

This commit is contained in:
Christophe Romain 2010-11-10 15:15:03 +01:00
parent c31f59e326
commit dfaeb3bc88

View File

@ -53,6 +53,7 @@
-include("adhoc.hrl"). -include("adhoc.hrl").
-include("jlib.hrl"). -include("jlib.hrl").
-include("pubsub.hrl"). -include("pubsub.hrl").
-include("mod_roster.hrl").
-define(STDTREE, "tree"). -define(STDTREE, "tree").
-define(STDNODE, "flat"). -define(STDNODE, "flat").
@ -3276,12 +3277,22 @@ user_resources(User, Server) ->
%%<li>The service does not support node configuration.</li> %%<li>The service does not support node configuration.</li>
%%<li>The service does not support retrieval of default node configuration.</li> %%<li>The service does not support retrieval of default node configuration.</li>
%%</ul> %%</ul>
get_configure(Host, ServerHost, Node, From, Lang) -> get_configure(Host, ServerHost, Node, #jid{luser = User, lserver = Server} = From, Lang) ->
Action = Action =
fun(#pubsub_node{options = Options, type = Type, id = NodeId}) -> fun(#pubsub_node{options = Options, type = Type, id = NodeId}) ->
case node_call(Type, get_affiliation, [NodeId, From]) of case node_call(Type, get_affiliation, [NodeId, From]) of
{result, owner} -> {result, owner} ->
Groups = ejabberd_hooks:run_fold(roster_groups, ServerHost, [], [ServerHost]), Groups = case lists:member(Server, ?MYHOSTS) of
true ->
%Roster_Items = ejabberd_hooks:run_fold(roster_get, ServerHost, [], [{User,Server}]),
Roster_Groups = lists:foldl(fun
(#roster{groups = []}, Acc) -> Acc;
(#roster{groups = Item_Groups}, Acc) -> [Item_Groups | Acc]
end, [], ejabberd_hooks:run_fold(roster_get, ServerHost, [], [{User,Server}])),
lists:usort(Roster_Groups);
false ->
[]
end,
{result, {result,
[{xmlelement, "pubsub", [{xmlelement, "pubsub",
[{"xmlns", ?NS_PUBSUB_OWNER}], [{"xmlns", ?NS_PUBSUB_OWNER}],