]> granicus.if.org Git - mutt/commitdiff
Add $encode_from: This option causes mutt to trigger
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 19 Feb 1999 07:36:40 +0000 (07:36 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 19 Feb 1999 07:36:40 +0000 (07:36 +0000)
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!).

init.h
mutt.h
sendlib.c

diff --git a/init.h b/init.h
index e4c60dca77bc73e6befe1027b35b271188ce9caf..401012688704cfa41c1da4528665fcf03c85af90 100644 (file)
--- 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 6e0e220e5f7b231c6a35a21fd9c283bdf922d65c..200102d72ae3d1d092de4a482b2e0961167f7e79 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -293,6 +293,7 @@ enum
   OPTCONFIRMAPPEND,
   OPTCONFIRMCREATE,
   OPTEDITHDRS,
+  OPTENCODEFROM,
   OPTFASTREPLY,
   OPTFCCATTACH,
   OPTFOLLOWUPTO,
index f9602b85bf63238c14769d138efbe53897aa2f8d..892981cca8455d99e0d622bc4e9ab5d4966528e1 100644 (file)
--- 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)