mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Change c2s state before offline messages resending
This commit is contained in:
parent
f2925d8efc
commit
a4728d14d5
@ -1772,35 +1772,32 @@ presence_update(From, Packet, StateData) ->
|
||||
FromUnavail = (StateData#state.pres_last == undefined),
|
||||
?DEBUG("from unavail = ~p~n", [FromUnavail]),
|
||||
NewState =
|
||||
NewStateData = StateData#state{pres_last = Packet,
|
||||
pres_timestamp = Timestamp},
|
||||
if
|
||||
FromUnavail ->
|
||||
ejabberd_hooks:run(user_available_hook,
|
||||
StateData#state.server,
|
||||
[StateData#state.jid]),
|
||||
NewStateData#state.server,
|
||||
[NewStateData#state.jid]),
|
||||
if NewPriority >= 0 ->
|
||||
resend_offline_messages(StateData),
|
||||
resend_subscription_requests(StateData);
|
||||
resend_offline_messages(NewStateData),
|
||||
resend_subscription_requests(NewStateData);
|
||||
true ->
|
||||
ok
|
||||
end,
|
||||
presence_broadcast_first(
|
||||
From, StateData#state{pres_last = Packet,
|
||||
pres_timestamp = Timestamp
|
||||
}, Packet);
|
||||
presence_broadcast_first(From, NewStateData, Packet);
|
||||
true ->
|
||||
presence_broadcast_to_trusted(StateData,
|
||||
presence_broadcast_to_trusted(NewStateData,
|
||||
From,
|
||||
StateData#state.pres_f,
|
||||
StateData#state.pres_a,
|
||||
NewStateData#state.pres_f,
|
||||
NewStateData#state.pres_a,
|
||||
Packet),
|
||||
if OldPriority < 0, NewPriority >= 0 ->
|
||||
resend_offline_messages(StateData);
|
||||
resend_offline_messages(NewStateData);
|
||||
true ->
|
||||
ok
|
||||
end,
|
||||
StateData#state{pres_last = Packet,
|
||||
pres_timestamp = Timestamp
|
||||
}
|
||||
NewStateData
|
||||
end,
|
||||
NewState
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user