]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/mm-encode.el
Add Bug#4698 to 2009-11-29 change. By Reiner Steib.
[gnu-emacs] / lisp / gnus / mm-encode.el
index 39b83ff1c3c172dd81e415a86ea5743c357a3026..d4f9ea76006943973c5986968f8705dc5ed229ea 100644 (file)
@@ -60,6 +60,24 @@ to specify encoding of non-ASCII MIME parts."
                               (const base64))))
   :group 'mime)
 
+(defcustom mm-sign-option nil
+  "Option how to create signed parts.
+nil, use the default keys without asking;
+`guided', let you select signing keys from the menu."
+  :version "23.1"
+  :type '(choice (item guided)
+                (item :tag "default" nil))
+  :group 'mime-security)
+
+(defcustom mm-encrypt-option nil
+  "Option how to create encrypted parts.
+nil, use the default keys without asking;
+`guided', let you select recipients' keys from the menu."
+  :version "23.1"
+  :type '(choice (item guided)
+                (item :tag "default" nil))
+  :group 'mime-security)
+
 (defvar mm-use-ultra-safe-encoding nil
   "If non-nil, use encodings aimed at Procrustean bed survival.
 
@@ -137,22 +155,19 @@ ENCODING can be: nil (do nothing); one of `quoted-printable', `base64';
    (t
     (error "Unknown encoding %s" encoding))))
 
-(defun mm-encode-buffer (type)
-  "Encode the buffer which contains data of MIME type TYPE.
+(defun mm-encode-buffer (type &optional encoding)
+  "Encode the buffer which contains data of MIME type TYPE by ENCODING.
 TYPE is a string or a list of the components.
+The optional ENCODING overrides the encoding determined according to
+TYPE and `mm-content-transfer-encoding-defaults'.
 The encoding used is returned."
-  (let* ((mime-type (if (stringp type) type (car type)))
-        (encoding
-         (or (and (listp type)
-                  (cadr (assq 'encoding type)))
-             (mm-content-transfer-encoding mime-type)))
-        (bits (mm-body-7-or-8)))
-    ;; We force buffers that are 7bit to be unencoded, no matter
-    ;; what the preferred encoding is.
-    ;; Only if the buffers don't contain lone lines.
-    (when (and (eq bits '7bit) (not (mm-long-lines-p 76)))
-      (setq encoding bits))
-    (mm-encode-content-transfer-encoding encoding mime-type)
+  (let ((mime-type (if (stringp type) type (car type))))
+    (mm-encode-content-transfer-encoding
+     (or encoding
+        (setq encoding (or (and (listp type)
+                                (cadr (assq 'encoding type)))
+                           (mm-content-transfer-encoding mime-type))))
+     mime-type)
     encoding))
 
 (defun mm-insert-headers (type encoding &optional file)