diff options
author | Badlop <badlop@process-one.net> | 2011-09-20 18:44:51 +0400 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2011-09-20 18:45:08 +0400 |
commit | 17099eaacaf25353a655670db23ef89d5656a479 (patch) | |
tree | c7f9f33efc409c8c66bf62789bbce95a052a2ac3 | |
parent | f3f80ea0ea10cca5ae62c92161a982cbf47ccd71 (diff) |
Add support for @online@ to add_user_to_group
-rw-r--r-- | src/mod_shared_roster.erl | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index 15f2036fb..5a90dc476 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -664,14 +664,15 @@ add_user_to_group(Host, {LUser, LServer} = US, Group) -> case re:run(LUser, "^@.+@$", [{capture, none}]) of match -> GroupOpts = mod_shared_roster:get_group_opts(Host, Group), - AllUsersOpt = - case LUser == "@all@" of - true -> [{all_users, true}]; - false -> [] + MoreGroupOpts = + case LUser of + "@all@" -> [{all_users, true}]; + "@online@" -> [{online_users, true}]; + _ -> [] end, mod_shared_roster:set_group_opts( Host, Group, - GroupOpts ++ AllUsersOpt); + GroupOpts ++ MoreGroupOpts); nomatch -> %% Push this new user to members of groups where this group is displayed push_user_to_displayed(LUser, LServer, Group, both), @@ -700,7 +701,9 @@ remove_user_from_group(Host, {LUser, LServer} = US, Group) -> NewGroupOpts = case LUser of "@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, mod_shared_roster:set_group_opts(Host, Group, NewGroupOpts); nomatch -> |