aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap
diff options
context:
space:
mode:
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/connect.go11
-rw-r--r--worker/imap/worker.go18
2 files changed, 24 insertions, 5 deletions
diff --git a/worker/imap/connect.go b/worker/imap/connect.go
index 6f341753..f0ed8043 100644
--- a/worker/imap/connect.go
+++ b/worker/imap/connect.go
@@ -94,6 +94,17 @@ func (w *IMAPWorker) connect() (*client.Client, error) {
return nil, err
}
+ info := make(chan *imap.MailboxInfo, 1)
+ if err := c.List("", "", info); err != nil {
+ return nil, fmt.Errorf("failed to retrieve delimiter: %w", err)
+ }
+ mailboxinfo := <-info
+ w.delimiter = mailboxinfo.Delimiter
+ if w.delimiter == "" {
+ // just in case some implementation does not follow standards
+ w.delimiter = "/"
+ }
+
return c, nil
}
diff --git a/worker/imap/worker.go b/worker/imap/worker.go
index 1f61f458..f9a722e6 100644
--- a/worker/imap/worker.go
+++ b/worker/imap/worker.go
@@ -61,11 +61,12 @@ type imapConfig struct {
type IMAPWorker struct {
config imapConfig
- client *imapClient
- selected *imap.MailboxStatus
- updates chan client.Update
- worker *types.Worker
- seqMap SeqMap
+ client *imapClient
+ selected *imap.MailboxStatus
+ updates chan client.Update
+ worker *types.Worker
+ seqMap SeqMap
+ delimiter string
idler *idler
observer *observer
@@ -311,3 +312,10 @@ func (w *IMAPWorker) Run() {
func (w *IMAPWorker) Capabilities() *models.Capabilities {
return w.caps
}
+
+func (w *IMAPWorker) PathSeparator() string {
+ if w.delimiter == "" {
+ return "/"
+ }
+ return w.delimiter
+}