Difference between revisions of "From (filter)"

From Mailutils
Jump to navigationJump to search
(Initial revision)
 
m
Line 22: Line 22:
  
 
[[Category:Filters]]
 
[[Category:Filters]]
 +
[[Category:C API]]

Revision as of 12:24, 26 October 2011

The from filter performs a traditional UNIX processing of lines starting with a From followed by a space character.

Decode mode
In decode mode, each "From " at the beginning of a line is replaced by ">From "
Encode mode
In encode mode, the reverse operation is performed: initial greater-then sign (>) is removed from any line starting with ">From ".

The following code creates an instance of read-only from stream which adds the greater-than character to each ">From " at the beginning of a line (the mu_stream_t input is supposed to have been initialized previously):

  int rc;          /* Return code */
  mu_stream_t flt; /* Filter stream */

  rc = mu_filter_stream_create (&flt, input, "from", MU_FILTER_ENCODE, MU_STREAM_READ);

The object describing this filter is declared in mailutils/filter.h as follows:

extern mu_filter_record_t mu_from_filter;