2 ;;; tm-partial.el --- Grabbing all MIME "message/partial"s.
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1994 OKABE Yasuo
6 ;;; Copyright (C) 1995 MORIOKA Tomohiko
8 ;;; Author: OKABE Yasuo @ Kyoto University
9 ;;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
11 ;;; $Id: tm-partial.el,v 7.10 1995/10/25 05:25:28 morioka Exp $
12 ;;; Keywords: mail, news, MIME, multimedia, message/partial
14 ;;; This file is a part of tm (Tools for MIME).
19 (defvar tm-partial/preview-article-method-alist nil)
21 ;; display Article at the cursor in Subject buffer.
22 (defun tm-partial/preview-article (target)
23 (let ((f (assq target tm-partial/preview-article-method-alist)))
26 (error "Fatal. Unsupported mode")
29 (defun mime-article/grab-message/partials (beg end cal)
31 (let* ((id (cdr (assoc "id" cal)))
32 (buffer (generate-new-buffer id))
33 (mother mime::article/preview-buffer)
34 (target (cdr (assq 'major-mode cal)))
35 (article-buffer (buffer-name (current-buffer)))
36 (subject-buf (eval (cdr (assq 'summary-buffer-exp cal))))
38 (root-dir (expand-file-name
39 (concat "m-prts-" (user-login-name)) mime/tmp-dir))
41 (setq root-dir (concat root-dir "/" (replace-as-filename id)))
42 (setq full-file (concat root-dir "/FULL"))
45 (error "%s is not supported. Sorry." target)
48 ;; if you can't parse the subject line, try simple decoding method
49 (if (or (file-exists-p full-file)
50 (not (y-or-n-p "Merge partials?"))
54 (mime-article/decode-message/partial beg end cal)
56 (let (cinfo the-id parameters)
57 (setq subject-id (rfc822/get-field-body "Subject"))
58 (if (string-match "[0-9\n]+" subject-id)
59 (setq subject-id (substring subject-id 0 (match-beginning 0)))
61 (pop-to-buffer subject-buf)
62 (while (search-backward subject-id nil t)
66 (tm-partial/preview-article target)
67 (pop-to-buffer article-buffer)
68 (switch-to-buffer mime::article/preview-buffer)
70 (mime::preview-content-info/content-info
71 (car mime::preview/content-list)))
72 (setq parameters (mime::content-info/parameters cinfo))
73 (setq the-id (assoc-value "id" parameters))
76 (switch-to-buffer article-buffer)
77 (mime-article/decode-message/partial
78 (point-min)(point-max) parameters)
79 (if (file-exists-p full-file)
84 (pop-to-buffer subject-buf)
86 (search-forward subject-id nil t)
98 (run-hooks 'tm-partial-load-hook)