mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Include original timestamp on delayed presences (thanks to Mickael Remond)(EJAB-234)
SVN Revision: 2349
This commit is contained in:
parent
16ca8d178d
commit
f82131af15
@ -1359,7 +1359,13 @@ process_presence_probe(From, To, StateData) ->
|
|||||||
andalso ?SETS:is_element(LFrom, StateData#state.pres_a),
|
andalso ?SETS:is_element(LFrom, StateData#state.pres_a),
|
||||||
if
|
if
|
||||||
Cond1 ->
|
Cond1 ->
|
||||||
Packet = StateData#state.pres_last,
|
Timestamp = StateData#state.pres_timestamp,
|
||||||
|
Packet = exmpp_xml:append_children(
|
||||||
|
StateData#state.pres_last,
|
||||||
|
%% To is the one sending the presence (the target of the probe)
|
||||||
|
[jlib:timestamp_to_xml(Timestamp, utc, To, ""),
|
||||||
|
%% TODO: Delete the next line once XEP-0091 is Obsolete
|
||||||
|
jlib:timestamp_to_xml(Timestamp)]),
|
||||||
case ejabberd_hooks:run_fold(
|
case ejabberd_hooks:run_fold(
|
||||||
privacy_check_packet, StateData#state.server,
|
privacy_check_packet, StateData#state.server,
|
||||||
allow,
|
allow,
|
||||||
@ -1406,6 +1412,7 @@ presence_update(From, Packet, StateData) ->
|
|||||||
presence_broadcast(StateData, From, StateData#state.pres_a, Packet),
|
presence_broadcast(StateData, From, StateData#state.pres_a, Packet),
|
||||||
presence_broadcast(StateData, From, StateData#state.pres_i, Packet),
|
presence_broadcast(StateData, From, StateData#state.pres_i, Packet),
|
||||||
StateData#state{pres_last = undefined,
|
StateData#state{pres_last = undefined,
|
||||||
|
pres_timestamp = undefined,
|
||||||
pres_a = ?SETS:new(),
|
pres_a = ?SETS:new(),
|
||||||
pres_i = ?SETS:new(),
|
pres_i = ?SETS:new(),
|
||||||
pres_invis = false};
|
pres_invis = false};
|
||||||
@ -1426,6 +1433,7 @@ presence_update(From, Packet, StateData) ->
|
|||||||
StateData#state.pres_i,
|
StateData#state.pres_i,
|
||||||
Packet),
|
Packet),
|
||||||
S1 = StateData#state{pres_last = undefined,
|
S1 = StateData#state{pres_last = undefined,
|
||||||
|
pres_timestamp = undefined,
|
||||||
pres_a = ?SETS:new(),
|
pres_a = ?SETS:new(),
|
||||||
pres_i = ?SETS:new(),
|
pres_i = ?SETS:new(),
|
||||||
pres_invis = true},
|
pres_invis = true},
|
||||||
@ -1462,6 +1470,7 @@ presence_update(From, Packet, StateData) ->
|
|||||||
catch
|
catch
|
||||||
_Exception1 -> 0
|
_Exception1 -> 0
|
||||||
end,
|
end,
|
||||||
|
Timestamp = calendar:now_to_universal_time(now()),
|
||||||
update_priority(NewPriority, Packet, StateData),
|
update_priority(NewPriority, Packet, StateData),
|
||||||
FromUnavail = (StateData#state.pres_last == undefined) or
|
FromUnavail = (StateData#state.pres_last == undefined) or
|
||||||
StateData#state.pres_invis,
|
StateData#state.pres_invis,
|
||||||
@ -1480,7 +1489,8 @@ presence_update(From, Packet, StateData) ->
|
|||||||
end,
|
end,
|
||||||
presence_broadcast_first(
|
presence_broadcast_first(
|
||||||
From, StateData#state{pres_last = Packet,
|
From, StateData#state{pres_last = Packet,
|
||||||
pres_invis = false
|
pres_invis = false,
|
||||||
|
pres_timestamp = Timestamp
|
||||||
}, Packet);
|
}, Packet);
|
||||||
true ->
|
true ->
|
||||||
presence_broadcast_to_trusted(StateData,
|
presence_broadcast_to_trusted(StateData,
|
||||||
@ -1494,7 +1504,8 @@ presence_update(From, Packet, StateData) ->
|
|||||||
ok
|
ok
|
||||||
end,
|
end,
|
||||||
StateData#state{pres_last = Packet,
|
StateData#state{pres_last = Packet,
|
||||||
pres_invis = false
|
pres_invis = false,
|
||||||
|
pres_timestamp = Timestamp
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
NewState
|
NewState
|
||||||
|
Loading…
Reference in New Issue
Block a user