aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-12-21 11:31:04 +0100
committerRobin Jarry <robin@jarry.cc>2023-01-04 22:57:31 +0100
commit5677f93ff8e0f212be112a110fcfe09663c84f98 (patch)
tree9f47f430b312d1f0dc1acdd3735cfd76ad21e0f0 /commands/msg
parent36fded03e762da97edde61559c8bf60d5749d6a2 (diff)
downloadaerc-5677f93ff8e0f212be112a110fcfe09663c84f98.tar.gz
model: change flags array to bitmask
Using a list of integers is not optimal. Use a bit mask instead. Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/read.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/commands/msg/read.go b/commands/msg/read.go
index 878dc3c8..cffd2218 100644
--- a/commands/msg/read.go
+++ b/commands/msg/read.go
@@ -34,7 +34,7 @@ func (FlagMsg) Complete(aerc *widgets.Aerc, args []string) []string {
// 'flag' or 'unflag', respectively, but the 'Seen' flag is affected.
func (FlagMsg) Execute(aerc *widgets.Aerc, args []string) error {
// The flag to change
- var flag models.Flag
+ var flag models.Flags
// User-readable name of the flag to change
var flagName string
// Whether to toggle the flag (true) or to enable/disable it (false)
@@ -130,14 +130,7 @@ func (FlagMsg) Execute(aerc *widgets.Aerc, args []string) error {
return err
}
for _, m := range msgs {
- var enabled bool
- for _, mFlag := range m.Flags {
- if mFlag == flag {
- enabled = true
- break
- }
- }
- if enabled {
+ if m.Flags.Has(flag) {
toDisable = append(toDisable, m.Uid)
} else {
toEnable = append(toEnable, m.Uid)