From 6473848d87de099b31812f20c7eb181d5c0c3c51 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Tue, 16 Jul 2019 13:53:33 -0400 Subject: maildir: Watch for new messages When a directory is opened, start watching its "new" subdirectory for incoming messages using the fsnotify library. When creation events are detected, run the Unseen routine to move the message from new to cur and add new UIDs to the store, updating the UI's list of directory contents as we go. --- worker/worker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'worker/worker.go') diff --git a/worker/worker.go b/worker/worker.go index dd14a23..a37927e 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -29,7 +29,11 @@ func NewWorker(source string, logger *log.Logger) (*types.Worker, error) { case "imaps": worker.Backend = imap.NewIMAPWorker(worker) case "maildir": - worker.Backend = maildir.NewWorker(worker) + if w, err := maildir.NewWorker(worker); err != nil { + return nil, fmt.Errorf("could not create maildir worker: %v", err) + } else { + worker.Backend = w + } default: return nil, fmt.Errorf("Unknown backend %s", u.Scheme) } -- cgit v1.2.3