diff options
author | Robin Jarry <robin@jarry.cc> | 2021-11-01 21:19:17 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2021-11-02 11:24:33 +0100 |
commit | 4cf0ea2a056708274438189e6eb3a0c805bf4ae1 (patch) | |
tree | 04279eb92d4eb8514cbb06ef35ef417b00657cd3 | |
parent | 138977b2ceef2af605f48a5ea9e44c967947561b (diff) | |
download | aerc-4cf0ea2a056708274438189e6eb3a0c805bf4ae1.tar.gz |
imap: use builtin idle support
go-imap supports IDLE since 1.2.0. Remove dependency to go-imap-idle.
Link: https://github.com/emersion/go-imap/commit/ac3f8e195ef1b6d
Signed-off-by: Robin Jarry <robin@jarry.cc>
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | worker/imap/open.go | 3 | ||||
-rw-r--r-- | worker/imap/worker.go | 6 |
4 files changed, 2 insertions, 12 deletions
@@ -8,7 +8,6 @@ require ( github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 github.com/ddevault/go-libvterm v0.0.0-20190526194226-b7d861da3810 github.com/emersion/go-imap v1.2.0 - github.com/emersion/go-imap-idle v0.0.0-20210907174914-db2568431445 github.com/emersion/go-imap-sortthread v1.2.0 github.com/emersion/go-maildir v0.2.0 github.com/emersion/go-message v0.15.0 @@ -65,10 +65,6 @@ github.com/emersion/go-imap v1.0.6-0.20201014170015-5a03a09eba6d/go.mod h1:yKASt github.com/emersion/go-imap v1.0.6/go.mod h1:yKASt+C3ZiDAiCSssxg9caIckWF/JG7ZQTO7GAmvicU= github.com/emersion/go-imap v1.2.0 h1:lyUQ3+EVM21/qbWE/4Ya5UG9r5+usDxlg4yfp3TgHFA= github.com/emersion/go-imap v1.2.0/go.mod h1:Qlx1FSx2FTxjnjWpIlVNEuX+ylerZQNFE5NsmKFSejY= -github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e h1:L7bswVJZcf2YHofgom49oFRwVqmBj/qZqDy9/SJpZMY= -github.com/emersion/go-imap-idle v0.0.0-20190519112320-2704abd7050e/go.mod h1:o14zPKCmEH5WC1vU5SdPoZGgNvQx7zzKSnxPQlobo78= -github.com/emersion/go-imap-idle v0.0.0-20210907174914-db2568431445 h1:dAGbaaU4LLupO7dnYZaELOoI3RoVDNi5DCGejLe8a7c= -github.com/emersion/go-imap-idle v0.0.0-20210907174914-db2568431445/go.mod h1:N/6S3dRTVt8xT867m+476C16+v/Fq4WZYvh2Chg0nmg= github.com/emersion/go-imap-sortthread v1.1.1-0.20201009054724-d020d96306b3 h1:I9RUCEAsOl1Hpcq7KRUVYvs0y8WYCjDT3tCXBSuHKoo= github.com/emersion/go-imap-sortthread v1.1.1-0.20201009054724-d020d96306b3/go.mod h1:opHOzblOHZKQM1JEy+GPk1217giNLa7kleyWTN06qnc= github.com/emersion/go-imap-sortthread v1.2.0 h1:EMVEJXPWAhXMWECjR82Rn/tza6MddcvTwGAdTu1vJKU= diff --git a/worker/imap/open.go b/worker/imap/open.go index 891b8a23..0a0d9fea 100644 --- a/worker/imap/open.go +++ b/worker/imap/open.go @@ -18,9 +18,6 @@ func (imapw *IMAPWorker) handleOpenDirectory(msg *types.OpenDirectory) { }, nil) } else { imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) - if imapw.idleStop == nil { - imapw.idleStop = make(chan struct{}) - } } } diff --git a/worker/imap/worker.go b/worker/imap/worker.go index dab0afb5..7e009669 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/emersion/go-imap" - idle "github.com/emersion/go-imap-idle" sortthread "github.com/emersion/go-imap-sortthread" "github.com/emersion/go-imap/client" "golang.org/x/oauth2" @@ -27,7 +26,6 @@ var errUnsupported = fmt.Errorf("unsupported command") type imapClient struct { *client.Client - idle *idle.IdleClient sort *sortthread.SortClient } @@ -157,7 +155,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { } c.Updates = w.updates - w.client = &imapClient{c, idle.NewClient(c), sortthread.NewSortClient(c)} + w.client = &imapClient{c, sortthread.NewSortClient(c)} w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) case *types.ListDirectories: w.handleListDirectories(msg) @@ -194,7 +192,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { if w.idleStop != nil { w.idleStop = make(chan struct{}) go func() { - w.idleDone <- w.client.idle.IdleWithFallback(w.idleStop, 0) + w.idleDone <- w.client.Idle(w.idleStop, &client.IdleOptions{0, 0}) }() } return reterr |