From: Karel Zak Date: Mon, 14 Oct 2013 18:34:57 +0000 (-0700) Subject: add CH_VIRTUAL to allow to specify when use virtual headers X-Git-Tag: neomutt-20160404~13^2~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=326f7817d68abef65c511154e85c15587942cd16;p=neomutt add CH_VIRTUAL to allow to specify when use virtual headers 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 --- diff --git a/commands.c b/commands.c index 2a0cdc9c7..027df56b1 100644 --- a/commands.c +++ b/commands.c @@ -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 4d325aa4e..cf490ffeb 100644 --- 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 5f12a3c1e..abeec14aa 100644 --- 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 *);