diff options
| -rw-r--r-- | lisp/gnus/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/gnus/mml.el | 47 |
2 files changed, 29 insertions, 25 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 1fa5ffff0c9..fa97128634b 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2011-09-22 Katsumi Yamaoka <yamaoka@jpl.org> | ||
| 2 | |||
| 3 | * mml.el (mml-inhibit-compute-boundary): New internal variable. | ||
| 4 | (mml-compute-boundary): Don't check collision if it is non-nil. | ||
| 5 | (mml-compute-boundary-1): Use mml-generate-mime-1 to encode part | ||
| 6 | before checking collision. | ||
| 7 | |||
| 1 | 2011-09-21 Lars Magne Ingebrigtsen <larsi@gnus.org> | 8 | 2011-09-21 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 9 | ||
| 3 | * message.el (message-indent-citation): Really make sure there's a | 10 | * message.el (message-indent-citation): Really make sure there's a |
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index e3939188a7b..d9861394fa0 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el | |||
| @@ -461,6 +461,7 @@ If MML is non-nil, return the buffer up till the correspondent mml tag." | |||
| 461 | (defvar mml-boundary nil) | 461 | (defvar mml-boundary nil) |
| 462 | (defvar mml-base-boundary "-=-=") | 462 | (defvar mml-base-boundary "-=-=") |
| 463 | (defvar mml-multipart-number 0) | 463 | (defvar mml-multipart-number 0) |
| 464 | (defvar mml-inhibit-compute-boundary nil) | ||
| 464 | 465 | ||
| 465 | (defun mml-generate-mime () | 466 | (defun mml-generate-mime () |
| 466 | "Generate a MIME message based on the current MML document." | 467 | "Generate a MIME message based on the current MML document." |
| @@ -710,34 +711,30 @@ If MML is non-nil, return the buffer up till the correspondent mml tag." | |||
| 710 | "Return a unique boundary that does not exist in CONT." | 711 | "Return a unique boundary that does not exist in CONT." |
| 711 | (let ((mml-boundary (funcall mml-boundary-function | 712 | (let ((mml-boundary (funcall mml-boundary-function |
| 712 | (incf mml-multipart-number)))) | 713 | (incf mml-multipart-number)))) |
| 713 | ;; This function tries again and again until it has found | 714 | (unless mml-inhibit-compute-boundary |
| 714 | ;; a unique boundary. | 715 | ;; This function tries again and again until it has found |
| 715 | (while (not (catch 'not-unique | 716 | ;; a unique boundary. |
| 716 | (mml-compute-boundary-1 cont)))) | 717 | (while (not (catch 'not-unique |
| 718 | (mml-compute-boundary-1 cont))))) | ||
| 717 | mml-boundary)) | 719 | mml-boundary)) |
| 718 | 720 | ||
| 719 | (defun mml-compute-boundary-1 (cont) | 721 | (defun mml-compute-boundary-1 (cont) |
| 720 | (let (filename) | 722 | (cond |
| 721 | (cond | 723 | ((member (car cont) '(part mml)) |
| 722 | ((member (car cont) '(part mml)) | 724 | (mm-with-multibyte-buffer |
| 723 | (with-temp-buffer | 725 | (let ((mml-inhibit-compute-boundary t) |
| 724 | (cond | 726 | (mml-multipart-number 0) |
| 725 | ((cdr (assq 'buffer cont)) | 727 | mml-sign-alist mml-encrypt-alist) |
| 726 | (insert-buffer-substring (cdr (assq 'buffer cont)))) | 728 | (mml-generate-mime-1 cont)) |
| 727 | ((and (setq filename (cdr (assq 'filename cont))) | 729 | (goto-char (point-min)) |
| 728 | (not (equal (cdr (assq 'nofile cont)) "yes"))) | 730 | (when (re-search-forward (concat "^--" (regexp-quote mml-boundary)) |
| 729 | (mm-insert-file-contents filename nil nil nil nil t)) | 731 | nil t) |
| 730 | (t | 732 | (setq mml-boundary (funcall mml-boundary-function |
| 731 | (insert (cdr (assq 'contents cont))))) | 733 | (incf mml-multipart-number))) |
| 732 | (goto-char (point-min)) | 734 | (throw 'not-unique nil)))) |
| 733 | (when (re-search-forward (concat "^--" (regexp-quote mml-boundary)) | 735 | ((eq (car cont) 'multipart) |
| 734 | nil t) | 736 | (mapc 'mml-compute-boundary-1 (cddr cont)))) |
| 735 | (setq mml-boundary (funcall mml-boundary-function | 737 | t) |
| 736 | (incf mml-multipart-number))) | ||
| 737 | (throw 'not-unique nil)))) | ||
| 738 | ((eq (car cont) 'multipart) | ||
| 739 | (mapc 'mml-compute-boundary-1 (cddr cont)))) | ||
| 740 | t)) | ||
| 741 | 738 | ||
| 742 | (defun mml-make-boundary (number) | 739 | (defun mml-make-boundary (number) |
| 743 | (concat (make-string (% number 60) ?=) | 740 | (concat (make-string (% number 60) ?=) |