+(defun gnus-article-prepare-mime-display (&optional number)
+ (goto-char (point-min))
+ (when (re-search-forward "^[^\t ]+:" nil t)
+ (goto-char (match-beginning 0)))
+ (save-restriction
+ (narrow-to-region (point)
+ (if (search-forward "\n\n" nil t)
+ (point)
+ (point-max)))
+ (gnus-treat-article 'head)
+ (goto-char (point-max)))
+ (let* ((start (point))
+ (root-entity (unless number
+ (get-text-property (point-min) 'mime-view-entity)))
+ (entity (if (and root-entity
+ (eq 'multipart
+ (mime-content-type-primary-type
+ (mime-entity-content-type root-entity))))
+ (get-text-property start 'mime-view-entity)
+ root-entity))
+ (number (or number 0))
+ content-type treat-type)
+ (while (and (not (eobp))
+ (progn (mime-preview-move-to-next)
+ (> (point) start)))
+ (if entity
+ (progn
+ (setq content-type (mime-entity-content-type entity)
+ treat-type (format "%s/%s"
+ (mime-content-type-primary-type
+ content-type)
+ (mime-content-type-subtype
+ content-type)))
+ (if (string-equal treat-type "message/rfc822")
+ (save-restriction
+ (narrow-to-region start (point-max))
+ (gnus-article-prepare-mime-display number)
+ (goto-char (point-max)))
+ (save-restriction
+ (narrow-to-region start (point))
+ (setq start (point)
+ entity (get-text-property start 'mime-view-entity))
+ (gnus-treat-article nil (incf number) nil treat-type))))
+ (setq start (point)
+ entity (get-text-property start 'mime-view-entity))))
+ (unless (eobp)
+ (save-restriction
+ (narrow-to-region (point) (point-max))
+ (if entity
+ (progn
+ (setq content-type (mime-entity-content-type entity)
+ treat-type (format "%s/%s"
+ (mime-content-type-primary-type
+ content-type)
+ (mime-content-type-subtype
+ content-type)))
+ (if (string-equal treat-type "message/rfc822")
+ (gnus-article-prepare-mime-display number)
+ (incf number)
+ (gnus-treat-article 'last number number treat-type)))
+ (gnus-treat-article t))))))
+