24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-08 21:43:07 +02:00

Add support for @online@ to add_user_to_group

This commit is contained in:
Badlop 2011-09-20 16:44:51 +02:00
parent 33766a124d
commit 32fc36b17d

View File

@ -617,14 +617,15 @@ add_user_to_group(Host, US, Group) ->
case regexp:match(LUser, "^@.+@$") of case regexp:match(LUser, "^@.+@$") of
{match,_,_} -> {match,_,_} ->
GroupOpts = mod_shared_roster:get_group_opts(Host, Group), GroupOpts = mod_shared_roster:get_group_opts(Host, Group),
AllUsersOpt = MoreGroupOpts =
case LUser == "@all@" of case LUser of
true -> [{all_users, true}]; "@all@" -> [{all_users, true}];
false -> [] "@online@" -> [{online_users, true}];
_ -> []
end, end,
mod_shared_roster:set_group_opts( mod_shared_roster:set_group_opts(
Host, Group, Host, Group,
GroupOpts ++ AllUsersOpt); GroupOpts ++ MoreGroupOpts);
nomatch -> nomatch ->
%% Push this new user to members of groups where this group is displayed %% Push this new user to members of groups where this group is displayed
push_user_to_displayed(LUser, LServer, Group, both), push_user_to_displayed(LUser, LServer, Group, both),
@ -652,7 +653,9 @@ remove_user_from_group(Host, US, Group) ->
NewGroupOpts = NewGroupOpts =
case LUser of case LUser of
"@all@" -> "@all@" ->
lists:filter(fun(X) -> X/={all_users,true} end, GroupOpts) lists:filter(fun(X) -> X/={all_users,true} end, GroupOpts);
"@online@" ->
lists:filter(fun(X) -> X/={online_users,true} end, GroupOpts)
end, end,
mod_shared_roster:set_group_opts(Host, Group, NewGroupOpts); mod_shared_roster:set_group_opts(Host, Group, NewGroupOpts);
nomatch -> nomatch ->