mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Try to limit calls to groups_with_opts in mod_shared_roster
This commit is contained in:
parent
e9d1201ea8
commit
6fe7c5cac5
@ -419,16 +419,7 @@ get_online_users(Host) ->
|
|||||||
|
|
||||||
get_group_users(Host1, Group1) ->
|
get_group_users(Host1, Group1) ->
|
||||||
{Host, Group} = split_grouphost(Host1, Group1),
|
{Host, Group} = split_grouphost(Host1, Group1),
|
||||||
case get_group_opt(Host, Group, all_users, false) of
|
get_group_users(Host, Group, get_group_opts(Host, Group)).
|
||||||
true -> ejabberd_auth:get_users(Host);
|
|
||||||
false -> []
|
|
||||||
end
|
|
||||||
++
|
|
||||||
case get_group_opt(Host, Group, online_users, false) of
|
|
||||||
true -> get_online_users(Host);
|
|
||||||
false -> []
|
|
||||||
end
|
|
||||||
++ get_group_explicit_users(Host, Group).
|
|
||||||
|
|
||||||
get_group_users(Host, Group, GroupOpts) ->
|
get_group_users(Host, Group, GroupOpts) ->
|
||||||
case proplists:get_value(all_users, GroupOpts, false) of
|
case proplists:get_value(all_users, GroupOpts, false) of
|
||||||
@ -573,9 +564,7 @@ add_user_to_group2(Host, US, Group) ->
|
|||||||
end.
|
end.
|
||||||
|
|
||||||
get_displayed_groups(Group, LServer) ->
|
get_displayed_groups(Group, LServer) ->
|
||||||
GroupsOpts = groups_with_opts(LServer),
|
get_group_opt(LServer, Group, displayed_groups, []).
|
||||||
GroupOpts = proplists:get_value(Group, GroupsOpts, []),
|
|
||||||
proplists:get_value(displayed_groups, GroupOpts, []).
|
|
||||||
|
|
||||||
push_displayed_to_user(LUser, LServer, Host, Subscription, DisplayedGroups) ->
|
push_displayed_to_user(LUser, LServer, Host, Subscription, DisplayedGroups) ->
|
||||||
[push_members_to_user(LUser, LServer, DGroup, Host,
|
[push_members_to_user(LUser, LServer, DGroup, Host,
|
||||||
@ -610,8 +599,7 @@ remove_user_from_group(Host, US, Group) ->
|
|||||||
|
|
||||||
push_members_to_user(LUser, LServer, Group, Host,
|
push_members_to_user(LUser, LServer, Group, Host,
|
||||||
Subscription) ->
|
Subscription) ->
|
||||||
GroupsOpts = groups_with_opts(LServer),
|
GroupOpts = get_group_opts(LServer, Group),
|
||||||
GroupOpts = proplists:get_value(Group, GroupsOpts, []),
|
|
||||||
GroupName = proplists:get_value(name, GroupOpts, Group),
|
GroupName = proplists:get_value(name, GroupOpts, Group),
|
||||||
Members = get_group_users(Host, Group),
|
Members = get_group_users(Host, Group),
|
||||||
lists:foreach(fun ({U, S}) ->
|
lists:foreach(fun ({U, S}) ->
|
||||||
@ -659,9 +647,7 @@ push_user_to_members(User, Server, Subscription) ->
|
|||||||
lists:usort(SpecialGroups ++ UserGroups)).
|
lists:usort(SpecialGroups ++ UserGroups)).
|
||||||
|
|
||||||
push_user_to_displayed(LUser, LServer, Group, Host, Subscription, DisplayedToGroupsOpts) ->
|
push_user_to_displayed(LUser, LServer, Group, Host, Subscription, DisplayedToGroupsOpts) ->
|
||||||
GroupsOpts = groups_with_opts(Host),
|
GroupName = get_group_opt(Host, Group, name, Group),
|
||||||
GroupOpts = proplists:get_value(Group, GroupsOpts, []),
|
|
||||||
GroupName = proplists:get_value(name, GroupOpts, Group),
|
|
||||||
[push_user_to_group(LUser, LServer, GroupD, Host,
|
[push_user_to_group(LUser, LServer, GroupD, Host,
|
||||||
GroupName, Subscription)
|
GroupName, Subscription)
|
||||||
|| GroupD <- DisplayedToGroupsOpts].
|
|| GroupD <- DisplayedToGroupsOpts].
|
||||||
|
Loading…
Reference in New Issue
Block a user