summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/guide.tex5
-rw-r--r--src/mod_shared_roster.erl17
2 files changed, 17 insertions, 5 deletions
diff --git a/doc/guide.tex b/doc/guide.tex
index 6d12ed2c..f13c5888 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -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:
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index 7d4d293a..6aa746bf 100644
--- a/src/mod_shared_roster.erl
+++ b/src/mod_shared_roster.erl
@@ -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.