|
@@ -580,14 +580,14 @@ func (session *Session) playResume() {
|
580
|
580
|
|
581
|
581
|
timestamp := session.resumeDetails.Timestamp
|
582
|
582
|
gap := lastDiscarded.Sub(timestamp)
|
583
|
|
- session.resumeDetails.HistoryIncomplete = gap > 0
|
|
583
|
+ session.resumeDetails.HistoryIncomplete = gap > 0 || timestamp.IsZero()
|
584
|
584
|
gapSeconds := int(gap.Seconds()) + 1 // round up to avoid confusion
|
585
|
585
|
|
586
|
586
|
details := client.Details()
|
587
|
587
|
oldNickmask := details.nickMask
|
588
|
588
|
client.SetRawHostname(session.rawHostname)
|
589
|
589
|
hostname := client.Hostname() // may be a vhost
|
590
|
|
- timestampString := session.resumeDetails.Timestamp.Format(IRCv3TimestampFormat)
|
|
590
|
+ timestampString := timestamp.Format(IRCv3TimestampFormat)
|
591
|
591
|
|
592
|
592
|
// send quit/resume messages to friends
|
593
|
593
|
for friend := range friends {
|
|
@@ -596,23 +596,29 @@ func (session *Session) playResume() {
|
596
|
596
|
}
|
597
|
597
|
for _, fSession := range friend.Sessions() {
|
598
|
598
|
if fSession.capabilities.Has(caps.Resume) {
|
599
|
|
- if session.resumeDetails.HistoryIncomplete {
|
|
599
|
+ if !session.resumeDetails.HistoryIncomplete {
|
|
600
|
+ fSession.Send(nil, oldNickmask, "RESUMED", hostname, "ok")
|
|
601
|
+ } else if session.resumeDetails.HistoryIncomplete && !timestamp.IsZero() {
|
600
|
602
|
fSession.Send(nil, oldNickmask, "RESUMED", hostname, timestampString)
|
601
|
603
|
} else {
|
602
|
604
|
fSession.Send(nil, oldNickmask, "RESUMED", hostname)
|
603
|
605
|
}
|
604
|
606
|
} else {
|
605
|
|
- if session.resumeDetails.HistoryIncomplete {
|
606
|
|
- fSession.Send(nil, oldNickmask, "QUIT", fmt.Sprintf(friend.t("Client reconnected (up to %d seconds of history lost)"), gapSeconds))
|
607
|
|
- } else {
|
|
607
|
+ if !session.resumeDetails.HistoryIncomplete {
|
608
|
608
|
fSession.Send(nil, oldNickmask, "QUIT", fmt.Sprintf(friend.t("Client reconnected")))
|
|
609
|
+ } else if session.resumeDetails.HistoryIncomplete && !timestamp.IsZero() {
|
|
610
|
+ fSession.Send(nil, oldNickmask, "QUIT", fmt.Sprintf(friend.t("Client reconnected (up to %d seconds of message history lost)"), gapSeconds))
|
|
611
|
+ } else {
|
|
612
|
+ fSession.Send(nil, oldNickmask, "QUIT", fmt.Sprintf(friend.t("Client reconnected (message history may have been lost)")))
|
609
|
613
|
}
|
610
|
614
|
}
|
611
|
615
|
}
|
612
|
616
|
}
|
613
|
617
|
|
614
|
|
- if session.resumeDetails.HistoryIncomplete {
|
|
618
|
+ if session.resumeDetails.HistoryIncomplete && !timestamp.IsZero() {
|
615
|
619
|
session.Send(nil, client.server.name, "WARN", "RESUME", "HISTORY_LOST", fmt.Sprintf(client.t("Resume may have lost up to %d seconds of history"), gapSeconds))
|
|
620
|
+ } else {
|
|
621
|
+ session.Send(nil, client.server.name, "WARN", "RESUME", "HISTORY_LOST", client.t("Resume may have lost some message history"))
|
616
|
622
|
}
|
617
|
623
|
|
618
|
624
|
session.Send(nil, client.server.name, "RESUME", "SUCCESS", details.nick)
|