mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Foreign shared rosters items not pushed (thanks to Nathan Bruning)(EJAB-1509)
This commit is contained in:
parent
0283c6cdfe
commit
288196c7e8
@ -631,7 +631,7 @@ add_user_to_group(Host, US, Group) ->
|
||||
GroupOpts ++ MoreGroupOpts);
|
||||
nomatch ->
|
||||
%% 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, Host, both),
|
||||
%% Push members of groups that are displayed to this group
|
||||
push_displayed_to_user(LUser, LServer, Group, Host, both),
|
||||
R = #sr_user{us = US, group_host = {Group, Host}},
|
||||
@ -668,7 +668,7 @@ remove_user_from_group(Host, US, Group) ->
|
||||
end,
|
||||
Result = mnesia:transaction(F),
|
||||
%% Push removal of the old user to members of groups where the group that this user was members was displayed
|
||||
push_user_to_displayed(LUser, LServer, Group, remove),
|
||||
push_user_to_displayed(LUser, LServer, Group, Host, remove),
|
||||
%% Push removal of members of groups that where displayed to the group which this user has left
|
||||
push_displayed_to_user(LUser, LServer, Group, Host, remove),
|
||||
Result
|
||||
@ -689,7 +689,7 @@ register_user(User, Server) ->
|
||||
%% Get list of groups where this user is member
|
||||
Groups = get_user_groups({User, Server}),
|
||||
%% Push this user to members of groups where is displayed a group which this user is member
|
||||
[push_user_to_displayed(User, Server, Group, both) || Group <- Groups].
|
||||
[push_user_to_displayed(User, Server, Group, Server, both) || Group <- Groups].
|
||||
|
||||
remove_user(User, Server) ->
|
||||
push_user_to_members(User, Server, remove).
|
||||
@ -711,19 +711,19 @@ push_user_to_members(User, Server, Subscription) ->
|
||||
end, get_group_users(LServer, Group, GroupOpts))
|
||||
end, lists:usort(SpecialGroups++UserGroups)).
|
||||
|
||||
push_user_to_displayed(LUser, LServer, Group, Subscription) ->
|
||||
GroupsOpts = groups_with_opts(LServer),
|
||||
push_user_to_displayed(LUser, LServer, Group, Host, Subscription) ->
|
||||
GroupsOpts = groups_with_opts(Host),
|
||||
GroupOpts = proplists:get_value(Group, GroupsOpts, []),
|
||||
GroupName = proplists:get_value(name, GroupOpts, Group),
|
||||
DisplayedToGroupsOpts = displayed_to_groups(Group, LServer),
|
||||
[push_user_to_group(LUser, LServer, GroupD, GroupName, Subscription) || {GroupD, _Opts} <- DisplayedToGroupsOpts].
|
||||
DisplayedToGroupsOpts = displayed_to_groups(Group, Host),
|
||||
[push_user_to_group(LUser, LServer, GroupD, Host, GroupName, Subscription) || {GroupD, _Opts} <- DisplayedToGroupsOpts].
|
||||
|
||||
push_user_to_group(LUser, LServer, Group, GroupName, Subscription) ->
|
||||
push_user_to_group(LUser, LServer, Group, Host, GroupName, Subscription) ->
|
||||
lists:foreach(
|
||||
fun({U, S}) when (U == LUser) and (S == LServer) -> ok;
|
||||
fun({U, S}) when (U == LUser) and (S == LServer) -> ok;
|
||||
({U, S}) ->
|
||||
push_roster_item(U, S, LUser, LServer, GroupName, Subscription)
|
||||
end, get_group_users(LServer, Group)).
|
||||
end, get_group_users(Host, Group)).
|
||||
|
||||
%% Get list of groups to which this group is displayed
|
||||
displayed_to_groups(GroupName, LServer) ->
|
||||
@ -819,7 +819,7 @@ user_available(New) ->
|
||||
fun(OG) ->
|
||||
?DEBUG("user_available: pushing ~p @ ~p grp ~p",
|
||||
[LUser, LServer, OG ]),
|
||||
push_user_to_displayed(LUser, LServer, OG, both)
|
||||
push_user_to_displayed(LUser, LServer, OG, LServer, both)
|
||||
end, OnlineGroups);
|
||||
_ ->
|
||||
ok
|
||||
@ -840,7 +840,7 @@ unset_presence(LUser, LServer, Resource, Status) ->
|
||||
fun(OG) ->
|
||||
%% Push removal of the old user to members of groups
|
||||
%% where the group that this uwas members was displayed
|
||||
push_user_to_displayed(LUser, LServer, OG, remove),
|
||||
push_user_to_displayed(LUser, LServer, OG, LServer, remove),
|
||||
%% Push removal of members of groups that where
|
||||
%% displayed to the group which thiuser has left
|
||||
push_displayed_to_user(LUser, LServer, OG, LServer,remove)
|
||||
|
Loading…
Reference in New Issue
Block a user