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