From (filter)

From Mailutils

(Difference between revisions)
Jump to: navigation, search
m
 
Line 12: Line 12:
   mu_stream_t flt; /* Filter stream */
   mu_stream_t flt; /* Filter stream */
-
   rc = mu_filter_stream_create (&flt, input, "from", MU_FILTER_ENCODE, MU_STREAM_READ);
+
   rc = mu_filter_create (&flt, input, "from", MU_FILTER_ENCODE, MU_STREAM_READ);
</source>  
</source>  

Latest revision as of 19:08, 5 September 2015

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;
Personal tools