diff options
author | Reto Brunner <reto@labrat.space> | 2019-07-18 06:25:42 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-07-19 15:37:55 -0400 |
commit | 6fed04bb9fa43d3886d47d0c845d32fff11569b5 (patch) | |
tree | 461c8086c06236761555f08a614f88d7c058523b /worker/imap | |
parent | 66a9052f0fa8d2caf0d82435241b10e9ba8665b2 (diff) | |
download | aerc-6fed04bb9fa43d3886d47d0c845d32fff11569b5.tar.gz |
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/imap')
-rw-r--r-- | worker/imap/worker.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/worker/imap/worker.go b/worker/imap/worker.go index de869941..b1ef9c91 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -13,9 +13,15 @@ import ( "git.sr.ht/~sircmpwn/aerc/lib" "git.sr.ht/~sircmpwn/aerc/models" + "git.sr.ht/~sircmpwn/aerc/worker/handlers" "git.sr.ht/~sircmpwn/aerc/worker/types" ) +func init() { + handlers.RegisterWorkerFactory("imap", NewIMAPWorker) + handlers.RegisterWorkerFactory("imaps", NewIMAPWorker) +} + var errUnsupported = fmt.Errorf("unsupported command") type imapClient struct { @@ -43,12 +49,12 @@ type IMAPWorker struct { seqMap []uint32 } -func NewIMAPWorker(worker *types.Worker) *IMAPWorker { +func NewIMAPWorker(worker *types.Worker) (types.Backend, error) { return &IMAPWorker{ idleDone: make(chan error), updates: make(chan client.Update, 50), worker: worker, - } + }, nil } func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { |