(require 'alist)
(require 'filename)
+(eval-when-compile (require 'mime-text))
+
;;; @ content decoder
;;;
If MODE is specified, play as it. Default MODE is \"play\"."
(interactive)
(or mode
- (setq mode "play")
- )
- (let ((cinfo (get-text-property (point) 'mime-view-cinfo)))
- (if cinfo
+ (setq mode "play"))
+ (let ((entity-info (get-text-property (point) 'mime-view-entity)))
+ (if entity-info
(let ((the-buf (current-buffer))
- (raw-buffer (get-text-property (point) 'mime-view-raw-buffer))
- )
+ (raw-buffer (get-text-property (point) 'mime-view-raw-buffer)))
(setq mime-preview-after-decoded-position (point))
(set-buffer raw-buffer)
- (mime-playback-entity cinfo mode)
- (if (eq (current-buffer) raw-buffer)
- (progn
- (set-buffer the-buf)
- (goto-char mime-preview-after-decoded-position)
- ))
- ))))
-
-(defun mime-playback-entity (cinfo &optional mode)
- (let ((beg (mime-entity-info-point-min cinfo))
- (end (mime-entity-info-point-max cinfo))
- (c-type (mime-entity-info-media-type cinfo))
- (c-subtype (mime-entity-info-media-subtype cinfo))
- (params (mime-entity-info-parameters cinfo))
- (encoding (mime-entity-info-encoding cinfo))
+ (mime-raw-play-entity entity-info mode)
+ (when (eq (current-buffer) raw-buffer)
+ (set-buffer the-buf)
+ (goto-char mime-preview-after-decoded-position)
+ )))))
+
+(defun mime-raw-play-entity (entity-info &optional mode)
+ "Play entity specified by ENTITY-INFO.
+It decodes the entity to call internal or external method. The method
+is selected from variable `mime-acting-condition'. If MODE is
+specified, play as it. Default MODE is \"play\"."
+ (let ((beg (mime-entity-point-min entity-info))
+ (end (mime-entity-point-max entity-info))
+ (c-type (mime-entity-media-type entity-info))
+ (c-subtype (mime-entity-media-subtype entity-info))
+ (params (mime-entity-parameters entity-info))
+ (encoding (mime-entity-encoding entity-info))
)
(or c-type
(setq c-type 'text
)
(t
(mime-show-echo-buffer
- "No method are specified for %s\n" ctype)
+ "No method are specified for %s\n"
+ (mime-type/subtype-string c-type c-subtype))
))
)
))
(narrow-to-region beg end)
(mime-raw-get-filename cal)
))
- (encoding (cdr (assq 'encoding cal)))
+ (encoding (or (cdr (assq 'encoding cal)) "7bit"))
(filename
(if (and name (not (string-equal name "")))
(expand-file-name name
(or (yes-or-no-p (format "File %s exists. Save anyway? " filename))
(error "")))
(re-search-forward "\n\n")
- (mime-write-decoded-region (match-end 0)(point-max) filename encoding)
+ (mime-write-decoded-region (match-end 0) end filename encoding)
))
;;; @ mail/news message
;;;
-(defun mime-view-quitting-method-for-mime-show-message-mode ()
+(defun mime-preview-quitting-method-for-mime-show-message-mode ()
"Quitting method for mime-view.
-It is registered to variable `mime-view-quitting-method-alist'."
+It is registered to variable `mime-preview-quitting-method-alist'."
(let ((mother mime-mother-buffer)
(win-conf mime-preview-original-window-configuration)
)
))
(defun mime-method-to-display-message/rfc822 (beg end cal)
- (let* ((cnum (mime-raw-point-content-number beg))
+ (let* ((cnum (mime-raw-point-to-entity-number beg))
(new-name (format "%s-%s" (buffer-name) cnum))
(mother mime-preview-buffer)
(text-decoder
;;; @ message/partial
;;;
-(defvar mime-raw-coding-system-alist
- (list '(mh-show-mode . no-conversion)
- (cons t (mime-charset-to-coding-system default-mime-charset))
- ))
-
-(defun mime-article::write-region (start end file)
+(defun mime-raw-write-region (start end filename)
+ "Write current region into specified file.
+When called from a program, takes three arguments:
+START, END and FILENAME. START and END are buffer positions.
+It refer `mime-raw-buffer-coding-system-alist' to choose coding-system
+to write."
(let ((coding-system-for-write
(cdr
- (or (assq major-mode mime-raw-coding-system-alist)
- (assq t mime-raw-coding-system-alist)
+ (or (assq major-mode mime-raw-buffer-coding-system-alist)
+ (assq t mime-raw-buffer-coding-system-alist)
))))
- (write-region start end file)
+ (write-region start end filename)
))
(defun mime-method-to-store-message/partial (beg end cal)
(re-search-forward "^$")
(goto-char (1+ (match-end 0)))
(setq file (concat root-dir "/" number))
- (mime-article::write-region (point) end file)
+ (mime-raw-write-region (point) end file)
(let ((total-file (concat root-dir "/CT")))
(setq total
(if total
(defun mime-method-to-display-caesar (start end cal)
"Internal method for mime-view to display ROT13-47-48 message."
- (let* ((cnum (mime-raw-point-content-number start))
+ (let* ((cnum (mime-raw-point-to-entity-number start))
(new-name (format "%s-%s" (buffer-name) cnum))
(the-buf (current-buffer))
(mother mime-preview-buffer)