From: Thomas Roessler Date: Fri, 19 Feb 1999 07:36:40 +0000 (+0000) Subject: Add $encode_from: This option causes mutt to trigger X-Git-Tag: mutt-0-96-1-rel~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d859599ac4c0ec012a68877647154f5e340a4f0;p=mutt Add $encode_from: This option causes mutt to trigger quoted-printable encoding for any non-multipart attachments which have ^From at the beginning of a line. Note that we don't trigger on ^From_ since either procmail or sendmail is >-escaping on ^From, and note that this won't help against sites where sendmail has the '9' flag set on the local mailer, as these sites will inevitably transform to 8bit (sic!). --- diff --git a/init.h b/init.h index e4c60dca..40101268 100644 --- a/init.h +++ b/init.h @@ -103,6 +103,7 @@ struct option_t MuttVars[] = { { "edit_headers", DT_BOOL, R_NONE, OPTEDITHDRS, 0 }, { "edit_hdrs", DT_SYN, R_NONE, UL "edit_headers", 0 }, { "editor", DT_PATH, R_NONE, UL &Editor, 0 }, + { "encode_from", DT_BOOL, R_NONE, OPTENCODEFROM, 0 }, { "escape", DT_STR, R_NONE, UL &EscChar, UL "~" }, { "fast_reply", DT_BOOL, R_NONE, OPTFASTREPLY, 0 }, { "fcc_attach", DT_BOOL, R_NONE, OPTFCCATTACH, 1 }, diff --git a/mutt.h b/mutt.h index 6e0e220e..200102d7 100644 --- a/mutt.h +++ b/mutt.h @@ -293,6 +293,7 @@ enum OPTCONFIRMAPPEND, OPTCONFIRMCREATE, OPTEDITHDRS, + OPTENCODEFROM, OPTFASTREPLY, OPTFCCATTACH, OPTFOLLOWUPTO, diff --git a/sendlib.c b/sendlib.c index f9602b85..892981cc 100644 --- a/sendlib.c +++ b/sendlib.c @@ -584,10 +584,9 @@ static CONTENT *mutt_get_content_info (const char *fname, BODY *b) { if (linelen == 2 && ch != 'r') from = 0; else if (linelen == 3 && ch != 'o') from = 0; - else if (linelen == 4 && ch != 'm') from = 0; - else if (linelen == 5) + else if (linelen == 4) { - if (ch == ' ') info->from = 1; + if (ch == 'm') info->from = 1; from = 0; } } @@ -843,7 +842,7 @@ static void mutt_set_encoding (BODY *b, CONTENT *info) { if (b->type == TYPETEXT) { - if (info->lobin) + if (info->lobin || (info->from && option (OPTENCODEFROM))) b->encoding = ENCQUOTEDPRINTABLE; else if (info->hibin) b->encoding = option (OPTALLOW8BIT) ? ENC8BIT : ENCQUOTEDPRINTABLE; @@ -862,7 +861,8 @@ static void mutt_set_encoding (BODY *b, CONTENT *info) else b->encoding = ENC7BIT; } - else if (info->lobin || info->hibin || info->binary || info->linemax > 990) + else if (info->lobin || info->hibin || info->binary || info->linemax > 990 + || (option (OPTENCODEFROM) && info->from)) { /* Determine which encoding is smaller */ if (1.33 * (float)(info->lobin+info->hibin+info->ascii) < 3.0 * (float) (info->lobin + info->hibin) + (float)info->ascii)