fix: rue string count accuracy
The countRUE function was inaccurately counting flags. If a message was unread and recent, it was only counted as recent. The two flags are not mutually exclusive. A previous count for a mailbox with 1 recent, 1 unread, and 5 existing would be : 1/0/5 An accurate count of this state would be: 1/1/5 This patch fixes the count. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
2551dd1bfa
commit
4985d1bab8
1 changed files with 4 additions and 8 deletions
|
@ -522,20 +522,16 @@ func countRUE(msgStore *lib.MessageStore) (recent, unread int) {
|
|||
continue
|
||||
}
|
||||
seen := false
|
||||
isrecent := false
|
||||
for _, flag := range msg.Flags {
|
||||
if flag == models.SeenFlag {
|
||||
seen = true
|
||||
} else if flag == models.RecentFlag {
|
||||
isrecent = true
|
||||
}
|
||||
if flag == models.RecentFlag {
|
||||
recent++
|
||||
}
|
||||
}
|
||||
if !seen {
|
||||
if isrecent {
|
||||
recent++
|
||||
} else {
|
||||
unread++
|
||||
}
|
||||
unread++
|
||||
}
|
||||
}
|
||||
return recent, unread
|
||||
|
|
Loading…
Reference in a new issue