25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Fix last commit

This commit is contained in:
Paweł Chmielowski 2019-05-24 15:18:15 +02:00
parent 226c09f031
commit 50f93023f5

View File

@ -451,18 +451,19 @@ process_iq_set(#iq{from = _From, to = To,
end. end.
-spec set_item_and_notify_clients(jid(), #roster_item{}, boolean()) -> ok | error. -spec set_item_and_notify_clients(jid(), #roster_item{}, boolean()) -> ok | error.
set_item_and_notify_clients(To, #roster_item{jid = LJID} = RosterItem, set_item_and_notify_clients(To, #roster_item{jid = PeerJID} = RosterItem,
OverrideSubscription) -> OverrideSubscription) ->
#jid{luser = LUser, lserver = LServer} = To, #jid{luser = LUser, lserver = LServer} = To,
PeerLJID = jid:tolower(PeerJID),
F = fun () -> F = fun () ->
Item = get_roster_item(LUser, LServer, LJID), Item = get_roster_item(LUser, LServer, PeerLJID),
Item2 = decode_item(RosterItem, Item, OverrideSubscription), Item2 = decode_item(RosterItem, Item, OverrideSubscription),
Item3 = ejabberd_hooks:run_fold(roster_process_item, Item3 = ejabberd_hooks:run_fold(roster_process_item,
LServer, Item2, LServer, Item2,
[LServer]), [LServer]),
case Item3#roster.subscription of case Item3#roster.subscription of
remove -> del_roster_t(LUser, LServer, LJID); remove -> del_roster_t(LUser, LServer, PeerLJID);
_ -> update_roster_t(LUser, LServer, LJID, Item3) _ -> update_roster_t(LUser, LServer, PeerLJID, Item3)
end, end,
case roster_version_on_db(LServer) of case roster_version_on_db(LServer) of
true -> write_roster_version_t(LUser, LServer); true -> write_roster_version_t(LUser, LServer);
@ -470,7 +471,7 @@ set_item_and_notify_clients(To, #roster_item{jid = LJID} = RosterItem,
end, end,
{Item, Item3} {Item, Item3}
end, end,
case transaction(LUser, LServer, [LJID], F) of case transaction(LUser, LServer, [PeerLJID], F) of
{atomic, {OldItem, Item}} -> {atomic, {OldItem, Item}} ->
push_item(To, OldItem, Item), push_item(To, OldItem, Item),
case Item#roster.subscription of case Item#roster.subscription of