2003-01-02 Matthieu Moy <Matthieu.Moy@imag.fr>
[gnus] / lisp / mm-bodies.el
index 1241326..e672e33 100644 (file)
@@ -1,5 +1,7 @@
 ;;; mm-bodies.el --- Functions for decoding MIME things
-;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+
+;; Copyright (C) 1998, 1999, 2000, 2001
+;;        Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     MORIOKA Tomohiko <morioka@jaist.ac.jp>
@@ -129,6 +131,8 @@ If no encoding was done, nil is returned."
 
 (defun mm-body-encoding (charset &optional encoding)
   "Do Content-Transfer-Encoding and return the encoding of the current buffer."
+  (when (stringp encoding)
+    (setq encoding (intern (downcase encoding))))
   (let ((bits (mm-body-7-or-8))
        (longp (mm-long-lines-p 1000)))
     (require 'message)
@@ -139,6 +143,7 @@ If no encoding was done, nil is returned."
       bits)
      ((and (not mm-use-ultra-safe-encoding)
           (not longp)
+          (not (eq '7bit (cdr (assq charset mm-body-charset-encoding-alist))))
           (or (eq t (cdr message-posting-charset))
               (memq charset (cdr message-posting-charset))
               (eq charset mail-parse-charset)))
@@ -219,6 +224,10 @@ If TYPE is `text/plain' CRLF->LF translation may occur."
            (require 'mm-uu)
            (funcall mm-uu-binhex-decode-function (point-min) (point-max))
            t)
+          ((eq encoding 'x-yenc)
+           (require 'mm-uu)
+           (funcall mm-uu-yenc-decode-function (point-min) (point-max))
+           )
           ((functionp encoding)
            (funcall encoding (point-min) (point-max))
            t)
@@ -228,7 +237,7 @@ If TYPE is `text/plain' CRLF->LF translation may occur."
         (message "Error while decoding: %s" error)
         nil))
     (when (and
-          (memq encoding '(base64 x-uuencode x-uue x-binhex))
+          (memq encoding '(base64 x-uuencode x-uue x-binhex x-yenc))
           (equal type "text/plain"))
       (goto-char (point-min))
       (while (search-forward "\r\n" nil t)