aboutsummaryrefslogtreecommitdiff
path: root/worker/jmap/mboxstate.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2023-06-04 14:05:22 +0200
committerRobin Jarry <robin@jarry.cc>2023-06-06 16:12:52 +0200
commit9e27c777d4c818dd4a9f265d174686ea988f9955 (patch)
tree56724afe0b4d9c28d277ffa274b2894ce9ffb95d /worker/jmap/mboxstate.go
parent856b3cc29b659a76ba9edf555ed162c0dd84b781 (diff)
downloadaerc-9e27c777d4c818dd4a9f265d174686ea988f9955.tar.gz
aerc-9e27c777d4c818dd4a9f265d174686ea988f9955.zip
jmap
Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/jmap/mboxstate.go')
-rw-r--r--worker/jmap/mboxstate.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/worker/jmap/mboxstate.go b/worker/jmap/mboxstate.go
new file mode 100644
index 00000000..0ee8bde3
--- /dev/null
+++ b/worker/jmap/mboxstate.go
@@ -0,0 +1,38 @@
+package jmap
+
+import (
+ "git.sr.ht/~rjarry/aerc/models"
+ "git.sr.ht/~rockorager/go-jmap"
+ "git.sr.ht/~rockorager/go-jmap/mail/email"
+ "git.sr.ht/~rockorager/go-jmap/mail/mailbox"
+)
+
+type MailboxState struct {
+ mbox *mailbox.Mailbox
+ dir string
+ queryState string
+ filter *email.FilterCondition
+ sort []*email.SortComparator
+ uids []uint32
+}
+
+func (s *MailboxState) FullPath(all map[jmap.ID]*MailboxState) string {
+ if s.mbox.ParentID == "" {
+ return s.mbox.Name
+ }
+ parent, ok := all[s.mbox.ParentID]
+ if !ok {
+ return s.mbox.Name
+ }
+ return parent.FullPath(all) + "/" + s.mbox.Name
+}
+
+var jmapRole2aerc = map[mailbox.Role]models.Role{
+ mailbox.RoleAll: models.AllRole,
+ mailbox.RoleArchive: models.ArchiveRole,
+ mailbox.RoleDrafts: models.DraftsRole,
+ mailbox.RoleInbox: models.InboxRole,
+ mailbox.RoleJunk: models.JunkRole,
+ mailbox.RoleSent: models.SentRole,
+ mailbox.RoleTrash: models.TrashRole,
+}