3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 05:49:25 +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 timestamp := session.resumeDetails.Timestamp
if timestamp.IsZero() {
timestamp = session.client.ctime
}
gap := lastDiscarded.Sub(timestamp) gap := lastDiscarded.Sub(timestamp)
session.resumeDetails.HistoryIncomplete = gap > 0 session.resumeDetails.HistoryIncomplete = gap > 0
gapSeconds := int(gap.Seconds()) + 1 // round up to avoid confusion gapSeconds := int(gap.Seconds()) + 1 // round up to avoid confusion
@ -595,10 +598,10 @@ func (session *Session) playResume() {
} }
for _, fSession := range friend.Sessions() { for _, fSession := range friend.Sessions() {
if fSession.capabilities.Has(caps.Resume) { if fSession.capabilities.Has(caps.Resume) {
if timestamp.IsZero() { if session.resumeDetails.HistoryIncomplete {
fSession.Send(nil, oldNickmask, "RESUMED", hostname)
} else {
fSession.Send(nil, oldNickmask, "RESUMED", hostname, timestampString) fSession.Send(nil, oldNickmask, "RESUMED", hostname, timestampString)
} else {
fSession.Send(nil, oldNickmask, "RESUMED", hostname)
} }
} else { } else {
if session.resumeDetails.HistoryIncomplete { if session.resumeDetails.HistoryIncomplete {