From: Kevin McCarthy Date: Fri, 28 Dec 2018 00:08:36 +0000 (-0800) Subject: Rfc2047 encode and fold X-Label when writing updates. X-Git-Tag: mutt-1-11-2-rel~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=75f2445ca5e89ea16b47982fc63304f9464f5d85;p=mutt Rfc2047 encode and fold X-Label when writing updates. Also, add a missing "skip" in mutt_copy_hdr() for the non-simple case. These fixes were backported from the kevin/mutt_protected_header branch. --- diff --git a/copy.c b/copy.c index af6e2691..f072869b 100644 --- a/copy.c +++ b/copy.c @@ -108,7 +108,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, if ((flags & CH_UPDATE_IRT) && ascii_strncasecmp ("In-Reply-To:", buf, 12) == 0) continue; - if (flags & CH_UPDATE_LABEL && + if ((flags & CH_UPDATE_LABEL) && ascii_strncasecmp ("X-Label:", buf, 8) == 0) continue; @@ -218,6 +218,9 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, if ((flags & CH_UPDATE_IRT) && ascii_strncasecmp ("In-Reply-To:", buf, 12) == 0) continue; + if ((flags & CH_UPDATE_LABEL) && + ascii_strncasecmp ("X-Label:", buf, 8) == 0) + continue; /* Find x -- the array entry where this header is to be saved */ if (flags & CH_REORDER) @@ -418,13 +421,17 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix) fprintf (out, "Lines: %d\n", h->lines); } - if (flags & CH_UPDATE_LABEL) + if ((flags & CH_UPDATE_LABEL) && h->env->x_label) { - h->xlabel_changed = 0; - if (h->env->x_label != NULL) - if (fprintf(out, "X-Label: %s\n", h->env->x_label) != - 10 + strlen(h->env->x_label)) - return -1; + if (!(flags & CH_DECODE)) + rfc2047_encode_string (&h->env->x_label); + if (mutt_write_one_header (out, "X-Label", h->env->x_label, + flags & CH_PREFIX ? prefix : 0, + mutt_window_wrap_cols (MuttIndexWindow, Wrap), + flags) == -1) + return -1; + if (!(flags & CH_DECODE)) + rfc2047_decode (&h->env->x_label); } if ((flags & CH_NONEWLINE) == 0)