if (flags & (CH_DECODE|CH_PREFIX))
{
if (mutt_write_one_header (out, 0, headers[x],
- flags & CH_PREFIX ? prefix : 0, mutt_term_width (Wrap)) == -1)
+ flags & CH_PREFIX ? prefix : 0, mutt_term_width (Wrap), flags) == -1)
{
error = TRUE;
break;
fseeko (fp, cur->offset, 0);
if (mutt_copy_bytes (fp, fpout, cur->length) == -1)
{
- fclose (fp);
+ safe_fclose (&fp);
mutt_free_body (&cur);
return (-1);
}
mutt_free_body (&cur);
- fclose (fp);
+ safe_fclose (&fp);
}
else
{
static int address_header_decode (char **h)
{
char *s = *h;
- int l;
+ int l, rp = 0;
ADDRESS *a = NULL;
+ ADDRESS *cur = NULL;
switch (tolower ((unsigned char) *s))
{
if (ascii_strncasecmp (s, "return-path:", 12) == 0)
{
l = 12;
+ rp = 1;
break;
}
else if (ascii_strncasecmp (s, "reply-to:", 9) == 0)
mutt_addrlist_to_local (a);
rfc2047_decode_adrlist (a);
-
- *h = safe_calloc (1, l + 2);
-
- strfcpy (*h, s, l + 1);
-
- format_address_header (h, a);
+ for (cur = a; cur; cur = cur->next)
+ if (cur->personal)
+ rfc822_dequote_comment (cur->personal);
+
+ /* angle brackets for return path are mandated by RfC5322,
+ * so leave Return-Path as-is */
+ if (rp)
+ *h = safe_strdup (s);
+ else
+ {
+ *h = safe_calloc (1, l + 2);
+ strfcpy (*h, s, l + 1);
+ format_address_header (h, a);
+ }
rfc822_free_address (&a);
-
+
FREE (&s);
return 1;
}