about summary refs log tree commit diff stats
path: root/commands/account/search.go
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2019-08-28 06:39:07 +0200
committerDrew DeVault <sir@cmpwn.com>2019-08-29 08:44:10 +0900
commit94b9d557dee0fd13853b1883cc2730c5cbdbcd3f (patch)
tree8a0040b60df9ab4fa3d7f9d137d126a04fd5943b /commands/account/search.go
parentac99d9ed62644cf0259bdd79481b28c3fbcef650 (diff)
downloadaerc-94b9d557dee0fd13853b1883cc2730c5cbdbcd3f.tar.gz
extract search criteria parsing into the backends
Diffstat (limited to 'commands/account/search.go')
-rw-r--r--commands/account/search.go27
1 files changed, 1 insertions, 26 deletions
diff --git a/commands/account/search.go b/commands/account/search.go
index da7ab03..ca51917 100644
--- a/commands/account/search.go
+++ b/commands/account/search.go
@@ -3,9 +3,6 @@ package account
 import (
 	"errors"
 
-	"git.sr.ht/~sircmpwn/getopt"
-	"github.com/emersion/go-imap"
-
 	"git.sr.ht/~sircmpwn/aerc/widgets"
 )
 
@@ -24,28 +21,6 @@ func (_ SearchFilter) Complete(aerc *widgets.Aerc, args []string) []string {
 }
 
 func (_ SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
-	var (
-		criteria *imap.SearchCriteria = imap.NewSearchCriteria()
-	)
-
-	opts, optind, err := getopt.Getopts(args, "ruH:")
-	if err != nil {
-		return err
-	}
-	for _, opt := range opts {
-		switch opt.Option {
-		case 'r':
-			criteria.WithFlags = append(criteria.WithFlags, imap.SeenFlag)
-		case 'u':
-			criteria.WithoutFlags = append(criteria.WithoutFlags, imap.SeenFlag)
-		case 'H':
-			// TODO
-		}
-	}
-	for _, arg := range args[optind:] {
-		criteria.Header.Add("Subject", arg)
-	}
-
 	acct := aerc.SelectedAccount()
 	if acct == nil {
 		return errors.New("No account selected")
@@ -73,6 +48,6 @@ func (_ SearchFilter) Execute(aerc *widgets.Aerc, args []string) error {
 			acct.Messages().Scroll()
 		}
 	}
-	store.Search(criteria, cb)
+	store.Search(args, cb)
 	return nil
 }