about summary refs log tree commit diff stats
path: root/worker/imap/open.go
blob: d90a292c5b933de7f0a106d6f6887b17b3049f78 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)
		}
	}()
}