diff options
Diffstat (limited to 'worker/imap/worker.go')
-rw-r--r-- | worker/imap/worker.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/worker/imap/worker.go b/worker/imap/worker.go index f08c0ec9..7ef759d4 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -15,6 +15,7 @@ import ( "git.sr.ht/~rjarry/aerc/models" "git.sr.ht/~rjarry/aerc/worker/handlers" "git.sr.ht/~rjarry/aerc/worker/imap/extensions" + "git.sr.ht/~rjarry/aerc/worker/middleware" "git.sr.ht/~rjarry/aerc/worker/types" ) @@ -58,6 +59,7 @@ type imapConfig struct { keepalive_interval int cacheEnabled bool cacheMaxAge time.Duration + useXGMEXT bool } type IMAPWorker struct { @@ -120,6 +122,14 @@ func (w *IMAPWorker) newClient(c *client.Client) { w.liststatus = true w.worker.Debugf("Server Capability found: LIST-STATUS") } + xgmext, err := w.client.Support("X-GM-EXT-1") + if err == nil && xgmext && w.config.useXGMEXT { + w.worker.Debugf("Server Capability found: X-GM-EXT-1") + w.worker = middleware.NewGmailWorker(w.worker, w.client.Client, w.idler) + } + if err == nil && !xgmext && w.config.useXGMEXT { + w.worker.Infof("X-GM-EXT-1 requested, but it is not supported") + } } func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { |