+(defvar mime-viewer/content-header-filter-alist nil)
+
+
+;;; @@ content filter
+;;;
+
+(defvar mime-viewer/content-filter-alist
+ '(("text/enriched" . mime-preview/filter-for-text/enriched)
+ ("text/richtext" . mime-preview/filter-for-text/richtext)
+ (t . mime-preview/filter-for-text/plain)
+ ))
+
+
+;;; @@ content separator
+;;;
+
+(defun mime-preview/default-content-separator (rcnum cinfo ctype params subj)
+ (if (and (not (mime-viewer/header-visible-p rcnum cinfo ctype))
+ (not (mime-viewer/body-visible-p rcnum cinfo ctype))
+ )
+ (progn
+ (goto-char (point-max))
+ (insert "\n")
+ )))
+
+
+;;; @@ buffer local variables
+;;;
+
+;; for XEmacs
+(defvar mime::article/preview-buffer nil)
+(defvar mime::article/code-converter nil)
+(defvar mime::preview/article-buffer nil)
+
+(make-variable-buffer-local 'mime::article/content-info)
+(make-variable-buffer-local 'mime::article/preview-buffer)
+(make-variable-buffer-local 'mime::article/code-converter)
+
+(make-variable-buffer-local 'mime::preview/mother-buffer)
+(make-variable-buffer-local 'mime::preview/content-list)
+(make-variable-buffer-local 'mime::preview/article-buffer)
+(make-variable-buffer-local 'mime::preview/original-major-mode)
+(make-variable-buffer-local 'mime::preview/original-window-configuration)
+
+
+;;; @@ quitting method
+;;;
+
+(defvar mime-viewer/quitting-method-alist
+ '((mime/show-message-mode
+ . mime-viewer/quitting-method-for-mime/show-message-mode)))
+
+(defvar mime-viewer/over-to-previous-method-alist nil)
+(defvar mime-viewer/over-to-next-method-alist nil)
+
+(defvar mime-viewer/show-summary-method nil)
+
+
+;;; @@ following method
+;;;
+
+(defvar mime-viewer/following-method-alist nil)
+
+(defvar mime-viewer/following-required-fields-list
+ '("From"))
+
+
+;;; @@ X-Face
+;;;
+
+;; hack from Gnus 5.0.4.
+
+(defvar mime-viewer/x-face-to-pbm-command
+ "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm")
+
+(defvar mime-viewer/x-face-command
+ (concat mime-viewer/x-face-to-pbm-command
+ " | xv -quit -")
+ "String to be executed to display an X-Face field.
+The command will be executed in a sub-shell asynchronously.
+The compressed face will be piped to this command.")
+
+(defun mime-viewer/x-face-function ()
+ "Function to display X-Face field. You can redefine to customize."
+ ;; 1995/10/12 (c.f. tm-eng:130)
+ ;; fixed by Eric Ding <ericding@San-Jose.ate.slb.com>
+ (save-restriction
+ (narrow-to-region (point-min) (re-search-forward "^$" nil t))
+ ;; end
+ (goto-char (point-min))
+ (if (re-search-forward "^X-Face:[ \t]*" nil t)
+ (let ((beg (match-end 0))
+ (end (std11-field-end))
+ )
+ (call-process-region beg end "sh" nil 0 nil
+ "-c" mime-viewer/x-face-command)
+ ))))
+
+
+;;; @@ utility
+;;;
+
+(defun mime-preview/get-original-major-mode ()
+ (if mime::preview/mother-buffer
+ (save-excursion
+ (set-buffer mime::preview/mother-buffer)
+ (mime-preview/get-original-major-mode)
+ )
+ mime::preview/original-major-mode))
+
+
+;;; @ data structures
+;;;
+
+;;; @@ preview-content-info
+;;;
+
+(define-structure mime::preview-content-info
+ point-min point-max buffer content-info)
+
+
+;;; @ buffer setup
+;;;
+
+(defun mime-viewer/setup-buffer (&optional ctl encoding ibuf obuf)
+ (if ibuf
+ (progn
+ (get-buffer ibuf)
+ (set-buffer ibuf)
+ ))
+ (or mime-viewer/redisplay
+ (setq mime::article/content-info (mime/parse-message ctl encoding))