* elmo-util.el (elmo-mime-string): Eliminate needless binding;
authorteranisi <teranisi>
Thu, 9 May 2002 14:22:35 +0000 (14:22 +0000)
committerteranisi <teranisi>
Thu, 9 May 2002 14:22:35 +0000 (14:22 +0000)
Use eword-decode-and-unfold-unstructured-field-body.

* elmo-msgdb.el (elmo-msgdb-make-entity): New function.
(elmo-msgdb-create-overview-from-buffer): Use document charset if
exists to decode raw subject string.
(toplevel): Require 'mime.

elmo/ChangeLog
elmo/elmo-msgdb.el
elmo/elmo-util.el

index 8d39b85..d42fdd1 100644 (file)
@@ -1,5 +1,13 @@
 2002-05-09  Yuuichi Teranishi  <teranisi@gohome.org>
 
+       * elmo-util.el (elmo-mime-string): Eliminate needless binding;
+       Use eword-decode-and-unfold-unstructured-field-body.
+
+       * elmo-msgdb.el (elmo-msgdb-make-entity): New function.
+       (elmo-msgdb-create-overview-from-buffer): Use document charset if
+       exists to decode raw subject string.
+       (toplevel): Require 'mime.
+
        * elmo-version.el (elmo-version): Up to 2.9.12.
 
 2002-05-02  Yuuichi Teranishi  <teranisi@gohome.org>
index 18c28a7..3840908 100644 (file)
@@ -36,6 +36,7 @@
 (require 'elmo-util)
 (require 'emu)
 (require 'std11)
+(require 'mime)
 
 ;;; MSGDB interface.
 (defun elmo-load-msgdb (path)
@@ -159,6 +160,19 @@ content of MSGDB is changed."
     (message "Sorting...done")
     (list overview (nth 1 msgdb)(nth 2 msgdb))))
 
+(defun elmo-msgdb-make-entity (&rest args)
+  "Make an msgdb entity."
+  (cons (plist-get args :message-id)
+       (vector (plist-get args :number)
+               (plist-get args :references)
+               (plist-get args :from)
+               (plist-get args :subject)
+               (plist-get args :date)
+               (plist-get args :to)
+               (plist-get args :cc)
+               (plist-get args :size)
+               (plist-get args :extra))))
+
 ;;;
 (defsubst elmo-msgdb-append-element (list element)
   (if list
@@ -767,9 +781,13 @@ Header region is supposed to be narrowed."
   (save-excursion
     (let ((extras elmo-msgdb-extra-fields)
          message-id references from subject to cc date
-         extra field-body)
+         default-mime-charset
+         extra field-body charset)
       (elmo-set-buffer-multibyte default-enable-multibyte-characters)
-      (setq message-id (elmo-msgdb-get-message-id-from-buffer))
+      (setq message-id (elmo-msgdb-get-message-id-from-buffer)
+           charset (intern-soft (cdr (assoc "charset"
+                                            (mime-read-Content-Type)))))
+      (if charset (setq default-mime-charset charset))
       (setq references
            (or (elmo-msgdb-get-last-message-id
                 (elmo-field-body "in-reply-to"))
@@ -779,8 +797,8 @@ Header region is supposed to be narrowed."
                                    ?\"
                                    (or
                                     (elmo-field-body "from")
-                                    elmo-no-from))))
-      (setq subject (elmo-mime-string (or (elmo-field-body "subject")
+                                    elmo-no-from)))
+           subject (elmo-mime-string (or (elmo-field-body "subject")
                                          elmo-no-subject)))
       (setq date (or (elmo-field-body "date") time))
       (setq to   (mapconcat 'identity (elmo-multiple-field-body "to") ","))
index 34dddcd..6ecf46e 100644 (file)
@@ -985,15 +985,16 @@ Emacs 19.28 or earlier does not have `unintern'."
 
 (defsubst elmo-mime-string (string)
   "Normalize MIME encoded STRING."
-    (and string
-        (let (str)
-          (elmo-set-work-buf
-           (elmo-set-buffer-multibyte default-enable-multibyte-characters)
-           (setq str (eword-decode-string
-                      (decode-mime-charset-string string elmo-mime-charset)))
-           (setq str (encode-mime-charset-string str elmo-mime-charset))
-           (elmo-set-buffer-multibyte nil)
-           str))))
+  (and string
+       (elmo-set-work-buf
+       (elmo-set-buffer-multibyte default-enable-multibyte-characters)
+       (setq string
+             (encode-mime-charset-string
+              (eword-decode-and-unfold-unstructured-field-body
+               string)
+              elmo-mime-charset))
+       (elmo-set-buffer-multibyte nil)
+       string)))
 
 (defsubst elmo-collect-field (beg end downcase-field-name)
   (save-excursion