From ecae583acd5e275f356e4a35ccbc77ba86906a99 Mon Sep 17 00:00:00 2001 From: ueno Date: Sun, 5 Nov 2000 21:33:20 +0000 Subject: [PATCH] Synch with Gnus. --- lisp/ChangeLog | 15 +++++++++++++++ lisp/mm-decode.el | 42 ++++++++++++++++++++++++++++++++++++++---- lisp/mml-smime.el | 14 ++++++++++++-- lisp/nnvirtual.el | 3 ++- 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 6e0a3d5..64e96e0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,20 @@ +2000-11-05 15:06:05 ShengHuo ZHU + + * nnvirtual.el (nnvirtual-request-expire-articles): Uncompress range. + 2000-11-05 Simon Josefsson + * mml-smime.el (mml-smime-verify): Work in original multipart + buffert. + + * mm-decode.el (mm-handle-multipart-original-buffer): New macro. + (mm-handle-multipart-ctl-parameter): Ditto. + (mm-alist-to-plist): New function. + (mm-dissect-buffer): Store CTL parameters and copy original buffer + for multiparts. + (mm-destroy-parts): Destroy multipart buffert. + (mm-remove-part): Ditto. + * mml-smime.el (mml-smime-sign): Not used. (mml-smime-encrypt): Ditto. diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index bbd2e8b..bc7069e 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -70,6 +70,11 @@ `(setcar (nthcdr 6 ,handle) ,contents)) (defmacro mm-handle-id (handle) `(nth 7 ,handle)) +(defmacro mm-handle-multipart-original-buffer (handle) + `(get-text-property 0 'buffer (car ,handle))) +(defmacro mm-handle-multipart-ctl-parameter (handle parameter) + `(get-text-property 0 ,parameter (car ,handle))) + (defmacro mm-make-handle (&optional buffer type encoding undisplayer disposition description cache id) @@ -278,6 +283,24 @@ to: ;;; The functions. +(defun mm-alist-to-plist (alist) + "Convert association list ALIST into the equivalent property-list form. +The plist is returned. This converts from + +\((a . 1) (b . 2) (c . 3)) + +into + +\(a 1 b 2 c 3) + +The original alist is not modified. See also `destructive-alist-to-plist'." + (let (plist) + (while alist + (let ((el (car alist))) + (setq plist (cons (cdr el) (cons (car el) plist)))) + (setq alist (cdr alist))) + (nreverse plist))) + (defun mm-dissect-buffer (&optional no-strict-mime) "Dissect the current buffer and return a list of MIME handles." (save-excursion @@ -314,6 +337,17 @@ to: (let ((mm-dissect-default-type (if (equal subtype "digest") "message/rfc822" "text/plain"))) + (add-text-properties 0 (length (car ctl)) + (mm-alist-to-plist (cdr ctl)) (car ctl)) + + ;; what really needs to be done here is a way to link a + ;; MIME handle back to it's parent MIME handle (in a multilevel + ;; MIME article). That would probably require changing + ;; the mm-handle API so we simply store the multipart buffert + ;; name as a text property of the "multipart/whatever" string. + (add-text-properties 0 (length (car ctl)) + (list 'buffer (mm-copy-to-buffer)) + (car ctl)) (cons (car ctl) (mm-dissect-multipart ctl)))) (t (mm-dissect-singlepart @@ -547,8 +581,8 @@ external if displayed external." (while (setq handle (pop handles)) (cond ((stringp handle) - ;; Do nothing. - ) + (when (buffer-live-p (get-text-property 0 'buffer handle)) + (kill-buffer (get-text-property 0 'buffer handle)))) ((and (listp handle) (stringp (car handle))) (mm-remove-parts (cdr handle))) @@ -564,8 +598,8 @@ external if displayed external." (while (setq handle (pop handles)) (cond ((stringp handle) - ;; Do nothing. - ) + (when (buffer-live-p (get-text-property 0 'buffer handle)) + (kill-buffer (get-text-property 0 'buffer handle)))) ((and (listp handle) (stringp (car handle))) (mm-destroy-parts (cdr handle))) diff --git a/lisp/mml-smime.el b/lisp/mml-smime.el index b25e36b..427c538 100644 --- a/lisp/mml-smime.el +++ b/lisp/mml-smime.el @@ -30,8 +30,18 @@ (require 'smime) (defun mml-smime-verify (handle ctl) - (smime-verify-buffer) - handle) + (with-current-buffer (mm-handle-multipart-original-buffer ctl) + ;; xxx modifies buffer -- noone else uses the buffer, so what the heck + (goto-char (point-min)) + (insert (format "Content-Type: %s; " (mm-handle-media-type ctl))) + (insert (format "protocol=\"%s\"; " + (mm-handle-multipart-ctl-parameter ctl 'protocol))) + (insert (format "micalg=\"%s\"; " + (mm-handle-multipart-ctl-parameter ctl 'micalg))) + (insert (format "boundary=\"%s\"\n\n" + (mm-handle-multipart-ctl-parameter ctl 'boundary))) + (smime-verify-buffer) + handle)) (provide 'mml-smime) diff --git a/lisp/nnvirtual.el b/lisp/nnvirtual.el index 2440ad0..e1f43a0 100644 --- a/lisp/nnvirtual.el +++ b/lisp/nnvirtual.el @@ -375,7 +375,8 @@ component group will show up when you enter the virtual group.") #'(lambda (article) (nnvirtual-reverse-map-article group article)) - (gnus-group-expire-articles-1 group))))) + (gnus-uncompress-range + (gnus-group-expire-articles-1 group)))))) (sort unexpired '<))) -- 1.7.10.4