25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Preliminary support for groupname@vhost in Displayed Groups (EJAB-506)

This commit is contained in:
Badlop 2011-07-27 10:20:22 +02:00
parent 37107af7b4
commit 262157c88d
2 changed files with 17 additions and 5 deletions

View File

@ -4118,8 +4118,9 @@ has a unique identification and the following parameters:
which is only recommended for a small server with just a few hundred users.
The special member directive \term{@online@}
represents the online users in the virtual host.
\item[Displayed groups] A list of groups that will be in the rosters of this
group's members.
\item[Displayed groups]
A list of groups that will be in the rosters of this group's members.
A group of other vhost can be identified with \term{groupid@vhost}
\end{description}
Examples:

View File

@ -463,7 +463,8 @@ get_user_groups(US) ->
[]
end ++ get_special_users_groups(Host).
is_group_enabled(Host, Group) ->
is_group_enabled(Host1, Group1) ->
{Host, Group} = split_grouphost(Host1, Group1),
case catch mnesia:dirty_read(sr_group, {Group, Host}) of
[#sr_group{opts = Opts}] ->
not lists:member(disabled, Opts);
@ -488,7 +489,8 @@ get_group_opt(Host, Group, Opt, Default) ->
get_online_users(Host) ->
lists:usort([{U, S} || {U, S, _} <- ejabberd_sm:get_vh_session_list(Host)]).
get_group_users(Host, Group) ->
get_group_users(Host1, Group1) ->
{Host, Group} = split_grouphost(Host1, Group1),
case get_group_opt(Host, Group, all_users, false) of
true ->
ejabberd_auth:get_vh_registered_users(Host);
@ -531,7 +533,8 @@ get_group_explicit_users(Host, Group) ->
[]
end.
get_group_name(Host, Group) ->
get_group_name(Host1, Group1) ->
{Host, Group} = split_grouphost(Host1, Group1),
get_group_opt(Host, Group, name, Group).
%% Get list of names of groups that have @all@/@online@/etc in the memberlist
@ -1114,3 +1117,11 @@ get_opt(Opts, Opt, Default) ->
us_to_list({User, Server}) ->
jlib:jid_to_string({User, Server, ""}).
split_grouphost(Host, Group) ->
case string:tokens(Group, "@") of
[GroupName, HostName] ->
{HostName, GroupName};
[_] ->
{Host, Group}
end.