]> granicus.if.org Git - neomutt/commitdiff
tidy calls to mutt_copy_hdr()
authorRichard Russon <rich@flatcap.org>
Fri, 12 Apr 2019 14:03:20 +0000 (15:03 +0100)
committerRichard Russon <rich@flatcap.org>
Sun, 14 Apr 2019 15:44:26 +0000 (16:44 +0100)
handler.c

index 3e954a46ae3f2ed014e71faa29a91cfc4aadf620..9f70b0fe611542467964b3da3363d2bc4099ff12 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -713,14 +713,15 @@ static int message_handler(struct Body *a, struct State *s)
 
   if (b->parts)
   {
-    mutt_copy_hdr(s->fp_in, s->fp_out, off_start, b->parts->offset,
-                  (((s->flags & MUTT_WEED) ||
-                    ((s->flags & (MUTT_DISPLAY | MUTT_PRINTING)) && C_Weed)) ?
-                       (CH_WEED | CH_REORDER) :
-                       CH_NO_FLAGS) |
-                      (s->prefix ? CH_PREFIX : CH_NO_FLAGS) | CH_DECODE | CH_FROM |
-                      ((s->flags & MUTT_DISPLAY) ? CH_DISPLAY : CH_NO_FLAGS),
-                  s->prefix);
+    CopyHeaderFlags chflags = CH_DECODE | CH_FROM;
+    if ((s->flags & MUTT_WEED) || ((s->flags & (MUTT_DISPLAY | MUTT_PRINTING)) && C_Weed))
+      chflags |= CH_WEED | CH_REORDER;
+    if (s->prefix)
+      chflags |= CH_PREFIX;
+    if (s->flags & MUTT_DISPLAY)
+      chflags |= CH_DISPLAY;
+
+    mutt_copy_hdr(s->fp_in, s->fp_out, off_start, b->parts->offset, chflags, s->prefix);
 
     if (s->prefix)
       state_puts(s->prefix, s);
@@ -858,8 +859,11 @@ static int external_body_handler(struct Body *b, struct State *s)
         state_printf(s, _("[-- name: %s --]\n"), b->parts->filename);
       }
 
-      mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset,
-                    (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE, NULL);
+      CopyHeaderFlags chflags = CH_DECODE;
+      if (C_Weed)
+        chflags |= CH_WEED | CH_REORDER;
+
+      mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset, chflags, NULL);
     }
   }
   else if (expiration && (expire < time(NULL)))
@@ -873,9 +877,11 @@ static int external_body_handler(struct Body *b, struct State *s)
                TYPE(b->parts), b->parts->subtype);
       state_attach_puts(strbuf, s);
 
-      mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset,
-                    (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE | CH_DISPLAY,
-                    NULL);
+      CopyHeaderFlags chflags = CH_DECODE | CH_DISPLAY;
+      if (C_Weed)
+        chflags |= CH_WEED | CH_REORDER;
+
+      mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset, chflags, NULL);
     }
   }
   else
@@ -891,9 +897,11 @@ static int external_body_handler(struct Body *b, struct State *s)
                TYPE(b->parts), b->parts->subtype, access_type);
       state_attach_puts(strbuf, s);
 
-      mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset,
-                    (C_Weed ? (CH_WEED | CH_REORDER) : CH_NO_FLAGS) | CH_DECODE | CH_DISPLAY,
-                    NULL);
+      CopyHeaderFlags chflags = CH_DECODE | CH_DISPLAY;
+      if (C_Weed)
+        chflags |= CH_WEED | CH_REORDER;
+
+      mutt_copy_hdr(s->fp_in, s->fp_out, ftello(s->fp_in), b->parts->offset, chflags, NULL);
     }
   }