aboutsummaryrefslogtreecommitdiffstats
path: root/worker/maildir
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-07-05 14:48:40 -0500
committerRobin Jarry <robin@jarry.cc>2022-07-10 21:15:12 +0200
commitc2f4404fca15be37228545b1893f5fa335168337 (patch)
tree2bfc788a7e38510f1d5057c4b47d2460a548cb44 /worker/maildir
parentccd042889f6d8aa78b70c01395ef69aec48ac48c (diff)
downloadaerc-c2f4404fca15be37228545b1893f5fa335168337.tar.gz
threading: enable filtering of server-side threads
This patch enables the filtering of a threaded view which uses server-built threads. Filtering is done server-side, in order to preserve the use of server-built threads. In adding this feature, the filtering of notmuch folders was brought up to feature parity with the other workers. The filters function the same (ie: they can be stacked). The notmuch filters, however, still use notmuch syntax for the filtering. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'worker/maildir')
-rw-r--r--worker/maildir/worker.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/worker/maildir/worker.go b/worker/maildir/worker.go
index 08628383..cc03ec81 100644
--- a/worker/maildir/worker.go
+++ b/worker/maildir/worker.go
@@ -406,10 +406,25 @@ func (w *Worker) handleOpenDirectory(msg *types.OpenDirectory) error {
func (w *Worker) handleFetchDirectoryContents(
msg *types.FetchDirectoryContents) error {
- uids, err := w.c.UIDs(*w.selected)
- if err != nil {
- w.worker.Logger.Printf("error scanning uids: %v", err)
- return err
+ var (
+ uids []uint32
+ err error
+ )
+ if len(msg.FilterCriteria) > 0 {
+ filter, err := parseSearch(msg.FilterCriteria)
+ if err != nil {
+ return err
+ }
+ uids, err = w.search(filter)
+ if err != nil {
+ return err
+ }
+ } else {
+ uids, err = w.c.UIDs(*w.selected)
+ if err != nil {
+ w.worker.Logger.Printf("error scanning uids: %v", err)
+ return err
+ }
}
sortedUids, err := w.sort(uids, msg.SortCriteria)
if err != nil {