diff options
author | Kevin Kuehler <keur@xcf.berkeley.edu> | 2019-10-28 12:07:07 -0700 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2019-10-29 11:07:55 -0400 |
commit | 8bc3ccb9017b04aafccafa294f219ced5b41a372 (patch) | |
tree | 73abb7b026bf955582ca3e9c8f84c8b3c858258b /worker | |
parent | 37f33ad65bfbfa69e620fcb0fdcff6393a251ac7 (diff) |
Add manual threading to the pipeline
Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Diffstat (limited to 'worker')
-rw-r--r-- | worker/imap/open.go | 17 | ||||
-rw-r--r-- | worker/imap/worker.go | 2 | ||||
-rw-r--r-- | worker/types/messages.go | 9 |
3 files changed, 28 insertions, 0 deletions
diff --git a/worker/imap/open.go b/worker/imap/open.go index 1152887..c7a479a 100644 --- a/worker/imap/open.go +++ b/worker/imap/open.go @@ -50,6 +50,23 @@ func (imapw *IMAPWorker) handleFetchDirectoryContents( } } +func (imapw *IMAPWorker) handleNativeThreadSupport( + msg *types.FetchNativeThreadSupport) { + hasSupport, err := imapw.client.tc.SupportThread() + if err != nil { + imapw.worker.PostMessage(&types.Error{ + Message: types.RespondTo(msg), + Error: err, + }, nil) + } else { + imapw.worker.PostMessage(&types.NativeThreadSupport{ + Message: types.RespondTo(msg), + HasSupport: hasSupport, + }, nil) + imapw.worker.PostMessage(&types.Done{types.RespondTo(msg)}, nil) + } +} + func (imapw *IMAPWorker) handleDirectoryThreaded( msg *types.FetchDirectoryThreaded) { imapw.worker.Logger.Printf("Fetching threaded UID list") diff --git a/worker/imap/worker.go b/worker/imap/worker.go index 1ba3774..ed1ad9e 100644 --- a/worker/imap/worker.go +++ b/worker/imap/worker.go @@ -165,6 +165,8 @@ func (w *IMAPWorker) handleMessage(msg types.WorkerMessage) error { w.handleFetchDirectoryContents(msg) case *types.FetchDirectoryThreaded: w.handleDirectoryThreaded(msg) + case *types.FetchNativeThreadSupport: + w.handleNativeThreadSupport(msg) case *types.CreateDirectory: w.handleCreateDirectory(msg) case *types.FetchMessageHeaders: diff --git a/worker/types/messages.go b/worker/types/messages.go index d5f2484..2cde38f 100644 --- a/worker/types/messages.go +++ b/worker/types/messages.go @@ -81,6 +81,10 @@ type FetchDirectoryContents struct { SortCriteria []*SortCriterion } +type FetchNativeThreadSupport struct { + Message +} + type FetchDirectoryThreaded struct { Message SortCriteria []*SortCriterion @@ -157,6 +161,11 @@ type DirectoryContents struct { Uids []uint32 } +type NativeThreadSupport struct { + Message + HasSupport bool +} + type DirectoryThreaded struct { Message ThreadRoot *Thread |