4 ;;; Grabbing all MIME "message/partial"s.
5 ;;; by Yasuo OKABE @ Kyoto University 1994
6 ;;; modified by MORIOKA Tomohiko
9 ;;; gif.el written by Art Mellor @ Cayman Systems, Inc. 1991
11 ;;; This file is a part of tm (Tools for MIME).
13 ;;; $Id: tm-partial.el,v 7.9 1995/10/23 09:27:29 morioka Exp $
18 (defvar tm-partial/preview-article-method-alist nil)
20 ;; display Article at the cursor in Subject buffer.
21 (defun tm-partial/preview-article (target)
22 (let ((f (assq target tm-partial/preview-article-method-alist)))
25 (error "Fatal. Unsupported mode")
28 (defun mime-article/grab-message/partials (beg end cal)
30 (let* ((id (cdr (assoc "id" cal)))
31 (buffer (generate-new-buffer id))
32 (mother mime::article/preview-buffer)
33 (target (cdr (assq 'major-mode cal)))
34 (article-buffer (buffer-name (current-buffer)))
35 (subject-buf (eval (cdr (assq 'summary-buffer-exp cal))))
37 (root-dir (expand-file-name
38 (concat "m-prts-" (user-login-name)) mime/tmp-dir))
40 (setq root-dir (concat root-dir "/" (replace-as-filename id)))
41 (setq full-file (concat root-dir "/FULL"))
44 (error "%s is not supported. Sorry." target)
47 ;; if you can't parse the subject line, try simple decoding method
48 (if (or (file-exists-p full-file)
49 (not (y-or-n-p "Merge partials?"))
53 (mime-article/decode-message/partial beg end cal)
55 (let (cinfo the-id parameters)
56 (setq subject-id (rfc822/get-field-body "Subject"))
57 (if (string-match "[0-9]+" subject-id)
58 (setq subject-id (substring subject-id 0 (match-beginning 0)))
60 (pop-to-buffer subject-buf)
61 (while (search-backward subject-id nil t)
65 (tm-partial/preview-article target)
66 (pop-to-buffer article-buffer)
67 (switch-to-buffer mime::article/preview-buffer)
69 (mime::preview-content-info/content-info
70 (car mime::preview/content-list)))
71 (setq parameters (mime::content-info/parameters cinfo))
72 (setq the-id (assoc-value "id" parameters))
75 (switch-to-buffer article-buffer)
76 (mime-article/decode-message/partial
77 (point-min)(point-max) parameters)
78 (if (file-exists-p full-file)
83 (pop-to-buffer subject-buf)
85 (search-forward subject-id nil t)
97 (run-hooks 'tm-partial-load-hook)