about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAditya Mahajan <adityam@umich.edu>2019-06-14 17:11:17 -0400
committerDrew DeVault <sir@cmpwn.com>2019-06-16 11:16:26 -0400
commit1b7790553e04816c3dd677848b2584ffd6785220 (patch)
tree9703a63a324472dca9ff5bfc7b1bf316a2a2c295
parentab79bc34470883f69a329f82a931de7acd715e95 (diff)
downloadaerc-1b7790553e04816c3dd677848b2584ffd6785220.tar.gz
Ensure that flags are set properly
The current implementation has three classes of flags:
- readFlag
- delFlag
- flaggedFlag

The logic to check for them should be in parallel if branches rather
than in sequential if-else ladder.
-rw-r--r--lib/indexformat.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/indexformat.go b/lib/indexformat.go
index 8a329db..9e7a805 100644
--- a/lib/indexformat.go
+++ b/lib/indexformat.go
@@ -177,10 +177,12 @@ func ParseIndexFormat(conf *config.AercConfig, number int,
 					readFlag = "N" // message is new
 				} else if flag == imap.AnsweredFlag {
 					readFlag = "r" // message has been replied to
-				} else if flag == imap.DeletedFlag {
+				}
+				if flag == imap.DeletedFlag {
 					delFlag = "D"
 					// TODO: check if attachments
-				} else if flag == imap.FlaggedFlag {
+				}
+				if flag == imap.FlaggedFlag {
 					flaggedFlag = "!"
 				}
 				// TODO: check gpg stuff