dirlist: fix ruestring counts from checkmail

Commit 8b6f971 broke ruestring counts when AccurateCounts=true, which
primarily occur from a checkmail. This restores the functionality.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Tim Culverhouse 2022-06-07 15:22:26 -05:00 committed by Robin Jarry
parent 83e0e2638d
commit ed005f770c

View file

@ -249,20 +249,17 @@ func (dirlist *DirectoryList) getRUEString(name string) string {
if !ok {
return ""
}
var totalRecent, totalUnseen, totalExists int
if !msgStore.DirInfo.AccurateCounts {
totalRecent, totalUnseen = countRUE(msgStore)
msgStore.DirInfo.Recent = totalRecent
msgStore.DirInfo.Unseen = totalUnseen
msgStore.DirInfo.Recent, msgStore.DirInfo.Unseen = countRUE(msgStore)
}
totalExists = msgStore.DirInfo.Exists
di := msgStore.DirInfo
rueString := ""
if totalRecent > 0 {
rueString = fmt.Sprintf("%d/%d/%d", totalRecent, totalUnseen, totalExists)
} else if totalUnseen > 0 {
rueString = fmt.Sprintf("%d/%d", totalUnseen, totalExists)
} else if totalExists > 0 {
rueString = fmt.Sprintf("%d", totalExists)
if di.Recent > 0 {
rueString = fmt.Sprintf("%d/%d/%d", di.Recent, di.Unseen, di.Exists)
} else if di.Unseen > 0 {
rueString = fmt.Sprintf("%d/%d", di.Unseen, di.Exists)
} else if di.Exists > 0 {
rueString = fmt.Sprintf("%d", di.Exists)
}
return rueString
}