1 ;;; nndir.el --- single directory newsgroup access for Gnus
2 ;; Copyright (C) 1995 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
5 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
8 ;; This file is part of GNU Emacs.
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)
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.
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.
33 (autoload 'mail-send-and-exit
"sendmail"))
37 (defconst nndir-version
"nndir 1.0")
39 (defvar nndir-current-directory nil
40 "Current news group directory.")
42 (defvar nndir-status-string
"")
44 (defvar nndir-nov-is-evil nil
45 "*Non-nil means that nndir will never retrieve NOV headers.")
49 ;;; Interface functions.
52 (defun nndir-retrieve-headers (sequence &optional newsgroup server
)
53 (nndir-execute-nnml-command
54 '(nnml-retrieve-headers sequence group server
) server
))
56 (defun nndir-open-server (host &optional service
)
58 (setq nndir-status-string
"")
59 (nnheader-init-server-buffer))
61 (defun nndir-close-server (&optional server
)
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
)))
71 (defun nndir-status-message (&optional server
)
72 "Return server status response as string."
75 (defun nndir-request-article (id &optional newsgroup server buffer
)
76 (nndir-execute-nnmh-command
77 '(nnmh-request-article id group server buffer
) server
))
79 (defun nndir-request-group (group &optional server dont-check
)
81 (nndir-execute-nnmh-command
82 '(nnmh-request-group group
"" dont-check
) server
))
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
))
89 (defun nndir-request-newgroups (date &optional server
)
90 (nndir-execute-nnmh-command
91 '(nnmh-request-newgroups date server
) server
))
93 (defun nndir-request-post (&optional server
)
94 "Post a new news in current buffer."
95 (mail-send-and-exit nil
))
97 (defalias 'nndir-request-post-buffer
'nnmail-request-post-buffer
)
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")
104 (defun nndir-close-group (group &optional server
)
107 (defun nndir-request-move-article (article group server accept-form
)
108 (setq nndir-status-string
"nndir: move not possible")
111 (defun nndir-request-accept-article (group)
112 (setq nndir-status-string
"nndir: accept not possible")
116 ;;; Low-Level Interface
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
))
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
))
141 ;;; nndir.el ends here