tm 7.103.3.
[elisp/tm.git] / tm-ftp.el
1 ;;; tm-ftp.el --- tm-view internal method for anonymous ftp
2
3 ;; Copyright (C) 1994,1995,1996,1997 Free Software Foundation, Inc.
4
5 ;; Author: MASUTANI Yasuhiro <masutani@me.es.osaka-u.ac.jp>
6 ;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Created: 1994/11/5
8 ;; Version: $Id: tm-ftp.el,v 7.4 1997/02/01 19:32:36 morioka Exp $
9 ;; Keywords: anonymous ftp, MIME, multimedia, mail, news
10
11 ;; This file is part of tm (Tools for MIME).
12
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.
17
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.
22
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.
27
28 ;;; Code:
29
30 (require 'tm-view)
31 (require 'ange-ftp)
32
33 (defvar mime-article/dired-function
34   (if mime/use-multi-frame
35       (function dired-other-frame)
36     (function mime-article/dired-function-for-one-frame)
37     ))
38
39 (defun mime-article/dired-function-for-one-frame (dir)
40   (let ((win (or (get-buffer-window mime::article/preview-buffer)
41                  (get-largest-window))))
42     (select-window win)
43     (dired dir)
44     ))
45
46 (defun mime-article/decode-message/external-ftp (beg end cal)
47   (let* ((access-type (cdr (assoc "access-type" cal)))
48          (site (cdr (assoc "site" cal)))
49          (directory (cdr (assoc "directory" cal)))
50          (name (cdr (assoc "name" cal)))
51          (mode (cdr (assoc "mode" cal)))
52          (pathname (concat "/anonymous@" site ":" directory))
53          )
54     (message (concat "Accessing " (expand-file-name name pathname) "..."))
55     (funcall mime-article/dired-function pathname)
56     (goto-char (point-min))
57     (search-forward name)
58     ))
59
60 (set-atype 'mime/content-decoding-condition
61            '((type . "message/external-body")
62              ("access-type" . "anon-ftp")
63              (method . mime-article/decode-message/external-ftp)
64              ))
65
66
67 ;;; @ end
68 ;;;
69
70 (provide 'tm-ftp)
71
72 ;;; tm-ftp.el ends here