13401
|
1 ;;; nndir.el --- single directory newsgroup access for Gnus
|
|
2 ;; Copyright (C) 1995 Free Software Foundation, Inc.
|
|
3
|
|
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
|
|
5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
|
|
6 ;; Keywords: news
|
|
7
|
|
8 ;; This file is part of GNU Emacs.
|
|
9
|
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
11 ;; it under the terms of the GNU General Public License as published by
|
|
12 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
13 ;; any later version.
|
|
14
|
|
15 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
18 ;; GNU General Public License for more details.
|
|
19
|
|
20 ;; You should have received a copy of the GNU General Public License
|
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to
|
|
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
23
|
|
24 ;;; Commentary:
|
|
25
|
|
26 ;;; Code:
|
|
27
|
|
28 (require 'nnheader)
|
|
29 (require 'nnmh)
|
|
30 (require 'nnml)
|
|
31
|
|
32 (eval-and-compile
|
|
33 (autoload 'mail-send-and-exit "sendmail"))
|
|
34
|
|
35
|
|
36
|
|
37 (defconst nndir-version "nndir 1.0")
|
|
38
|
|
39 (defvar nndir-current-directory nil
|
|
40 "Current news group directory.")
|
|
41
|
|
42 (defvar nndir-status-string "")
|
|
43
|
|
44 (defvar nndir-nov-is-evil nil
|
|
45 "*Non-nil means that nndir will never retrieve NOV headers.")
|
|
46
|
|
47
|
|
48
|
|
49 ;;; Interface functions.
|
|
50
|
|
51
|
|
52 (defun nndir-retrieve-headers (sequence &optional newsgroup server)
|
|
53 (nndir-execute-nnml-command
|
|
54 '(nnml-retrieve-headers sequence group server) server))
|
|
55
|
|
56 (defun nndir-open-server (host &optional service)
|
|
57 "Open nndir backend."
|
|
58 (setq nndir-status-string "")
|
|
59 (nnheader-init-server-buffer))
|
|
60
|
|
61 (defun nndir-close-server (&optional server)
|
|
62 "Close news server."
|
|
63 t)
|
|
64
|
|
65 (defun nndir-server-opened (&optional server)
|
|
66 "Return server process status, T or NIL.
|
|
67 If the stream is opened, return T, otherwise return NIL."
|
|
68 (and nntp-server-buffer
|
|
69 (get-buffer nntp-server-buffer)))
|
|
70
|
|
71 (defun nndir-status-message (&optional server)
|
|
72 "Return server status response as string."
|
|
73 nndir-status-string)
|
|
74
|
|
75 (defun nndir-request-article (id &optional newsgroup server buffer)
|
|
76 (nndir-execute-nnmh-command
|
|
77 '(nnmh-request-article id group server buffer) server))
|
|
78
|
|
79 (defun nndir-request-group (group &optional server dont-check)
|
|
80 "Select news GROUP."
|
|
81 (nndir-execute-nnmh-command
|
|
82 '(nnmh-request-group group "" dont-check) server))
|
|
83
|
|
84 (defun nndir-request-list (&optional server dir)
|
|
85 "Get list of active articles in all newsgroups."
|
|
86 (nndir-execute-nnmh-command
|
|
87 '(nnmh-request-list nil dir) server))
|
|
88
|
|
89 (defun nndir-request-newgroups (date &optional server)
|
|
90 (nndir-execute-nnmh-command
|
|
91 '(nnmh-request-newgroups date server) server))
|
|
92
|
|
93 (defun nndir-request-post (&optional server)
|
|
94 "Post a new news in current buffer."
|
|
95 (mail-send-and-exit nil))
|
|
96
|
|
97 (defalias 'nndir-request-post-buffer 'nnmail-request-post-buffer)
|
|
98
|
|
99 (defun nndir-request-expire-articles (articles newsgroup &optional server force)
|
|
100 "Expire all articles in the ARTICLES list in group GROUP."
|
|
101 (setq nndir-status-string "nndir: expire not possible")
|
|
102 nil)
|
|
103
|
|
104 (defun nndir-close-group (group &optional server)
|
|
105 t)
|
|
106
|
|
107 (defun nndir-request-move-article (article group server accept-form)
|
|
108 (setq nndir-status-string "nndir: move not possible")
|
|
109 nil)
|
|
110
|
|
111 (defun nndir-request-accept-article (group)
|
|
112 (setq nndir-status-string "nndir: accept not possible")
|
|
113 nil)
|
|
114
|
|
115
|
|
116 ;;; Low-Level Interface
|
|
117
|
|
118 (defun nndir-execute-nnmh-command (command server)
|
|
119 (let ((dir (expand-file-name server)))
|
|
120 (and (string-match "/$" dir)
|
|
121 (setq dir (substring dir 0 (match-beginning 0))))
|
|
122 (string-match "/[^/]+$" dir)
|
|
123 (let ((group (substring dir (1+ (match-beginning 0))))
|
|
124 (nnmh-directory (substring dir 0 (1+ (match-beginning 0))))
|
|
125 (nnmh-get-new-mail nil))
|
|
126 (eval command))))
|
|
127
|
|
128 (defun nndir-execute-nnml-command (command server)
|
|
129 (let ((dir (expand-file-name server)))
|
|
130 (and (string-match "/$" dir)
|
|
131 (setq dir (substring dir 0 (match-beginning 0))))
|
|
132 (string-match "/[^/]+$" dir)
|
|
133 (let ((group (substring dir (1+ (match-beginning 0))))
|
|
134 (nnml-directory (substring dir 0 (1+ (match-beginning 0))))
|
|
135 (nnml-nov-is-evil nndir-nov-is-evil)
|
|
136 (nnml-get-new-mail nil))
|
|
137 (eval command))))
|
|
138
|
|
139 (provide 'nndir)
|
|
140
|
|
141 ;;; nndir.el ends here
|