about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-02-24 20:12:16 +0100
committerDrew DeVault <sir@cmpwn.com>2020-02-25 11:05:25 -0500
commit53d0c0a9030ce20ee98c2a0bdb221e73f647c16c (patch)
tree6304027edf05cfff3f1c3c6b9f6e3a9354e07822
parent8ad517ea92356e97b35eb959ab3beef589fec686 (diff)
downloadaerc-53d0c0a9030ce20ee98c2a0bdb221e73f647c16c.tar.gz
widgets/dirlist: Fix total message count
This fixes an issue with the updated count logic, where only fetched messages
where counted to the exists string of the rue count.

Note that the count is still broken (we only count read / unread messages we
fetched, but that is the same behaviour as prior to the commit
66b68f35b3f3f3b97ec9951397fd75afeb0d0995)
-rw-r--r--widgets/dirlist.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index c000f52..600b38c 100644
--- a/widgets/dirlist.go
+++ b/widgets/dirlist.go
@@ -177,7 +177,10 @@ func (dirlist *DirectoryList) getRUEString(name string) string {
 		totalUnseen = msgStore.DirInfo.Unseen
 		totalExists = msgStore.DirInfo.Exists
 	} else {
-		totalRecent, totalUnseen, totalExists = countRUE(msgStore)
+		totalRecent, totalUnseen = countRUE(msgStore)
+		// use the total count from the dirinfo, else we only count already
+		// fetched messages
+		totalExists = msgStore.DirInfo.Exists
 	}
 	rueString := ""
 	if totalRecent > 0 {
@@ -377,7 +380,7 @@ func (dirlist *DirectoryList) getSortCriteria() []*types.SortCriterion {
 	return criteria
 }
 
-func countRUE(msgStore *lib.MessageStore) (recent, unread, exist int) {
+func countRUE(msgStore *lib.MessageStore) (recent, unread int) {
 	for _, msg := range msgStore.Messages {
 		if msg == nil {
 			continue
@@ -398,7 +401,6 @@ func countRUE(msgStore *lib.MessageStore) (recent, unread, exist int) {
 				unread++
 			}
 		}
-		exist++
 	}
-	return recent, unread, exist
+	return recent, unread
 }