Mercurial > emacs
comparison lisp/gnus/mm-decode.el @ 60302:f34a552e4a9f
Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-139
Merge from gnus--rel--5.10
Patches applied:
* miles@gnu.org--gnu-2005/gnus--rel--5.10 (patch 32-33)
- Merge from emacs--cvs-trunk--0
- Update from CVS
2005-02-27 Arne J,Ax(Brgensen <arne@arnested.dk>
* lisp/gnus/mm-decode.el (mm-dissect-buffer): Pass the from field on to
`mm-dissect-multipart' and receive the from field as an (optional)
argument from `mm-dissect-multipart'.
(mm-dissect-multipart): Receive the from field as an argument and
pass it on when we call `mm-dissect-buffer' on MIME parts. Fixes
verification/decryption of signed/encrypted MIME parts.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 28 Feb 2005 00:04:11 +0000 |
parents | aac0a33f5772 |
children | 18a818a2ee7c e4694597cbf4 |
comparison
equal
deleted
inserted
replaced
60301:f3c5c717aa02 | 60302:f34a552e4a9f |
---|---|
507 (defun mm-destroy-postponed-undisplay-list () | 507 (defun mm-destroy-postponed-undisplay-list () |
508 (when mm-postponed-undisplay-list | 508 (when mm-postponed-undisplay-list |
509 (message "Destroying external MIME viewers") | 509 (message "Destroying external MIME viewers") |
510 (mm-destroy-parts mm-postponed-undisplay-list))) | 510 (mm-destroy-parts mm-postponed-undisplay-list))) |
511 | 511 |
512 (defun mm-dissect-buffer (&optional no-strict-mime loose-mime) | 512 (defun mm-dissect-buffer (&optional no-strict-mime loose-mime from) |
513 "Dissect the current buffer and return a list of MIME handles." | 513 "Dissect the current buffer and return a list of MIME handles." |
514 (save-excursion | 514 (save-excursion |
515 (let (ct ctl type subtype cte cd description id result from) | 515 (let (ct ctl type subtype cte cd description id result) |
516 (save-restriction | 516 (save-restriction |
517 (mail-narrow-to-head) | 517 (mail-narrow-to-head) |
518 (when (or no-strict-mime | 518 (when (or no-strict-mime |
519 loose-mime | 519 loose-mime |
520 (mail-fetch-field "mime-version")) | 520 (mail-fetch-field "mime-version")) |
521 (setq ct (mail-fetch-field "content-type") | 521 (setq ct (mail-fetch-field "content-type") |
522 ctl (ignore-errors (mail-header-parse-content-type ct)) | 522 ctl (ignore-errors (mail-header-parse-content-type ct)) |
523 cte (mail-fetch-field "content-transfer-encoding") | 523 cte (mail-fetch-field "content-transfer-encoding") |
524 cd (mail-fetch-field "content-disposition") | 524 cd (mail-fetch-field "content-disposition") |
525 description (mail-fetch-field "content-description") | 525 description (mail-fetch-field "content-description") |
526 from (mail-fetch-field "from") | |
527 id (mail-fetch-field "content-id")) | 526 id (mail-fetch-field "content-id")) |
527 (unless from | |
528 (setq from (mail-fetch-field "from"))) | |
528 ;; FIXME: In some circumstances, this code is running within | 529 ;; FIXME: In some circumstances, this code is running within |
529 ;; an unibyte macro. mail-extract-address-components | 530 ;; an unibyte macro. mail-extract-address-components |
530 ;; creates unibyte buffers. This `if', though not a perfect | 531 ;; creates unibyte buffers. This `if', though not a perfect |
531 ;; solution, avoids most of them. | 532 ;; solution, avoids most of them. |
532 (if from | 533 (if from |
565 (add-text-properties 0 (length (car ctl)) | 566 (add-text-properties 0 (length (car ctl)) |
566 (list 'buffer (mm-copy-to-buffer) | 567 (list 'buffer (mm-copy-to-buffer) |
567 'from from | 568 'from from |
568 'start start) | 569 'start start) |
569 (car ctl)) | 570 (car ctl)) |
570 (cons (car ctl) (mm-dissect-multipart ctl)))) | 571 (cons (car ctl) (mm-dissect-multipart ctl from)))) |
571 (t | 572 (t |
572 (mm-possibly-verify-or-decrypt | 573 (mm-possibly-verify-or-decrypt |
573 (mm-dissect-singlepart | 574 (mm-dissect-singlepart |
574 ctl | 575 ctl |
575 (and cte (intern (downcase (mail-header-remove-whitespace | 576 (and cte (intern (downcase (mail-header-remove-whitespace |
592 (assoc 'format ctl) | 593 (assoc 'format ctl) |
593 t)) | 594 t)) |
594 (mm-make-handle | 595 (mm-make-handle |
595 (mm-copy-to-buffer) ctl cte nil cdl description nil id))) | 596 (mm-copy-to-buffer) ctl cte nil cdl description nil id))) |
596 | 597 |
597 (defun mm-dissect-multipart (ctl) | 598 (defun mm-dissect-multipart (ctl from) |
598 (goto-char (point-min)) | 599 (goto-char (point-min)) |
599 (let* ((boundary (concat "\n--" (mail-content-type-get ctl 'boundary))) | 600 (let* ((boundary (concat "\n--" (mail-content-type-get ctl 'boundary))) |
600 (close-delimiter (concat (regexp-quote boundary) "--[ \t]*$")) | 601 (close-delimiter (concat (regexp-quote boundary) "--[ \t]*$")) |
601 start parts | 602 start parts |
602 (end (save-excursion | 603 (end (save-excursion |
609 (goto-char (match-beginning 0)) | 610 (goto-char (match-beginning 0)) |
610 (when start | 611 (when start |
611 (save-excursion | 612 (save-excursion |
612 (save-restriction | 613 (save-restriction |
613 (narrow-to-region start (point)) | 614 (narrow-to-region start (point)) |
614 (setq parts (nconc (list (mm-dissect-buffer t)) parts))))) | 615 (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts))))) |
615 (end-of-line 2) | 616 (end-of-line 2) |
616 (or (looking-at boundary) | 617 (or (looking-at boundary) |
617 (forward-line 1)) | 618 (forward-line 1)) |
618 (setq start (point))) | 619 (setq start (point))) |
619 (when (and start (< start end)) | 620 (when (and start (< start end)) |
620 (save-excursion | 621 (save-excursion |
621 (save-restriction | 622 (save-restriction |
622 (narrow-to-region start end) | 623 (narrow-to-region start end) |
623 (setq parts (nconc (list (mm-dissect-buffer t)) parts))))) | 624 (setq parts (nconc (list (mm-dissect-buffer t nil from)) parts))))) |
624 (mm-possibly-verify-or-decrypt (nreverse parts) ctl))) | 625 (mm-possibly-verify-or-decrypt (nreverse parts) ctl))) |
625 | 626 |
626 (defun mm-copy-to-buffer () | 627 (defun mm-copy-to-buffer () |
627 "Copy the contents of the current buffer to a fresh buffer." | 628 "Copy the contents of the current buffer to a fresh buffer." |
628 (save-excursion | 629 (save-excursion |