From (filter)

From Mailutils
Jump to navigationJump to search

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

Encode mode
In encode mode, each "From " at the beginning of a line is replaced by ">From "
Decode mode
In decode 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_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;