aboutsummaryrefslogtreecommitdiffstats
path: root/worker/imap
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-05-13 00:07:41 +0200
committerRobin Jarry <robin@jarry.cc>2023-05-16 13:56:58 +0200
commit8dca1171c7c40228e3be4f2eedcb1fe85a680e7c (patch)
tree9903056b7eb76fe28994e2c5f12f786baf31f6c1 /worker/imap
parent06723ff579b692867c6ab87e3838d04e9d044912 (diff)
downloadaerc-8dca1171c7c40228e3be4f2eedcb1fe85a680e7c.tar.gz
imap: handle the NonExistent attribute
Treat the "\NonExistent" attribute similar to the "\NoSelect" one. Only list folders without the "\NonExistent" or "\NoSelect" attribute. According to RFC 9501, section 7.3.1, the "\NonExistent" attribute implies "\NoSelect". When using the LIST-STATUS extension, some servers return a "\NonExistent" flag instead of the "\NoSelect" one. We only check for the "\NoSelect" attribute, and hence, a "\NonExistent" folder will appear in the directory list and raise an error when being selected. This occurs, e.g., for gmail accounts with the "[Gmail]" folder. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/imap')
-rw-r--r--worker/imap/list.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go
index 41924d86..7a8fc17c 100644
--- a/worker/imap/list.go
+++ b/worker/imap/list.go
@@ -94,9 +94,12 @@ func (imapw *IMAPWorker) handleListDirectories(msg *types.ListDirectories) {
&types.Done{Message: types.RespondTo(msg)}, nil)
}
+const NonExistentAttr = "\\NonExistent"
+
func canOpen(mbox *imap.MailboxInfo) bool {
for _, attr := range mbox.Attributes {
- if attr == imap.NoSelectAttr {
+ if attr == imap.NoSelectAttr ||
+ attr == NonExistentAttr {
return false
}
}