diff options
Diffstat (limited to 'worker/imap')
-rw-r--r-- | worker/imap/list.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/worker/imap/list.go b/worker/imap/list.go index a61ea06..b9578ab 100644 --- a/worker/imap/list.go +++ b/worker/imap/list.go @@ -60,3 +60,19 @@ func canOpen(mbox *imap.MailboxInfo) bool { } return true } + +func (imapw *IMAPWorker) handleSearchDirectory(msg *types.SearchDirectory) { + imapw.worker.Logger.Println("Executing search") + + if uids, err := imapw.client.UidSearch(msg.Criteria); err != nil { + imapw.worker.PostMessage(&types.Error{ + Message: types.RespondTo(msg), + Error: err, + }, nil) + } else { + imapw.worker.PostMessage(&types.SearchResults{ + Message: types.RespondTo(msg), + Uids: uids, + }, nil) + } +} |