Changes committed gnus/lisp (ChangeLog mm-encode.el)

"Miles Bader" <[email protected]>
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog mm-encode.el

Merge from gnus--rel--5.10

Patches applied:

 * gnus--rel--5.10  (patch 291)

   - Update from CVS

2008-04-24  Luca Capello  <[email protected]>  (tiny change)

   * lisp/mm-encode.el (mm-safer-encoding): Add optional argument `type'.
   Don't use QP for message/rfc822.
   (mm-content-transfer-encoding): Pass `type' to mm-safer-encoding.

Revision: [email protected]/gnus--devo--0--patch-484


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1836 gnus/lisp/ChangeLog:7.1837
--- ChangeLog:7.1836	Fri Apr 25 20:42:18 2008
+++ ChangeLog	Sat Apr 26 06:31:17 2008
@@ -17,6 +17,12 @@
 	(auth-source-user-or-password-sftp)
 	(auth-source-user-or-password-smtp): Remove server parameter.
 
+2008-04-24  Luca Capello  <[email protected]>  (tiny change)
+
+	* mm-encode.el (mm-safer-encoding): Add optional argument `type'.
+	Don't use QP for message/rfc822.
+	(mm-content-transfer-encoding): Pass `type' to mm-safer-encoding.
+
 2008-04-22  Juri Linkov  <[email protected]>
 
 	* mailcap.el (mailcap-file-default-commands): New function.
Index: mm-encode.el
diff -u gnus/lisp/mm-encode.el:7.13 gnus/lisp/mm-encode.el:7.14
--- mm-encode.el:7.13	Thu Apr 24 06:19:20 2008
+++ mm-encode.el	Sat Apr 26 06:31:17 2008
@@ -96,14 +96,19 @@
       "application/octet-stream"
     (mailcap-extension-to-mime (match-string 0 file))))
 
-(defun mm-safer-encoding (encoding)
+(defun mm-safer-encoding (encoding &optional type)
   "Return an encoding similar to ENCODING but safer than it."
   (cond
    ((eq encoding '7bit) '7bit) ;; 7bit is considered safe.
-   ((memq encoding '(8bit quoted-printable)) 'quoted-printable)
+   ((memq encoding '(8bit quoted-printable))
+    ;; According to RFC2046, 5.2.1, RFC822 Subtype, "quoted-printable" is not
+    ;; a valid encoding for message/rfc822:
+    ;; No encoding other than "7bit", "8bit", or "binary" is permitted for the
+    ;; body of a "message/rfc822" entity.
+    (if (string= type "message/rfc822") '8bit 'quoted-printable))
    ;; The remaining encodings are binary and base64 (and perhaps some
    ;; non-standard ones), which are both turned into base64.
-   (t 'base64)))
+   (t (if (string= type "message/rfc822") 'binary 'base64))))
 
 (defun mm-encode-content-transfer-encoding (encoding &optional type)
   "Encode the current buffer with ENCODING for MIME type TYPE.
@@ -178,7 +183,7 @@
 			    (mm-qp-or-base64)
 			  (cadr (car rules)))))
 		   (if mm-use-ultra-safe-encoding
-		       (mm-safer-encoding encoding)
+		       (mm-safer-encoding encoding type)
 		     encoding))))
 	(pop rules)))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.