diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | config/aerc.conf | 3 | ||||
-rw-r--r-- | doc/aerc-config.5.scd | 6 | ||||
-rw-r--r-- | widgets/msgviewer.go | 8 |
4 files changed, 19 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f0ad50d5..805d05f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). `aerc.conf`. - Style search results in the message list with `msglist_result.*` - Preview messages with their attachments before sending with `:preview` +- Filter commands now have `AERC_FORMAT`, `AERC_SUBJECT` and `AERC_FROM` + defined in their environment.` ### Fixed diff --git a/config/aerc.conf b/config/aerc.conf index d024b4fd..557cea8e 100644 --- a/config/aerc.conf +++ b/config/aerc.conf @@ -357,7 +357,10 @@ no-attachment-warning= # The following variables are defined in the filter command environment: # # AERC_MIME_TYPE the part MIME type/subtype +# AERC_FORMAT the part content type format= parameter # AERC_FILENAME the attachment filename (if any) +# AERC_SUBJECT the message Subject header value +# AERC_FROM the message From header value # # The first filter which matches the email's mimetype will be used, so order # them from most to least specific. diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd index 8a8f11c6..13ce7630 100644 --- a/doc/aerc-config.5.scd +++ b/doc/aerc-config.5.scd @@ -591,8 +591,14 @@ The following variables are defined in the filter command environment: _AERC_MIME_TYPE_ the part MIME type/subtype +_AERC_FORMAT_ + the part content type format= parameter (e.g. format=flowed) _AERC_FILENAME_ the attachment filename (if any) +_AERC_SUBJECT_ + the message Subject header value +_AERC_FROM_ + the message From header value Note that said email body is converted into UTF-8 before being passed to filters. diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index d168f456..4006e25b 100644 --- a/widgets/msgviewer.go +++ b/widgets/msgviewer.go @@ -595,6 +595,14 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig, fmt.Sprintf("AERC_MIME_TYPE=%s", mime)) filter.Env = append(filter.Env, fmt.Sprintf("AERC_FILENAME=%s", part.FileName())) + if flowed, ok := part.Params["format"]; ok { + filter.Env = append(filter.Env, + fmt.Sprintf("AERC_FORMAT=%s", flowed)) + } + filter.Env = append(filter.Env, + fmt.Sprintf("AERC_SUBJECT=%s", info.Envelope.Subject)) + filter.Env = append(filter.Env, fmt.Sprintf("AERC_FROM=%s", + format.FormatAddresses(info.Envelope.From))) if pagerin, err = pager.StdinPipe(); err != nil { return nil, err } |