aboutsummaryrefslogtreecommitdiff
path: root/internal/imap/connection.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-23 23:39:20 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-04-23 23:39:20 +0200
commitc1fbae6e0f5981d4d60f5b614d5d195ae5cde4a8 (patch)
treefd75401dadbe1e4788b19458bc84e697b722d386 /internal/imap/connection.go
parentf8a89ce8d9a3d5882a484fcaec810dc90f4a5e5d (diff)
downloadfeed2imap-go-c1fbae6e0f5981d4d60f5b614d5d195ae5cde4a8.tar.gz
feed2imap-go-c1fbae6e0f5981d4d60f5b614d5d195ae5cde4a8.tar.bz2
feed2imap-go-c1fbae6e0f5981d4d60f5b614d5d195ae5cde4a8.zip
A mailbox may exist, but not be writable when \Noselect is set
Diffstat (limited to 'internal/imap/connection.go')
-rw-r--r--internal/imap/connection.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/internal/imap/connection.go b/internal/imap/connection.go
index e0360bd..88b1496 100644
--- a/internal/imap/connection.go
+++ b/internal/imap/connection.go
@@ -9,6 +9,7 @@ import (
imapClient "github.com/emersion/go-imap/client"
"github.com/Necoro/feed2imap-go/internal/log"
+ "github.com/Necoro/feed2imap-go/internal/util"
)
type connection struct {
@@ -109,10 +110,10 @@ func (conn *connection) ensureFolder(folder Folder) error {
panic("Delimiters do not match")
}
- switch found {
- case 0:
+ switch {
+ case found == 0 || (found == 1 && util.StrContains(mbox.Attributes, imap.NoSelectAttr)):
return conn.createFolder(folder.str)
- case 1:
+ case found == 1:
conn.mailboxes.add(mbox)
return nil
default: