From 94b9d557dee0fd13853b1883cc2730c5cbdbcd3f Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Wed, 28 Aug 2019 06:39:07 +0200 Subject: extract search criteria parsing into the backends --- commands/account/search.go | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'commands/account') 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 } -- cgit v1.2.3