diff options
author | Jeffas <dev@jeffas.io> | 2019-07-12 16:14:26 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-12 11:27:18 -0400 |
commit | b0f25c3e0125bac08b49ad2a95a2cd05c2ba023b (patch) | |
tree | 5100883f06a61e88980f94960456e6bb92646a63 | |
parent | 7a26b48c228ef59287847e7540b1cf19eacd6070 (diff) |
Fix read reply flag formatting
The readFlag was displaying wrong and not using combinations of the
flags to decide the string.
-rw-r--r-- | lib/indexformat.go | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/indexformat.go b/lib/indexformat.go index fa39909..34b4d77 100644 --- a/lib/indexformat.go +++ b/lib/indexformat.go @@ -161,16 +161,19 @@ func ParseIndexFormat(conf *config.AercConfig, number int, } case 'Z': // calculate all flags - var readFlag = "" + var readReplyFlag = "" var delFlag = "" var flaggedFlag = "" + seen := false + recent := false + answered := false for _, flag := range msg.Flags { if flag == models.SeenFlag { - readFlag = "O" // message is old + seen = true } else if flag == models.RecentFlag { - readFlag = "N" // message is new + recent = true } else if flag == models.AnsweredFlag { - readFlag = "r" // message has been replied to + answered = true } if flag == models.DeletedFlag { delFlag = "D" @@ -181,8 +184,19 @@ func ParseIndexFormat(conf *config.AercConfig, number int, } // TODO: check gpg stuff } + if seen { + if answered { + readReplyFlag = "r" // message has been replied to + } + } else { + if recent { + readReplyFlag = "N" // message is new + } else { + readReplyFlag = "O" // message is old + } + } retval = append(retval, '3', 's') - args = append(args, readFlag+delFlag+flaggedFlag) + args = append(args, readReplyFlag+delFlag+flaggedFlag) // Move the below cases to proper alphabetical positions once // implemented |