diff options
Diffstat (limited to 'worker')
-rw-r--r-- | worker/imap/search.go | 8 | ||||
-rw-r--r-- | worker/lib/search.go | 8 | ||||
-rw-r--r-- | worker/maildir/search.go | 8 |
3 files changed, 21 insertions, 3 deletions
diff --git a/worker/imap/search.go b/worker/imap/search.go index ba7b9174..77a18990 100644 --- a/worker/imap/search.go +++ b/worker/imap/search.go @@ -38,7 +38,13 @@ func parseSearch(args []string) (*imap.SearchCriteria, error) { criteria.WithoutFlags = append(criteria.WithoutFlags, f) } case 'H': - // TODO + if strings.Contains(opt.Value, ": ") { + HeaderValue := strings.SplitN(opt.Value, ": ", 2) + criteria.Header.Add(HeaderValue[0], HeaderValue[1]) + } else { + log.Errorf("Header is not given properly, must be given in format `Header: Value`") + continue + } case 'f': criteria.Header.Add("From", opt.Value) case 't': diff --git a/worker/lib/search.go b/worker/lib/search.go index 0a124e3c..11fc1b11 100644 --- a/worker/lib/search.go +++ b/worker/lib/search.go @@ -44,7 +44,13 @@ func GetSearchCriteria(args []string) (*searchCriteria, error) { case 'X': criteria.WithoutFlags |= getParsedFlag(opt.Value) case 'H': - // TODO + if strings.Contains(opt.Value, ": ") { + HeaderValue := strings.SplitN(opt.Value, ": ", 2) + criteria.Header.Add(HeaderValue[0], HeaderValue[1]) + } else { + log.Errorf("Header is not given properly, must be given in format `Header: Value`") + continue + } case 'f': criteria.Header.Add("From", opt.Value) case 't': diff --git a/worker/maildir/search.go b/worker/maildir/search.go index c667d48f..49cb1c6e 100644 --- a/worker/maildir/search.go +++ b/worker/maildir/search.go @@ -50,7 +50,13 @@ func parseSearch(args []string) (*searchCriteria, error) { case 'X': criteria.WithoutFlags = append(criteria.WithoutFlags, getParsedFlag(opt.Value)) case 'H': - // TODO + if strings.Contains(opt.Value, ": ") { + HeaderValue := strings.SplitN(opt.Value, ": ", 2) + criteria.Header.Add(HeaderValue[0], HeaderValue[1]) + } else { + log.Errorf("Header is not given properly, must be given in format `Header: Value`") + continue + } case 'f': criteria.Header.Add("From", opt.Value) case 't': |