diff options
author | Kevin Kuehler <keur@xcf.berkeley.edu> | 2019-10-28 12:07:01 -0700 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2019-10-29 11:07:25 -0400 |
commit | fad17adfefce95234856fb558becd73fb61c830b (patch) | |
tree | 30c841353c3f2e30988a91b8a65346ba6c048a9b /worker/imap/worker.go | |
parent | dca84afbbb050e21214b921ddd50eebc5c690435 (diff) |
worker/imap: Add threading extension
* Import the go-imap-sortthread library
* Add sortthread client to imapClient in worker
* Add handleDirectoryThreaded, which uses the go-imap-sortthread, and
converts the results to the aerc thread type
Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Diffstat (limited to 'worker/imap/worker.go')
-rw-r--r-- | worker/imap/worker.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/worker/imap/worker.go b/worker/imap/worker.go index 4d3e51c..1ba3774 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -8,6 +8,7 @@ import ( "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" @@ -26,6 +27,7 @@ var errUnsupported = fmt.Errorf("unsupported command") type imapClient struct { *client.Client + tc *sortthread.ThreadClient idle *idle.IdleClient } @@ -153,7 +155,7 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { } c.Updates = w.updates - w.client = &imapClient{c, idle.NewClient(c)} + w.client = &imapClient{c, sortthread.NewThreadClient(c), idle.NewClient(c)} w.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) case *types.ListDirectories: w.handleListDirectories(msg) @@ -161,6 +163,8 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { w.handleOpenDirectory(msg) case *types.FetchDirectoryContents: w.handleFetchDirectoryContents(msg) + case *types.FetchDirectoryThreaded: + w.handleDirectoryThreaded(msg) case *types.CreateDirectory: w.handleCreateDirectory(msg) case *types.FetchMessageHeaders: |