about summary refs log tree commit diff stats
path: root/worker/maildir/worker.go
diff options
context:
space:
mode:
Diffstat (limited to 'worker/maildir/worker.go')
-rw-r--r--worker/maildir/worker.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 533bb7c..3e59da6 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -407,5 +407,19 @@ func (w *Worker) handleAppendMessage(msg *types.AppendMessage) error {
 }
 
 func (w *Worker) handleSearchDirectory(msg *types.SearchDirectory) error {
-	return errUnsupported
+	w.worker.Logger.Printf("Searching directory %v with args: %v", *w.selected, msg.Argv)
+	criteria, err := parseSearch(msg.Argv)
+	if err != nil {
+		return err
+	}
+	w.worker.Logger.Printf("Searching with parsed criteria: %#v", criteria)
+	uids, err := w.search(criteria)
+	if err != nil {
+		return err
+	}
+	w.worker.PostMessage(&types.SearchResults{
+		Message: types.RespondTo(msg),
+		Uids:    uids,
+	}, nil)
+	return nil
 }