Fix read reply flag formatting

The readFlag was displaying wrong and not using combinations of the
flags to decide the string.
This commit is contained in:
Jeffas 2019-07-12 16:14:26 +01:00 committed by Drew DeVault
parent 7a26b48c22
commit b0f25c3e01
1 changed files with 19 additions and 5 deletions

View File

@ -161,16 +161,19 @@ func ParseIndexFormat(conf *config.AercConfig, number int,
} }
case 'Z': case 'Z':
// calculate all flags // calculate all flags
var readFlag = "" var readReplyFlag = ""
var delFlag = "" var delFlag = ""
var flaggedFlag = "" var flaggedFlag = ""
seen := false
recent := false
answered := false
for _, flag := range msg.Flags { for _, flag := range msg.Flags {
if flag == models.SeenFlag { if flag == models.SeenFlag {
readFlag = "O" // message is old seen = true
} else if flag == models.RecentFlag { } else if flag == models.RecentFlag {
readFlag = "N" // message is new recent = true
} else if flag == models.AnsweredFlag { } else if flag == models.AnsweredFlag {
readFlag = "r" // message has been replied to answered = true
} }
if flag == models.DeletedFlag { if flag == models.DeletedFlag {
delFlag = "D" delFlag = "D"
@ -181,8 +184,19 @@ func ParseIndexFormat(conf *config.AercConfig, number int,
} }
// TODO: check gpg stuff // 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') 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 // Move the below cases to proper alphabetical positions once
// implemented // implemented