From fea99ae8122e5c522184969bd5f7e80db5b26e34 Mon Sep 17 00:00:00 2001 From: Adam Kessel Date: Thu, 5 Dec 2024 15:47:12 -0500 Subject: [PATCH 1/2] added subfolder support --- imap/user.go | 8 +++++++- protonmail/labels.go | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/imap/user.go b/imap/user.go index ff865a28..079b4d0c 100644 --- a/imap/user.go +++ b/imap/user.go @@ -177,7 +177,13 @@ func (u *user) initMailboxes() error { continue } - u.mailboxes[label.ID], err = newMailbox(label.Name, label.ID, nil, u) + var displayName string + if len(label.Path) > 0 { + displayName = strings.ReplaceAll(label.Path, "/", ".") + } else { + displayName = label.Name + } + u.mailboxes[label.ID], err = newMailbox(displayName, label.ID, nil, u) if err != nil { return err } diff --git a/protonmail/labels.go b/protonmail/labels.go index fcd567be..1a23e2b6 100644 --- a/protonmail/labels.go +++ b/protonmail/labels.go @@ -27,6 +27,7 @@ const ( type Label struct { ID string Name string + Path string Color string Display int Type LabelType From c9e4aa3a3166d5e50cc21fb3194e25a597103b67 Mon Sep 17 00:00:00 2001 From: Adam Kessel Date: Thu, 5 Dec 2024 16:10:22 -0500 Subject: [PATCH 2/2] fix spacing --- imap/user.go | 13 ++++++------- protonmail/labels.go | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/imap/user.go b/imap/user.go index 079b4d0c..c6c10c2f 100644 --- a/imap/user.go +++ b/imap/user.go @@ -176,13 +176,12 @@ func (u *user) initMailboxes() error { if _, ok := u.mailboxes[label.ID]; ok { continue } - - var displayName string - if len(label.Path) > 0 { - displayName = strings.ReplaceAll(label.Path, "/", ".") - } else { - displayName = label.Name - } + var displayName string + if len(label.Path) > 0 { + displayName = strings.ReplaceAll(label.Path, "/", ".") + } else { + displayName = label.Name + } u.mailboxes[label.ID], err = newMailbox(displayName, label.ID, nil, u) if err != nil { return err diff --git a/protonmail/labels.go b/protonmail/labels.go index 1a23e2b6..d06979aa 100644 --- a/protonmail/labels.go +++ b/protonmail/labels.go @@ -27,7 +27,7 @@ const ( type Label struct { ID string Name string - Path string + Path string Color string Display int Type LabelType