aboutsummaryrefslogtreecommitdiff
path: root/worker/maildir/worker.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-07-18 06:25:42 +0200
committerDrew DeVault <sir@cmpwn.com>2019-07-19 15:37:55 -0400
commit6fed04bb9fa43d3886d47d0c845d32fff11569b5 (patch)
tree461c8086c06236761555f08a614f88d7c058523b /worker/maildir/worker.go
parent66a9052f0fa8d2caf0d82435241b10e9ba8665b2 (diff)
Register worker in init.
This allows backends which can't always be compiled due to missing dependencies (say libnotmuch) to be compiled conditionally with buildflags.
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r--worker/maildir/worker.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 1e68a2e..84e0162 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -11,9 +11,14 @@ import (
"github.com/fsnotify/fsnotify"
"git.sr.ht/~sircmpwn/aerc/models"
+ "git.sr.ht/~sircmpwn/aerc/worker/handlers"
"git.sr.ht/~sircmpwn/aerc/worker/types"
)
+func init() {
+ handlers.RegisterWorkerFactory("maildir", NewWorker)
+}
+
var errUnsupported = fmt.Errorf("unsupported command")
// A Worker handles interfacing between aerc's UI and a group of maildirs.
@@ -25,7 +30,7 @@ type Worker struct {
}
// NewWorker creates a new maildir worker with the provided worker.
-func NewWorker(worker *types.Worker) (*Worker, error) {
+func NewWorker(worker *types.Worker) (types.Backend, error) {
watch, err := fsnotify.NewWatcher()
if err != nil {
return nil, fmt.Errorf("could not create file system watcher: %v", err)