]> granicus.if.org Git - ejabberd/commitdiff
Preliminary support for groupname@vhost in Displayed Groups (EJAB-506)
authorBadlop <badlop@process-one.net>
Wed, 27 Jul 2011 08:20:22 +0000 (10:20 +0200)
committerBadlop <badlop@process-one.net>
Thu, 15 Dec 2011 16:27:28 +0000 (17:27 +0100)
doc/guide.tex
src/mod_shared_roster.erl

index 6d12ed2cdd28575fd36cedb300d1c878d3611a4f..f13c58884103bc32226f2c18e8fa2aea1c90f15c 100644 (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:
index 7d4d293a3070cd6773166c78590fa4d7f39097de..6aa746bfe2d8069514399de3af65e76d4b719d13 100644 (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.