1 ;;; nndir.el --- single directory newsgroup access for Gnus
3 ;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
6 ;; Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU 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.
35 (autoload 'mail-send-and-exit
"sendmail"))
39 (defconst nndir-version
"nndir 1.0")
41 (defvar nndir-current-directory nil
42 "Current news group directory.")
44 (defvar nndir-status-string
"")
46 (defvar nndir-nov-is-evil nil
47 "*Non-nil means that nndir will never retrieve NOV headers.")
51 ;;; Interface functions.
54 (defun nndir-retrieve-headers (sequence &optional newsgroup server
)
55 (nndir-execute-nnml-command
56 '(nnml-retrieve-headers sequence group server
) server
))
58 (defun nndir-open-server (host &optional service
)
60 (setq nndir-status-string
"")
61 (nnheader-init-server-buffer))
63 (defun nndir-close-server (&optional server
)
67 (defun nndir-server-opened (&optional server
)
68 "Return server process status, T or NIL.
69 If the stream is opened, return T, otherwise return NIL."
70 (and nntp-server-buffer
71 (get-buffer nntp-server-buffer
)))
73 (defun nndir-status-message (&optional server
)
74 "Return server status response as string."
77 (defun nndir-request-article (id &optional newsgroup server buffer
)
78 (nndir-execute-nnmh-command
79 '(nnmh-request-article id group server buffer
) server
))
81 (defun nndir-request-group (group &optional server dont-check
)
83 (nndir-execute-nnmh-command
84 '(nnmh-request-group group
"" dont-check
) server
))
86 (defun nndir-request-list (&optional server dir
)
87 "Get list of active articles in all newsgroups."
88 (nndir-execute-nnmh-command
89 '(nnmh-request-list nil dir
) server
))
91 (defun nndir-request-newgroups (date &optional server
)
92 (nndir-execute-nnmh-command
93 '(nnmh-request-newgroups date server
) server
))
95 (defun nndir-request-post (&optional server
)
96 "Post a new news in current buffer."
97 (mail-send-and-exit nil
))
99 (defalias 'nndir-request-post-buffer
'nnmail-request-post-buffer
)
101 (defun nndir-request-expire-articles (articles newsgroup
&optional server force
)
102 "Expire all articles in the ARTICLES list in group GROUP."
103 (setq nndir-status-string
"nndir: expire not possible")
106 (defun nndir-close-group (group &optional server
)
109 (defun nndir-request-move-article (article group server accept-form
)
110 (setq nndir-status-string
"nndir: move not possible")
113 (defun nndir-request-accept-article (group)
114 (setq nndir-status-string
"nndir: accept not possible")
118 ;;; Low-Level Interface
120 (defun nndir-execute-nnmh-command (command server
)
121 (let ((dir (expand-file-name server
)))
122 (and (string-match "/$" dir
)
123 (setq dir
(substring dir
0 (match-beginning 0))))
124 (string-match "/[^/]+$" dir
)
125 (let ((group (substring dir
(1+ (match-beginning 0))))
126 (nnmh-directory (substring dir
0 (1+ (match-beginning 0))))
127 (nnmh-get-new-mail nil
))
130 (defun nndir-execute-nnml-command (command server
)
131 (let ((dir (expand-file-name server
)))
132 (and (string-match "/$" dir
)
133 (setq dir
(substring dir
0 (match-beginning 0))))
134 (string-match "/[^/]+$" dir
)
135 (let ((group (substring dir
(1+ (match-beginning 0))))
136 (nnml-directory (substring dir
0 (1+ (match-beginning 0))))
137 (nnml-nov-is-evil nndir-nov-is-evil
)
138 (nnml-get-new-mail nil
))
143 ;;; nndir.el ends here