25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/mod_shared_roster.erl: Correct roster push when changing a shared roster entry name (EJAB-738).

SVN Revision: 1590
This commit is contained in:
Mickaël Rémond 2008-10-01 14:52:25 +00:00
parent 16a508cdb9
commit 3a2fb34a61
2 changed files with 12 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2008-10-01 Mickael Remond <mremond@process-one.net>
* src/mod_shared_roster.erl: Correct roster push when changing
a shared roster entry name (EJAB-738).
2008-09-30 Badlop <badlop@process-one.net> 2008-09-30 Badlop <badlop@process-one.net>
* src/*/Makefile.win32: Provide explicit beam filenames because * src/*/Makefile.win32: Provide explicit beam filenames because

View File

@ -160,6 +160,7 @@ get_user_roster(Items, US) ->
process_item(RosterItem, Host) -> process_item(RosterItem, Host) ->
USFrom = {UserFrom, ServerFrom} = RosterItem#roster.us, USFrom = {UserFrom, ServerFrom} = RosterItem#roster.us,
{UserTo, ServerTo, ResourceTo} = RosterItem#roster.jid, {UserTo, ServerTo, ResourceTo} = RosterItem#roster.jid,
NameTo = RosterItem#roster.name,
USTo = {UserTo, ServerTo}, USTo = {UserTo, ServerTo},
DisplayedGroups = get_user_displayed_groups(USFrom), DisplayedGroups = get_user_displayed_groups(USFrom),
CommonGroups = lists:filter(fun(Group) -> CommonGroups = lists:filter(fun(Group) ->
@ -187,24 +188,24 @@ process_item(RosterItem, Host) ->
PersonalGroups -> PersonalGroups ->
%% Store roster items in From and To rosters %% Store roster items in From and To rosters
set_new_rosteritems(UserFrom, ServerFrom, set_new_rosteritems(UserFrom, ServerFrom,
UserTo, ServerTo, ResourceTo, UserTo, ServerTo, ResourceTo, NameTo,
PersonalGroups) PersonalGroups)
end end
end. end.
build_roster_record(User1, Server1, User2, Server2, Groups) -> build_roster_record(User1, Server1, User2, Server2, Name2, Groups) ->
USR2 = {User2, Server2, ""}, USR2 = {User2, Server2, ""},
#roster{usj = {User1, Server1, USR2}, #roster{usj = {User1, Server1, USR2},
us = {User1, Server1}, us = {User1, Server1},
jid = USR2, jid = USR2,
name = User2, name = Name2,
subscription = both, subscription = both,
ask = none, ask = none,
groups = Groups groups = Groups
}. }.
set_new_rosteritems(UserFrom, ServerFrom, set_new_rosteritems(UserFrom, ServerFrom,
UserTo, ServerTo, ResourceTo, GroupsFrom) -> UserTo, ServerTo, ResourceTo, NameTo, GroupsFrom) ->
Mod = case lists:member(mod_roster_odbc, Mod = case lists:member(mod_roster_odbc,
gen_mod:loaded_modules(ServerFrom)) of gen_mod:loaded_modules(ServerFrom)) of
true -> mod_roster_odbc; true -> mod_roster_odbc;
@ -212,13 +213,13 @@ set_new_rosteritems(UserFrom, ServerFrom,
end, end,
RIFrom = build_roster_record(UserFrom, ServerFrom, RIFrom = build_roster_record(UserFrom, ServerFrom,
UserTo, ServerTo, GroupsFrom), UserTo, ServerTo, NameTo, GroupsFrom),
set_item(UserFrom, ServerFrom, ResourceTo, RIFrom), set_item(UserFrom, ServerFrom, ResourceTo, RIFrom),
JIDTo = jlib:make_jid(UserTo, ServerTo, ""), JIDTo = jlib:make_jid(UserTo, ServerTo, ""),
JIDFrom = jlib:make_jid(UserFrom, ServerFrom, ""), JIDFrom = jlib:make_jid(UserFrom, ServerFrom, ""),
RITo = build_roster_record(UserTo, ServerTo, RITo = build_roster_record(UserTo, ServerTo,
UserFrom, ServerFrom, []), UserFrom, ServerFrom, UserFrom,[]),
set_item(UserTo, ServerTo, "", RITo), set_item(UserTo, ServerTo, "", RITo),
%% From requests %% From requests