From edf9e64280589369051613a06aad367dfde3b8b7 Mon Sep 17 00:00:00 2001
From: Chris Hanson <org/chris-hanson/cph>
Date: Wed, 14 Jun 2000 20:16:37 +0000
Subject: [PATCH] Always inline top-level MIME text parts, even if the subtype
 isn't "plain".  Also, define new variable imail-known-mime-charsets, to allow
 the user to add other character sets that may be inlined.

---
 v7/src/imail/imail-top.scm | 28 +++++++++++++++++++---------
 v7/src/imail/imail.pkg     |  3 ++-
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/v7/src/imail/imail-top.scm b/v7/src/imail/imail-top.scm
index acfd36d9b..4c648e96b 100644
--- a/v7/src/imail/imail-top.scm
+++ b/v7/src/imail/imail-top.scm
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-top.scm,v 1.152 2000/06/14 02:24:50 cph Exp $
+;;; $Id: imail-top.scm,v 1.153 2000/06/14 20:16:21 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
@@ -149,6 +149,13 @@ Otherwise, only the header fields normally shown by IMAIL are sent."
 Otherwise, they are inserted into the message body."
   #t
   boolean?)
+
+(define-variable imail-known-mime-charsets
+  "List of regular expressions matching character-set names.
+Text messages using these character sets are displayed inline;
+ when other character sets are used, the text is treated as an attachment."
+  (list "us-ascii" "iso-8859-[0-9]+" "windows-[0-9]+")
+  list-of-strings?)
 
 (define-command imail
   "Read and edit incoming mail.
@@ -459,6 +466,7 @@ variable's documentation (using \\[describe-variable]) for details:
     imail-forward-using-mime
     imail-ignored-headers
     imail-kept-headers
+    imail-known-mime-charsets
     imail-message-filter
     imail-mode-hook
     imail-pass-phrase-retention-time
@@ -1109,15 +1117,17 @@ With prefix argument N moves backward N messages with these flags."
 		;; This is illegal, but Netscape does it.
 		encoding
 		(mime-body-one-part-encoding body)))))
-    (if (and (eq? (mime-body-subtype body) 'PLAIN)
+    (if (and (or (not enclosure)
+		 (eq? (mime-body-subtype body) 'PLAIN))
 	     (known-mime-encoding? encoding)
-	     (re-string-match (string-append "\\`"
-					     (regexp-group "us-ascii"
-							   "iso-8859-[0-9]+"
-							   "windows-[0-9]+")
-					     "\\'")
-			      (mime-body-parameter body 'CHARSET "us-ascii")
-			      #t))
+	     (re-string-match
+	      (string-append "\\`"
+			     (apply regexp-group
+				    (ref-variable imail-known-mime-charsets
+						  mark))
+			     "\\'")
+	      (mime-body-parameter body 'CHARSET "us-ascii")
+	      #t))
 	(let ((text
 	       (message-mime-body-part
 		message
diff --git a/v7/src/imail/imail.pkg b/v7/src/imail/imail.pkg
index 144025cb4..8d73bc338 100644
--- a/v7/src/imail/imail.pkg
+++ b/v7/src/imail/imail.pkg
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail.pkg,v 1.56 2000/06/14 02:24:54 cph Exp $
+;;; $Id: imail.pkg,v 1.57 2000/06/14 20:16:37 cph Exp $
 ;;;
 ;;; Copyright (c) 2000 Massachusetts Institute of Technology
 ;;;
@@ -258,6 +258,7 @@
 	  edwin-variable$imail-forward-using-mime
 	  edwin-variable$imail-ignored-headers
 	  edwin-variable$imail-kept-headers
+	  edwin-variable$imail-known-mime-charsets
 	  edwin-variable$imail-message-filter
 	  edwin-variable$imail-mode-hook
 	  edwin-variable$imail-pass-phrase-retention-time
-- 
2.25.1