]> granicus.if.org Git - neomutt/commitdiff
add CH_VIRTUAL to allow to specify when use virtual headers
authorKarel Zak <kzak@redhat.com>
Mon, 14 Oct 2013 18:34:57 +0000 (11:34 -0700)
committerRichard Russon <rich@flatcap.org>
Mon, 4 Apr 2016 15:30:07 +0000 (16:30 +0100)
For example don't add "Tags:" header to the message when copy the
message to another folder. The virtual headers make sense only when
we display the message to user.

Signed-off-by: Karel Zak <kzak@redhat.com>
commands.c
copy.c
copy.h

index 2a0cdc9c70fc947601afaadb52b7a0abeb98fa92..027df56b19d7549329aafe0422ef63ca0cb7781f 100644 (file)
@@ -146,7 +146,9 @@ int mutt_display_message (HEADER *cur)
   }
 
   res = mutt_copy_message (fpout, Context, cur, cmflags,
-               (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM | CH_DISPLAY);
+               (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0)
+               | CH_DECODE | CH_FROM | CH_DISPLAY | CH_VIRTUAL);
+
   if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res < 0)
   {
     mutt_error (_("Could not copy message"));
diff --git a/copy.c b/copy.c
index 4d325aa4e348c80bb363838af7d501de661124f5..cf490ffebe860fd25dadf5a41438be561a96cfa4 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -338,6 +338,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags,
        CH_NOQFROM      ignore ">From " line
        CH_UPDATE_IRT   update the In-Reply-To: header
        CH_UPDATE_REFS  update the References: header
+       CH_VIRTUAL      write virtual header lines too
 
    prefix
        string to use if CH_PREFIX is set
@@ -418,7 +419,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix)
   }
 
 #ifdef USE_NOTMUCH
-  if (nm_header_get_tags(h))
+  if ((flags & CH_VIRTUAL) && nm_header_get_tags(h))
   {
     fputs ("Tags: ", out);
     fputs (nm_header_get_tags(h), out);
diff --git a/copy.h b/copy.h
index 5f12a3c1e3b9ce1eb39cc34f8b4ee228922367a8..abeec14aa92b36c9e3e73e35800e818644e00aaa 100644 (file)
--- a/copy.h
+++ b/copy.h
@@ -53,6 +53,7 @@
 #define CH_UPDATE_IRT     (1<<16) /* update In-Reply-To: */
 #define CH_UPDATE_REFS    (1<<17) /* update References: */
 #define CH_DISPLAY        (1<<18) /* display result to user */
+#define CH_VIRTUAL       (1<<19) /* write virtual header lines too */
 
 
 int mutt_copy_hdr (FILE *, FILE *, LOFF_T, LOFF_T, int, const char *);