summary refs log tree commit diff stats
path: root/worker/imap/open.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-01-13 16:18:10 -0500
committerDrew DeVault <sir@cmpwn.com>2019-01-13 16:18:10 -0500
commit2750f99a6049322b1361b5bfa4dff3b1df2b36ab (patch)
tree0c18f4a8180f1eda1616c07296d20323edfeab62 /worker/imap/open.go
parentcf664620005cf65d060e689fbb27b939dd3192a7 (diff)
downloadaerc-2750f99a6049322b1361b5bfa4dff3b1df2b36ab.tar.gz
Issue IMAP SELECT command
Diffstat (limited to 'worker/imap/open.go')
-rw-r--r--worker/imap/open.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/worker/imap/open.go b/worker/imap/open.go
new file mode 100644
index 0000000..d90a292
--- /dev/null
+++ b/worker/imap/open.go
@@ -0,0 +1,20 @@
+package imap
+
+import (
+	"git.sr.ht/~sircmpwn/aerc2/worker/types"
+)
+
+func (imapw *IMAPWorker) handleOpenDirectory(msg *types.OpenDirectory) {
+	imapw.worker.Logger.Printf("Opening %s", msg.Directory)
+	go func() {
+		_, err := imapw.client.Select(msg.Directory, false)
+		if err != nil {
+			imapw.worker.PostMessage(&types.Error{
+				Message: types.RespondTo(msg),
+				Error:   err,
+			}, nil)
+		} else {
+			imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil)
+		}
+	}()
+}