filters: allow matching any email header
In addition of the common headers (subject, to, from, cc), allow matching arbitrary email headers in filters. E.g.: x-bugzilla-severity,critical=tput setaf 1; cat;tput sgr0 Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
1a75906bcb
commit
fea57839fb
|
@ -502,6 +502,8 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
|
||||||
header = format.FormatAddresses(info.Envelope.To)
|
header = format.FormatAddresses(info.Envelope.To)
|
||||||
case "cc":
|
case "cc":
|
||||||
header = format.FormatAddresses(info.Envelope.Cc)
|
header = format.FormatAddresses(info.Envelope.Cc)
|
||||||
|
default:
|
||||||
|
header = msg.MessageInfo().RFC822Headers.Get(f.Header)
|
||||||
}
|
}
|
||||||
if f.Regex.Match([]byte(header)) {
|
if f.Regex.Match([]byte(header)) {
|
||||||
filter = exec.Command("sh", "-c", f.Command)
|
filter = exec.Command("sh", "-c", f.Command)
|
||||||
|
|
Loading…
Reference in New Issue