;;; mime-partial.el --- Grabbing all MIME "message/partial"s.
-;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
;; Author: OKABE Yasuo @ Kyoto University
;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version:
-;; $Id: mime-partial.el,v 0.1 1997-02-21 05:29:13 tmorioka Exp $
;; Keywords: message/partial, MIME, multimedia, mail, news
-;; This file is part of SEMI (SEMI is Emacs MIME Interfaces).
+;; This file is part of SEMI (Suite of Emacs MIME Interfaces).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
(require 'mime-view)
(require 'mime-play)
-(defvar mime-partial/preview-article-method-alist nil)
-
-;; display Article at the cursor in Subject buffer.
-(defun mime-partial/preview-article (target)
- (save-window-excursion
- (let ((f (assq target mime-partial/preview-article-method-alist)))
- (if f
- (funcall (cdr f))
- (error "Fatal. Unsupported mode")
- ))))
-
-(defun mime-article/grab-message/partials (beg end cal)
+(defun mime-combine-message/partial-pieces-automatically (entity situation)
+ "Internal method for mime-view to combine message/partial messages
+automatically."
(interactive)
- (let* ((id (cdr (assoc "id" cal)))
- (mother mime::article/preview-buffer)
- (target (cdr (assq 'major-mode cal)))
- (article-buffer (buffer-name (current-buffer)))
- (subject-buf (eval (cdr (assq 'summary-buffer-exp cal))))
+ (let* ((id (cdr (assoc "id" situation)))
+ (target (cdr (assq 'major-mode situation)))
+ (subject-buf (eval (cdr (assq 'summary-buffer-exp situation))))
+ (mother (current-buffer))
subject-id
(root-dir (expand-file-name
- (concat "m-prts-" (user-login-name)) mime/tmp-dir))
+ (concat "m-prts-" (user-login-name))
+ temporary-file-directory))
+ (request-partial-message-method
+ (cdr (assq 'request-partial-message-method situation)))
full-file)
(setq root-dir (concat root-dir "/" (replace-as-filename id)))
(setq full-file (concat root-dir "/FULL"))
(if (or (file-exists-p full-file)
(not (y-or-n-p "Merge partials?"))
)
- (mime-article/decode-message/partial beg end cal)
- (let (cinfo the-id parameters)
- (setq subject-id (std11-field-body "Subject"))
- (if (string-match "[0-9\n]+" subject-id)
- (setq subject-id (substring subject-id 0 (match-beginning 0)))
- )
- (save-excursion
- (set-buffer subject-buf)
- (while (search-backward subject-id nil t))
- (catch 'tag
- (while t
- (mime-partial/preview-article target)
- (set-buffer article-buffer)
- (set-buffer mime::article/preview-buffer)
- (setq cinfo
- (mime::preview-content-info/content-info
- (car mime::preview/content-list)))
- (setq parameters (mime::content-info/parameters cinfo))
- (setq the-id (assoc-value "id" parameters))
- (if (equal the-id id)
- (progn
- (set-buffer article-buffer)
- (mime-article/decode-message/partial
- (point-min)(point-max) parameters)
- (if (file-exists-p full-file)
- (throw 'tag nil)
- )
- ))
+ (mime-store-message/partial-piece entity situation)
+ (setq subject-id (mime-entity-read-field entity 'Subject))
+ (if (string-match "[0-9\n]+" subject-id)
+ (setq subject-id (substring subject-id 0 (match-beginning 0)))
+ )
+ (save-excursion
+ (set-buffer subject-buf)
+ (while (search-backward subject-id nil t))
+ (catch 'tag
+ (while t
+ (let* ((message
+ ;; request message at the cursor in Subject buffer.
+ (save-window-excursion
+ (funcall request-partial-message-method)
+ ))
+ (situation (mime-entity-situation message))
+ (the-id (cdr (assoc "id" situation))))
+ (when (string= the-id id)
+ (with-current-buffer mother
+ (mime-store-message/partial-piece message situation)
+ )
+ (if (file-exists-p full-file)
+ (throw 'tag nil)
+ ))
(if (not (progn
- (set-buffer subject-buf)
(end-of-line)
(search-forward subject-id nil t)
))
(error "not found")
)
- )
- ))))))
+ ))
+ )))))
;;; @ end