]> granicus.if.org Git - mutt/commitdiff
Update mime fields when piping a message with $pipe_decode set.
authorKevin McCarthy <kevin@8t8.us>
Sun, 13 Oct 2019 08:25:54 +0000 (16:25 +0800)
committerKevin McCarthy <kevin@8t8.us>
Tue, 15 Oct 2019 01:15:38 +0000 (09:15 +0800)
Programs that process the message may get confused if the original
mime fields are in the output.  Add the CH_MIME flag to strip mime
headers and CH_TXTPLAIN to add decoded text mime headers in their
place, just as <decode-copy> does.

However, make sure not to add the flags when printing, as printers
highly likely won't care and users probably don't want to see those
headers in their printout.

commands.c

index b88335d1fa8ad7b925b065ab1e04a01c3042f3f8..9a27614fca8bf3c0545fc961c8633c6f07fe651e 100644 (file)
@@ -440,14 +440,21 @@ static void pipe_set_flags (int decode, int print, int *cmflags, int *chflags)
 {
   if (decode)
   {
-    *cmflags |= MUTT_CM_DECODE | MUTT_CM_CHARCONV;
     *chflags |= CH_DECODE | CH_REORDER;
+    *cmflags |= MUTT_CM_DECODE | MUTT_CM_CHARCONV;
 
     if (option (OPTWEED))
     {
       *chflags |= CH_WEED;
       *cmflags |= MUTT_CM_WEED;
     }
+
+    /* Just as with copy-decode, we need to update the
+     * mime fields to avoid confusing programs that may
+     * process the email.  However, we don't want to force
+     * those fields to appear in printouts. */
+    if (!print)
+      *chflags |= CH_MIME | CH_TXTPLAIN;
   }
 
   if (print)