From: yamaoka Date: Sun, 8 Nov 1998 22:12:03 +0000 (+0000) Subject: Sync up with the latest semi-1_11. X-Git-Tag: wemi-1_11_0~6 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9736ee46e88030e69a05b7654b7a3b7920d3280a;p=elisp%2Fsemi.git Sync up with the latest semi-1_11. --- diff --git a/ChangeLog b/ChangeLog index eaf95f5..3f48067 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,40 @@ +1998-11-08 MORIOKA Tomohiko + + * mime-bbdb.el (mime-bbdb/update-record): Use + `mime-decode-field-body' instead of + `eword-decode-structured-field-body'. + +1998-10-31 MORIOKA Tomohiko + + * mime-edit.el (mime-edit-decode-message-in-buffer): Delete fields + match with `mime-edit-again-ignored-field-regexp' then call + `mime-decode-header-in-buffer'. + (mime-edit-again): Delete header filter. + +1998-10-31 MORIOKA Tomohiko + + * mime-edit.el (mime-edit-decode-multipart-in-buffer): Change + interface. + (mime-edit-decode-single-part-in-buffer): New function. + (mime-edit-decode-message-in-buffer): Swap arguments; use function + `mime-edit-decode-single-part-in-buffer'. + (mime-edit-again): Modify for + `mime-edit-decode-message-in-buffer'. + +1998-10-31 MORIOKA Tomohiko + + * mime-edit.el (mime-edit-decode-multipart-in-buffer): New + function. + (mime-edit-decode-message-in-buffer): Add new optional argument + `default-content-type'; use function + `mime-edit-decode-multipart-in-buffer'; add autoload cookie. + (mime-edit-again): Add autoload cookie. + + * mime-edit.el (mime-edit-decode-message-in-buffer): Renamed from + `mime-edit-decode-buffer'; change `not-decode-text' to optional + argument. + + 1998-11-02 Katsumi Yamaoka * WEMI: Version 1.10.2 (Yui) released. diff --git a/VERSION b/VERSION index d9bc4bb..57fc0fd 100644 --- a/VERSION +++ b/VERSION @@ -70,7 +70,7 @@ 1.10.0 Tsubata $(BDEH((B 1.10.1 Morimoto $(B?9K\(B 1.10.2 Higashi-Kanazawa $(BEl6bBt(B -------- Kanazawa $(B6bBt(B ; <=> $(BKLN&E4F;(B $(BKLE46bBt(B +1.11.0 Kanazawa $(B6bBt(B ; <=> $(BKLN&E4F;(B $(BKLE46bBt(B ------- Nishi-Kanazawa $(B@>6bBt(B ; <=> $(BKLN&E4F;(B $(B?7@>6bBt(B ------- (JR) Nonoichi $(BLn!9;T(B : : : @@ -131,7 +131,7 @@ 1.10.0 Shin-Kambara $(B?73w86(B 1.10.1 Kambara $(B3w86(B 1.10.2 Yui $(BM3Hf(B ------- Okitsu $(B6=DE(B +1.11.0 Okitsu $(B6=DE(B ------ Shimizu $(B@6?e(B ------ Kusanagi $(BApFe(B ------ Shizuoka $(B@E2,(B diff --git a/mime-bbdb.el b/mime-bbdb.el index 381655c..62bc191 100644 --- a/mime-bbdb.el +++ b/mime-bbdb.el @@ -172,7 +172,7 @@ the user confirms the creation." ) (if from (bbdb-annotate-message-sender - (eword-decode-structured-field-body from) t + (mime-decode-field-body from 'From) t (or (bbdb-invoke-hook-for-value mime-bbdb/auto-create-p) offer-to-create) offer-to-create)) diff --git a/mime-edit.el b/mime-edit.el index 3c38997..bca7c68 100644 --- a/mime-edit.el +++ b/mime-edit.el @@ -2577,148 +2577,165 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n" "\\):") "Regexp for deleted header fields when `mime-edit-again' is called.") -(defun mime-edit-decode-buffer (not-decode-text) +(defun mime-edit-decode-multipart-in-buffer (content-type not-decode-text) + (let* ((subtype (mime-content-type-subtype content-type)) + (boundary (mime-content-type-parameter content-type "boundary")) + (boundary-pat (concat "\n--" (regexp-quote boundary) "[ \t]*\n"))) + (re-search-forward boundary-pat nil t) + (let ((bb (match-beginning 0)) eb tag) + (setq tag (format "\n--<<%s>>-{\n" subtype)) + (goto-char bb) + (insert tag) + (setq bb (+ bb (length tag))) + (re-search-forward + (concat "\n--" (regexp-quote boundary) "--[ \t]*\n") + nil t) + (setq eb (match-beginning 0)) + (replace-match (format "--}-<<%s>>\n" subtype)) + (save-restriction + (narrow-to-region bb eb) + (goto-char (point-min)) + (while (re-search-forward boundary-pat nil t) + (let ((beg (match-beginning 0)) + end) + (delete-region beg (match-end 0)) + (save-excursion + (if (re-search-forward boundary-pat nil t) + (setq end (match-beginning 0)) + (setq end (point-max)) + ) + (save-restriction + (narrow-to-region beg end) + (mime-edit-decode-message-in-buffer + (if (eq subtype 'digest) + (eval-when-compile + (make-mime-content-type 'message 'rfc822)) + ) + not-decode-text) + (goto-char (point-max)) + )))) + )) + (goto-char (point-min)) + (or (= (point-min) 1) + (delete-region (point-min) + (if (search-forward "\n\n" nil t) + (match-end 0) + (point-min) + ))) + )) + +(defun mime-edit-decode-single-part-in-buffer (content-type not-decode-text) + (let* ((type (mime-content-type-primary-type content-type)) + (subtype (mime-content-type-subtype content-type)) + (ctype (format "%s/%s" type subtype)) + charset + (pstr (let ((bytes (+ 14 (length ctype)))) + (mapconcat (function + (lambda (attr) + (if (string= (car attr) "charset") + (progn + (setq charset (cdr attr)) + "") + (let* ((str (concat (car attr) + "=" (cdr attr))) + (bs (length str))) + (setq bytes (+ bytes bs 2)) + (if (< bytes 76) + (concat "; " str) + (setq bytes (+ bs 1)) + (concat ";\n " str) + ) + )))) + (mime-content-type-parameters content-type) ""))) + encoding + encoded + (limit (save-excursion + (if (search-forward "\n\n" nil t) + (1- (point)))))) + (save-excursion + (if (re-search-forward + "^Content-Transfer-Encoding:" limit t) + (let ((beg (match-beginning 0)) + (hbeg (match-end 0)) + (end (std11-field-end))) + (setq encoding + (downcase + (eliminate-top-spaces + (std11-unfold-string + (buffer-substring hbeg end))))) + (if (or charset (eq type 'text)) + (progn + (delete-region beg (1+ end)) + (goto-char (point-min)) + (if (search-forward "\n\n" nil t) + (progn + (mime-decode-region + (match-end 0)(point-max) encoding) + (setq encoded t + encoding nil) + ))))))) + (if (or encoded (not not-decode-text)) + (decode-mime-charset-region (point-min)(point-max) + (or charset default-mime-charset)) + ) + (let ((he (if (re-search-forward "^$" nil t) + (match-end 0) + (point-min) + ))) + (if (and (eq type 'text) + (eq subtype 'x-rot13-47-48)) + (mule-caesar-region he (point-max)) + ) + (if (= (point-min) 1) + (progn + (goto-char he) + (insert + (concat "\n" + (mime-create-tag + (format "%s/%s%s" type subtype pstr) + encoding))) + ) + (delete-region (point-min) he) + (insert + (mime-create-tag (format "%s/%s%s" type subtype pstr) + encoding)) + )) + )) + +;;;###autoload +(defun mime-edit-decode-message-in-buffer (&optional default-content-type + not-decode-text) (save-excursion (goto-char (point-min)) - (let ((ctl (mime-read-Content-Type))) + (let ((ctl (or (mime-read-Content-Type) + default-content-type))) (if ctl - (let ((type (mime-content-type-primary-type ctl)) - (stype (mime-content-type-subtype ctl)) - (params (mime-content-type-parameters ctl))) + (let ((type (mime-content-type-primary-type ctl))) (cond - ((and (eq type 'application)(eq stype 'pgp-signature)) + ((and (eq type 'application) + (eq (mime-content-type-subtype ctl) 'pgp-signature)) (delete-region (point-min)(point-max)) ) ((eq type 'multipart) - (let* ((boundary (cdr (assoc "boundary" params))) - (boundary-pat - (concat "\n--" (regexp-quote boundary) "[ \t]*\n")) - ) - (re-search-forward boundary-pat nil t) - (let ((bb (match-beginning 0)) eb tag) - (setq tag (format "\n--<<%s>>-{\n" stype)) - (goto-char bb) - (insert tag) - (setq bb (+ bb (length tag))) - (re-search-forward - (concat "\n--" (regexp-quote boundary) "--[ \t]*\n") - nil t) - (setq eb (match-beginning 0)) - (replace-match (format "--}-<<%s>>\n" stype)) - (save-restriction - (narrow-to-region bb eb) - (goto-char (point-min)) - (while (re-search-forward boundary-pat nil t) - (let ((beg (match-beginning 0)) - end) - (delete-region beg (match-end 0)) - (save-excursion - (if (re-search-forward boundary-pat nil t) - (setq end (match-beginning 0)) - (setq end (point-max)) - ) - (save-restriction - (narrow-to-region beg end) - (mime-edit-decode-buffer not-decode-text) - (goto-char (point-max)) - )))) - )) - (goto-char (point-min)) - (or (= (point-min) 1) - (delete-region (point-min) - (if (search-forward "\n\n" nil t) - (match-end 0) - (point-min) - ))) - )) + (mime-edit-decode-multipart-in-buffer ctl not-decode-text) + ) (t - (let* ((ctype (format "%s/%s" type stype)) - charset - (pstr - (let ((bytes (+ 14 (length ctype)))) - (mapconcat (function - (lambda (attr) - (if (string= (car attr) "charset") - (progn - (setq charset (cdr attr)) - "") - (let* ((str - (concat (car attr) - "=" (cdr attr)) - ) - (bs (length str)) - ) - (setq bytes (+ bytes bs 2)) - (if (< bytes 76) - (concat "; " str) - (setq bytes (+ bs 1)) - (concat ";\n " str) - ) - )))) - params ""))) - encoding - encoded - (limit (save-excursion - (if (search-forward "\n\n" nil t) - (1- (point)))))) - (save-excursion - (if (re-search-forward - "^Content-Transfer-Encoding:" limit t) - (let ((beg (match-beginning 0)) - (hbeg (match-end 0)) - (end (std11-field-end))) - (setq encoding - (downcase - (eliminate-top-spaces - (std11-unfold-string - (buffer-substring hbeg end))))) - (if (or charset (eq type 'text)) - (progn - (delete-region beg (1+ end)) - (goto-char (point-min)) - (if (search-forward "\n\n" nil t) - (progn - (mime-decode-region - (match-end 0)(point-max) encoding) - (setq encoded t - encoding nil) - ))))))) - (if (or encoded (not not-decode-text)) - (decode-mime-charset-region - (point-min)(point-max) - (or charset default-mime-charset)) - ) - (let ((he - (if (re-search-forward "^$" nil t) - (match-end 0) - (point-min) - ))) - (if (and (eq type 'text) - (eq stype 'x-rot13-47-48)) - (mule-caesar-region he (point-max)) - ) - (if (= (point-min) 1) - (progn - (goto-char he) - (insert - (concat "\n" - (mime-create-tag - (format "%s/%s%s" type stype pstr) - encoding))) - ) - (delete-region (point-min) he) - (insert - (mime-create-tag - (format "%s/%s%s" type stype pstr) - encoding)) - )) - )))) + (mime-edit-decode-single-part-in-buffer ctl not-decode-text) + ))) (or not-decode-text (decode-mime-charset-region (point-min) (point-max) - default-mime-charset) - ) - )))) + default-mime-charset)) + ) + (save-restriction + (std11-narrow-to-header) + (goto-char (point-min)) + (while (re-search-forward mime-edit-again-ignored-field-regexp nil t) + (delete-region (match-beginning 0) (1+ (std11-field-end))) + )) + (mime-decode-header-in-buffer (not not-decode-text)) + ))) +;;;###autoload (defun mime-edit-again (&optional not-decode-text no-separator not-turn-on) "Convert current buffer to MIME-Edit buffer and turn on MIME-Edit mode. Content-Type and Content-Transfer-Encoding header fields will be @@ -2730,14 +2747,8 @@ converted to MIME-Edit tags." nil t) (replace-match "\n\n") ) - (mime-edit-decode-buffer not-decode-text) + (mime-edit-decode-message-in-buffer nil not-decode-text) (goto-char (point-min)) - (save-restriction - (std11-narrow-to-header) - (goto-char (point-min)) - (while (re-search-forward mime-edit-again-ignored-field-regexp nil t) - (delete-region (match-beginning 0) (1+ (std11-field-end))) - )) (or no-separator (and (re-search-forward "^$") (replace-match mail-header-separator) diff --git a/semi-def.el b/semi-def.el index a1b8f04..923739a 100644 --- a/semi-def.el +++ b/semi-def.el @@ -30,7 +30,7 @@ (require 'custom) -(defconst mime-user-interface-product '["WEMI" (1 10 2) "Yui"] +(defconst mime-user-interface-product '["WEMI" (1 11 0) "Okitsu"] "Implementation name, version name and numbers of MIME-kernel package.") (autoload 'mule-caesar-region "mule-caesar"