Filter chain

From Mailutils

Jump to: navigation, search

A chain of filters applies each filter in turn. Its syntax is:

 <filter-chain> ::= <filter> | <filter-chain> "+" <filter>
 <filter> ::= <filter-spec> <ARG>* 
 <filter-spec> ::= <WORD> | "~" <WORD>

The <filter-spec> is the name of any existing mailutils filter. The plus character plays the same role as pipe in shell, i.e. redirects output from the filter on its left side to the input of the one on its right side. This character was selected to facilitate the use of filter chains in the command line[1]. The ~ character in front of filter name reverses the default mode. That means that if the default mode is encode the following chain:

 ~crlf + base64

will first convert every occurrence of CR LF characters to a single LF (decode mode of the crlf filter) and then encode the resulting data into BASE64.

Notes

  1. A dubious choice. Traditional pipe character would be more in place here. The same goes for tilde instead of the ! sign. Perhaps this will change in future, but even so I'll have to preserve the backward compatibility.
Personal tools