1 ;;; mime-partial.el --- Grabbing all MIME "message/partial"s.
3 ;; Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
5 ;; Author: OKABE Yasuo @ Kyoto University
6 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Keywords: message/partial, MIME, multimedia, mail, news
9 ;; This file is part of SEMI (Suite of Emacs MIME Interfaces).
11 ;; This program is free software; you can redistribute it and/or
12 ;; modify it under the terms of the GNU General Public License as
13 ;; published by the Free Software Foundation; either version 2, or (at
14 ;; your option) any later version.
16 ;; This program is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
31 (defvar mime-view-partial-message-method-alist nil
32 "Alist major-mode vs. function to view partial message for mime-partial.")
34 ;; display Article at the cursor in Subject buffer.
35 (defsubst mime-view-partial-message (target)
36 (save-window-excursion
37 (let ((f (assq target mime-view-partial-message-method-alist)))
40 (error "Fatal. Unsupported mode")
43 (defun mime-method-to-combine-message/partial-pieces (beg end cal)
44 "Internal method for mime-view to combine message/partial messages
45 automatically. This function refers variable
46 `mime-view-partial-message-method-alist' to select function to display
47 partial messages using mime-view."
49 (let* ((id (cdr (assoc "id" cal)))
50 (target (cdr (assq 'major-mode cal)))
51 (article-buffer (buffer-name (current-buffer)))
52 (subject-buf (eval (cdr (assq 'summary-buffer-exp cal))))
54 (root-dir (expand-file-name
55 (concat "m-prts-" (user-login-name)) mime-temp-directory))
57 (setq root-dir (concat root-dir "/" (replace-as-filename id)))
58 (setq full-file (concat root-dir "/FULL"))
61 (error "%s is not supported. Sorry." target)
64 ;; if you can't parse the subject line, try simple decoding method
65 (if (or (file-exists-p full-file)
66 (not (y-or-n-p "Merge partials?"))
68 (mime-method-to-store-message/partial beg end cal)
69 (let (the-id parameters)
70 (setq subject-id (std11-field-body "Subject"))
71 (if (string-match "[0-9\n]+" subject-id)
72 (setq subject-id (substring subject-id 0 (match-beginning 0)))
75 (set-buffer subject-buf)
76 (while (search-backward subject-id nil t))
79 (mime-view-partial-message target)
80 (set-buffer article-buffer)
82 (mime-entity-parameters mime-raw-message-info))
83 (setq the-id (cdr (assoc "id" parameters)))
84 (if (string= the-id id)
86 (mime-method-to-store-message/partial
87 (mime-entity-point-min mime-raw-message-info)
88 (mime-entity-point-max mime-raw-message-info)
90 (if (file-exists-p full-file)
95 (set-buffer subject-buf)
97 (search-forward subject-id nil t)
108 (provide 'mime-partial)
110 (run-hooks 'mime-partial-load-hook)
112 ;;; mime-partial.el ends here