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

index 2157d1ef9b5a0f6559ce7e94d8c26fa207aca4a9..600dfe5e2d6e6e9f82f5d42142752850fe0e204e 100644 (file)
@@ -4201,8 +4201,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 50b4472c053465ab8d2344a3990eaeccbeee044b..cef41625bfe97e53533f1d5ce1a8d18e6332c93d 100644 (file)
@@ -496,7 +496,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);
@@ -527,7 +528,8 @@ get_online_users(Host) ->
 get_group_users(HostB, Group) when is_binary(HostB) ->
     get_group_users(binary_to_list(HostB), Group);
 
-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);
@@ -573,7 +575,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).
 
 %% @spec(Host::string)
@@ -1135,3 +1138,11 @@ get_opt(Opts, Opt, Default) ->
 
 us_to_list({User, Server}) ->
     exmpp_jid:bare_to_list(User, Server).
+
+split_grouphost(Host, Group) ->
+    case string:tokens(Group, "@") of
+       [GroupName, HostName] ->
+           {HostName, GroupName};
+       [_] ->
+           {Host, Group}
+    end.