From dd8fe676f062c7873bd6682ab6e35bf157a270d8 Mon Sep 17 00:00:00 2001 From: hmurata Date: Sat, 29 Sep 2001 13:41:40 +0000 Subject: [PATCH] * elmo-nmz.el (elmo-nmz-content-type-alist): New variable. (elmo-map-message-fetch): Add `Content-Type' field if contents is not a message. --- elmo/ChangeLog | 6 ++++++ elmo/elmo-nmz.el | 25 +++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 06c4c5f..1b2caa7 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,9 @@ +2001-09-29 Hiroya Murata + + * elmo-nmz.el (elmo-nmz-content-type-alist): New variable. + (elmo-map-message-fetch): Add `Content-Type' field if contents is + not a message. + 2001-09-20 Hiroya Murata * elmo.el (elmo-folder-writable-p): Changed default value to nil. diff --git a/elmo/elmo-nmz.el b/elmo/elmo-nmz.el index c768d26..0fc85ef 100644 --- a/elmo/elmo-nmz.el +++ b/elmo/elmo-nmz.el @@ -51,6 +51,9 @@ :type '(repeat string) :group 'elmo) +(defvar elmo-nmz-content-type-alist '(("\.html?\\'" . "text/html")) + "*An alist of (REGEXP . Content-Type) related filename.") + ;;; "namazu search" (eval-and-compile (luna-define-class elmo-nmz-folder @@ -82,7 +85,7 @@ (elmo-replace-string-as-filename (elmo-folder-name-internal folder)) (expand-file-name "nmz" elmo-msgdb-dir))) - + (defun elmo-nmz-msgdb-create-entity (folder number) "Create msgdb entity for the message in the FOLDER with NUMBER." (elmo-msgdb-create-overview-entity-from-file @@ -166,7 +169,25 @@ location strategy &optional section unseen) (when (file-exists-p location) - (insert-file-contents-as-binary location))) + (insert-file-contents-as-binary location) + (unless (or (std11-field-body "To") + (std11-field-body "Resent-To") + (std11-field-body "Cc") + (std11-field-body "Bcc") + (std11-field-body "Newsgroups")) + (erase-buffer) + (set-buffer-multibyte t) + (insert-file-contents location) + (goto-char (point-min)) + (insert "Content-Type: " + (or (cdr (elmo-string-matched-assoc + location + elmo-nmz-content-type-alist)) + "text/plain") + "; charset=ISO-2022-JP\nMIME-Version: 1.0\n\n") + (encode-coding-region (point-min) (point-max) + (mime-charset-to-coding-system "ISO-2022-JP")) + (set-buffer-multibyte nil)))) (luna-define-method elmo-map-folder-list-message-locations ((folder elmo-nmz-folder)) -- 1.7.10.4