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),
|
FromUnavail = (StateData#state.pres_last == undefined),
|
||||||
?DEBUG("from unavail = ~p~n", [FromUnavail]),
|
?DEBUG("from unavail = ~p~n", [FromUnavail]),
|
||||||
NewState =
|
NewState =
|
||||||
|
NewStateData = StateData#state{pres_last = Packet,
|
||||||
|
pres_timestamp = Timestamp},
|
||||||
if
|
if
|
||||||
FromUnavail ->
|
FromUnavail ->
|
||||||
ejabberd_hooks:run(user_available_hook,
|
ejabberd_hooks:run(user_available_hook,
|
||||||
StateData#state.server,
|
NewStateData#state.server,
|
||||||
[StateData#state.jid]),
|
[NewStateData#state.jid]),
|
||||||
if NewPriority >= 0 ->
|
if NewPriority >= 0 ->
|
||||||
resend_offline_messages(StateData),
|
resend_offline_messages(NewStateData),
|
||||||
resend_subscription_requests(StateData);
|
resend_subscription_requests(NewStateData);
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
presence_broadcast_first(
|
presence_broadcast_first(From, NewStateData, Packet);
|
||||||
From, StateData#state{pres_last = Packet,
|
|
||||||
pres_timestamp = Timestamp
|
|
||||||
}, Packet);
|
|
||||||
true ->
|
true ->
|
||||||
presence_broadcast_to_trusted(StateData,
|
presence_broadcast_to_trusted(NewStateData,
|
||||||
From,
|
From,
|
||||||
StateData#state.pres_f,
|
NewStateData#state.pres_f,
|
||||||
StateData#state.pres_a,
|
NewStateData#state.pres_a,
|
||||||
Packet),
|
Packet),
|
||||||
if OldPriority < 0, NewPriority >= 0 ->
|
if OldPriority < 0, NewPriority >= 0 ->
|
||||||
resend_offline_messages(StateData);
|
resend_offline_messages(NewStateData);
|
||||||
true ->
|
true ->
|
||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
StateData#state{pres_last = Packet,
|
NewStateData
|
||||||
pres_timestamp = Timestamp
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
NewState
|
NewState
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user