+2003-11-13 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * mm-decode.el (mm-dissect-buffer): Save start="<id>" value
+ contained in Content-Type header of multipart/related messages.
+
+ * mm-view.el (mm-w3m-cid-retrieve-1): New function.
+ (mm-w3m-cid-retrieve): Use it.
+
+ * mml.el (mml-generate-mime-1): Add start="<id>" to Content-Type.
+ (mml-insert-mime-headers): Insert Content-ID header.
+ (mml-insert-mml-markup): Insert start="<id>" value.
+
2003-11-12 Teodor Zlatanov <tzz@lifelogs.com>
* nnml.el (nnml-request-accept-article): pass sender to
((equal type "multipart")
(let ((mm-dissect-default-type (if (equal subtype "digest")
"message/rfc822"
- "text/plain")))
+ "text/plain"))
+ (start (cdr (assq 'start (cdr ctl)))))
(add-text-properties 0 (length (car ctl))
(mm-alist-to-plist (cdr ctl)) (car ctl))
;; 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))
- (add-text-properties 0 (length (car ctl))
- (list 'from from)
+ (list 'buffer (mm-copy-to-buffer)
+ 'from from
+ 'start start)
(car ctl))
(cons (car ctl) (mm-dissect-multipart ctl))))
(t
(setq mm-w3m-setup t))
(setq w3m-display-inline-images mm-inline-text-html-with-images))
+(defun mm-w3m-cid-retrieve-1 (url handle)
+ (dolist (elem handle)
+ (when (and (listp elem)
+ (equal url (mm-handle-id elem)))
+ (mm-insert-part elem)
+ (throw 'found-handle (mm-handle-media-type elem)))))
+
(defun mm-w3m-cid-retrieve (url &rest args)
"Insert a content pointed by URL if it has the cid: scheme."
(when (string-match "\\`cid:" url)
(setq url (concat "<" (substring url (match-end 0)) ">"))
(catch 'found-handle
- (dolist (handle (with-current-buffer w3m-current-buffer
- gnus-article-mime-handles))
- (when (and (listp handle)
- (equal url (mm-handle-id handle)))
- (mm-insert-part handle)
- (throw 'found-handle (mm-handle-media-type handle)))))))
+ (let ((handles (with-current-buffer w3m-current-buffer
+ gnus-article-mime-handles)))
+ (if (mm-multiple-handles handles)
+ (dolist (handle handles)
+ (mm-w3m-cid-retrieve-1 url handle))
+ (mm-w3m-cid-retrieve-1 url handles))))))
(eval-and-compile
(unless (or (featurep 'xemacs)
(funcall (cdr handler) cont)
;; No specific handler. Use default one.
(let ((mml-boundary (mml-compute-boundary cont)))
- (insert (format "Content-Type: multipart/%s; boundary=\"%s\"\n"
- type mml-boundary))
+ (insert (format "Content-Type: multipart/%s; boundary=\"%s\""
+ type mml-boundary)
+ (if (cdr (assq 'start cont))
+ (format "; start=\"%s\"\n" (cdr (assq 'start cont)))
+ "\n"))
(let ((cont cont) part)
(while (setq part (pop cont))
;; Skip `multipart' and attributes.
mml-base-boundary))
(defun mml-insert-mime-headers (cont type charset encoding flowed)
- (let (parameters disposition description)
+ (let (parameters id disposition description)
(setq parameters
(mml-parameter-string
cont mml-content-type-parameters))
(mml-insert-parameter-string
cont mml-content-type-parameters))
(insert "\n"))
+ (when (setq id (cdr (assq 'id cont)))
+ (insert "Content-ID: " id "\n"))
(setq parameters
(mml-parameter-string
cont mml-content-disposition-parameters))
(defun mml-insert-mml-markup (handle &optional buffer nofile mmlp)
"Take a MIME handle and insert an MML tag."
(if (stringp (car handle))
- (insert "<#multipart type=" (mm-handle-media-subtype handle)
- ">\n")
+ (progn
+ (insert "<#multipart type=" (mm-handle-media-subtype handle))
+ (let ((start (mm-handle-multipart-ctl-parameter handle 'start)))
+ (when start
+ (insert " start=\"" start "\"")))
+ (insert ">\n"))
(if mmlp
(insert "<#mml type=" (mm-handle-media-type handle))
(insert "<#part type=" (mm-handle-media-type handle)))
(cdr (mm-handle-disposition handle))))
(unless (symbolp (cdr elem))
(insert " " (symbol-name (car elem)) "=\"" (cdr elem) "\"")))
+ (when (mm-handle-id handle)
+ (insert " id=\"" (mm-handle-id handle) "\""))
(when (mm-handle-disposition handle)
(insert " disposition=" (car (mm-handle-disposition handle))))
(when buffer