3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

new proposed format for RESUMED messages

This commit is contained in:
Shivaram Lingamneni 2019-05-27 04:40:24 -04:00
parent 57684fc1e5
commit 74732c4aeb

View File

@ -578,6 +578,9 @@ func (session *Session) playResume() {
}
timestamp := session.resumeDetails.Timestamp
if timestamp.IsZero() {
timestamp = session.client.ctime
}
gap := lastDiscarded.Sub(timestamp)
session.resumeDetails.HistoryIncomplete = gap > 0
gapSeconds := int(gap.Seconds()) + 1 // round up to avoid confusion
@ -595,10 +598,10 @@ func (session *Session) playResume() {
}
for _, fSession := range friend.Sessions() {
if fSession.capabilities.Has(caps.Resume) {
if timestamp.IsZero() {
fSession.Send(nil, oldNickmask, "RESUMED", hostname)
} else {
if session.resumeDetails.HistoryIncomplete {
fSession.Send(nil, oldNickmask, "RESUMED", hostname, timestampString)
} else {
fSession.Send(nil, oldNickmask, "RESUMED", hostname)
}
} else {
if session.resumeDetails.HistoryIncomplete {