Require 'cl first.
[elisp/semi.git] / mime-partial.el
index f1c5220..9401a89 100644 (file)
@@ -1,14 +1,12 @@
 ;;; 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.4 1997-03-15 20:29:25 morioka 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)
-   
+(defvar mime-view-partial-message-method-alist nil
+  "Alist major-mode vs. function to view partial message for mime-partial.")
+
 ;; display Article at the cursor in Subject buffer.
-(defun mime-partial/preview-article (target)
+(defsubst mime-view-partial-message (target)
   (save-window-excursion
-    (let ((f (assq target mime-partial/preview-article-method-alist)))
+    (let ((f (assq target mime-view-partial-message-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 cal)
+  "Internal method for mime-view to combine message/partial messages
+automatically.  This function refers variable
+`mime-view-partial-message-method-alist' to select function to display
+partial messages using mime-view."
   (interactive)
   (let* ((id (cdr (assoc "id" cal)))
         (target (cdr (assq 'major-mode cal)))
@@ -62,8 +65,8 @@
     (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)
+       (mime-store-message/partial-piece entity cal)
+      (let (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)))
          (while (search-backward subject-id nil t))
          (catch 'tag
            (while t
-             (mime-partial/preview-article target)
+             (mime-view-partial-message 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 parameters (mime-entity-parameters entity))
              (setq the-id (cdr (assoc "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)
-                     )
-                   ))
+             (when (string= the-id id)
+               (mime-store-message/partial-piece entity parameters)
+               (if (file-exists-p full-file)
+                   (throw 'tag nil)
+                 ))
              (if (not (progn
                         (set-buffer subject-buf)
                         (end-of-line)