(eword-decode-ignored-field-list): New variable.
authormorioka <morioka>
Mon, 16 Feb 1998 20:40:19 +0000 (20:40 +0000)
committermorioka <morioka>
Mon, 16 Feb 1998 20:40:19 +0000 (20:40 +0000)
(eword-decode-structured-field-list): New variable.
(eword-decode-header): Refer them.

eword-decode.el

index fdba1c8..0ad99ae 100644 (file)
@@ -10,7 +10,7 @@
 ;;     Renamed: 1993/06/03 to tiny-mime.el
 ;;     Renamed: 1995/10/03 from tiny-mime.el (split off encoder)
 ;;     Renamed: 1997/02/22 from tm-ew-d.el
-;; Version: $Revision: 1.2 $
+;; Version: $Revision: 1.3 $
 ;; Keywords: encoded-word, MIME, multilingual, header, mail, news
 
 ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
 (require 'mel)
 (require 'mime-def)
 
+(defgroup eword-decode nil
+  "Encoded-word decoding"
+  :group 'mime)
+
 
 ;;; @ version
 ;;;
 
 (defconst eword-decode-RCS-ID
-  "$Id: eword-decode.el,v 1.2 1998-02-16 20:21:52 morioka Exp $")
+  "$Id: eword-decode.el,v 1.3 1998-02-16 20:40:19 morioka Exp $")
 (defconst eword-decode-version (get-version-string eword-decode-RCS-ID))
 
 
@@ -180,6 +184,23 @@ such as a version of Net$cape)."
 ;;; @ for message header
 ;;;
 
+(defcustom eword-decode-ignored-field-list
+  '(newsgroups message-id path)
+  "*List of field-names to be ignored when decoding.
+Each field name must be symbol."
+  :group 'eword-decode
+  :type '(repeat symbol))
+
+(defcustom eword-decode-structured-field-list
+  '(reply-to resent-reply-to from resent-from sender resent-sender
+            to resent-to cc resent-cc bcc resent-bcc dcc
+            mime-version content-type content-transfer-encoding
+            content-disposition)
+  "*List of field-names to decode as structured field.
+Each field name must be symbol."
+  :group 'eword-decode
+  :type '(repeat symbol))
+
 (defun eword-decode-header (&optional code-conversion separator)
   "Decode MIME encoded-words in header fields.
 If CODE-CONVERSION is nil, it decodes only encoded-words.  If it is
@@ -205,21 +226,18 @@ If SEPARATOR is not nil, it is used as header separator."
                      field-name (intern
                                  (downcase (buffer-substring beg (1- p))))
                      end (std11-field-end))
-               (cond ((memq field-name '(newsgroups message-id path))
+               (cond ((memq field-name eword-decode-ignored-field-list)
+                      ;; Don't decode
                       )
-                     ((memq field-name '(reply-to
-                                         from sender
-                                         resent-reply-to resent-from
-                                         resent-sender to resent-to
-                                         cc resent-cc
-                                         bcc resent-bcc dcc
-                                         mime-version content-type))
+                     ((memq field-name eword-decode-structured-field-list)
+                      ;; Decode as structured field
                       (let ((body (buffer-substring p end))
                             (default-mime-charset default-charset))
                         (delete-region p end)
                         (insert (eword-decode-structured-field-body body))
                         ))
                      (t
+                      ;; Decode as unstructured field
                       (save-restriction
                         (narrow-to-region p end)
                         (decode-mime-charset-region p end default-charset)