26
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-28 17:38:54 +01:00

Include original timestamp on delayed presences (thanks to Mickael Remond)(EJAB-234)

SVN Revision: 2349
This commit is contained in:
Badlop 2009-06-30 17:51:37 +00:00
parent 16ca8d178d
commit f82131af15

View File

@ -1359,7 +1359,13 @@ process_presence_probe(From, To, StateData) ->
andalso ?SETS:is_element(LFrom, StateData#state.pres_a),
if
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(
privacy_check_packet, StateData#state.server,
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_i, Packet),
StateData#state{pres_last = undefined,
pres_timestamp = undefined,
pres_a = ?SETS:new(),
pres_i = ?SETS:new(),
pres_invis = false};
@ -1426,6 +1433,7 @@ presence_update(From, Packet, StateData) ->
StateData#state.pres_i,
Packet),
S1 = StateData#state{pres_last = undefined,
pres_timestamp = undefined,
pres_a = ?SETS:new(),
pres_i = ?SETS:new(),
pres_invis = true},
@ -1462,6 +1470,7 @@ presence_update(From, Packet, StateData) ->
catch
_Exception1 -> 0
end,
Timestamp = calendar:now_to_universal_time(now()),
update_priority(NewPriority, Packet, StateData),
FromUnavail = (StateData#state.pres_last == undefined) or
StateData#state.pres_invis,
@ -1480,7 +1489,8 @@ presence_update(From, Packet, StateData) ->
end,
presence_broadcast_first(
From, StateData#state{pres_last = Packet,
pres_invis = false
pres_invis = false,
pres_timestamp = Timestamp
}, Packet);
true ->
presence_broadcast_to_trusted(StateData,
@ -1494,7 +1504,8 @@ presence_update(From, Packet, StateData) ->
ok
end,
StateData#state{pres_last = Packet,
pres_invis = false
pres_invis = false,
pres_timestamp = Timestamp
}
end,
NewState