1 ;;; tm-partial.el --- Grabbing all MIME "message/partial"s.
3 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
5 ;; Author: OKABE Yasuo @ Kyoto University
6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; $Id: tm-partial.el,v 7.15 1997/02/01 18:01:25 morioka Exp $
9 ;; Keywords: mail, news, MIME, multimedia, message/partial
11 ;; This file is a part of tm (Tools for MIME).
13 ;; This program is free software; you can redistribute it and/or
14 ;; modify it under the terms of the GNU General Public License as
15 ;; published by the Free Software Foundation; either version 2, or (at
16 ;; your option) any later version.
18 ;; This program is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
33 (defvar tm-partial/preview-article-method-alist nil)
35 ;; display Article at the cursor in Subject buffer.
36 (defun tm-partial/preview-article (target)
37 (save-window-excursion
38 (let ((f (assq target tm-partial/preview-article-method-alist)))
41 (error "Fatal. Unsupported mode")
44 (defun mime-article/grab-message/partials (beg end cal)
46 (let* ((id (cdr (assoc "id" cal)))
47 (mother mime::article/preview-buffer)
48 (target (cdr (assq 'major-mode cal)))
49 (article-buffer (buffer-name (current-buffer)))
50 (subject-buf (eval (cdr (assq 'summary-buffer-exp cal))))
52 (root-dir (expand-file-name
53 (concat "m-prts-" (user-login-name)) mime/tmp-dir))
55 (setq root-dir (concat root-dir "/" (replace-as-filename id)))
56 (setq full-file (concat root-dir "/FULL"))
59 (error "%s is not supported. Sorry." target)
62 ;; if you can't parse the subject line, try simple decoding method
63 (if (or (file-exists-p full-file)
64 (not (y-or-n-p "Merge partials?"))
66 (mime-article/decode-message/partial beg end cal)
67 (let (cinfo the-id parameters)
68 (setq subject-id (std11-field-body "Subject"))
69 (if (string-match "[0-9\n]+" subject-id)
70 (setq subject-id (substring subject-id 0 (match-beginning 0)))
73 (set-buffer subject-buf)
74 (while (search-backward subject-id nil t))
77 (tm-partial/preview-article target)
78 (set-buffer article-buffer)
79 (set-buffer mime::article/preview-buffer)
81 (mime::preview-content-info/content-info
82 (car mime::preview/content-list)))
83 (setq parameters (mime::content-info/parameters cinfo))
84 (setq the-id (assoc-value "id" parameters))
87 (set-buffer article-buffer)
88 (mime-article/decode-message/partial
89 (point-min)(point-max) parameters)
90 (if (file-exists-p full-file)
95 (set-buffer subject-buf)
97 (search-forward subject-id nil t)
108 (provide 'tm-partial)
110 (run-hooks 'tm-partial-load-hook)
112 ;;; tm-partial.el ends here