aboutsummaryrefslogtreecommitdiffstats
path: root/worker/notmuch/notmuch.go
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-01-25 08:25:49 -0500
committerRobin Jarry <robin@jarry.cc>2024-01-26 21:36:12 +0100
commit0aab8ac318f6dee479afba13d09a5d1d1c0baa91 (patch)
treef33819ffdf9ab21325a6d7b58e5d652c16a927eb /worker/notmuch/notmuch.go
parent936d519a67301bd78a4d737dc47234e3769e639f (diff)
downloadaerc-0aab8ac318f6dee479afba13d09a5d1d1c0baa91.tar.gz
notmuch: centralize flag/tag mappings
Mimic other backends that have centralized mappings. Doing so makes adding support for the draft flag simpler in a subsequent commit. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/notmuch/notmuch.go')
-rw-r--r--worker/notmuch/notmuch.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/worker/notmuch/notmuch.go b/worker/notmuch/notmuch.go
new file mode 100644
index 00000000..5610cac0
--- /dev/null
+++ b/worker/notmuch/notmuch.go
@@ -0,0 +1,24 @@
+//go:build notmuch
+// +build notmuch
+
+package notmuch
+
+import "git.sr.ht/~rjarry/aerc/models"
+
+var tagToFlag = map[string]models.Flags{
+ "unread": models.SeenFlag,
+ "replied": models.AnsweredFlag,
+ "flagged": models.FlaggedFlag,
+}
+
+var flagToTag = map[models.Flags]string{
+ models.SeenFlag: "unread",
+ models.AnsweredFlag: "replied",
+ models.FlaggedFlag: "flagged",
+}
+
+var flagToInvert = map[models.Flags]bool{
+ models.SeenFlag: true,
+ models.AnsweredFlag: false,
+ models.FlaggedFlag: false,
+}