From 59b0d312b553d915248a50b069369ecc1df57199 Mon Sep 17 00:00:00 2001 From: teranisi Date: Thu, 9 May 2002 14:22:35 +0000 Subject: [PATCH] * 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/ChangeLog | 8 ++++++++ elmo/elmo-msgdb.el | 26 ++++++++++++++++++++++---- elmo/elmo-util.el | 19 ++++++++++--------- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 8d39b85..d42fdd1 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,5 +1,13 @@ 2002-05-09 Yuuichi Teranishi + * 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 diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index 18c28a7..3840908 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -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") ",")) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 34dddcd..6ecf46e 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -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 -- 1.7.10.4