diff options
author | Kevin McCarthy <kevin@8t8.us> | 2018-12-27 16:08:36 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2018-12-27 16:13:30 -0800 |
commit | 75f2445ca5e89ea16b47982fc63304f9464f5d85 (patch) | |
tree | c289d3830c3ce8e04e6669a2f61523626ca97ac5 /copy.c | |
parent | eb444e639540c1cd571829e3eb7640dc7febb5ec (diff) |
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.
Diffstat (limited to 'copy.c')
-rw-r--r-- | copy.c | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -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) |