+2000-11-05 15:06:05 ShengHuo ZHU <zsh@cs.rochester.edu>
+
+ * nnvirtual.el (nnvirtual-request-expire-articles): Uncompress range.
+
2000-11-05 Simon Josefsson <sj@extundo.com>
+ * 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.
`(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)
;;; 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
(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
(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)))
(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)))
(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)