-(defun nndir-close-server (&optional server)
- (setq nndir-current-server nil)
- t)
-
-(defun nndir-server-opened (&optional server)
- (and nntp-server-buffer
- (get-buffer nntp-server-buffer)
- nndir-current-server
- (equal nndir-current-server server)))
-
-(defun nndir-status-message (&optional server)
- nndir-status-string)
-
-(defun nndir-request-article (id &optional nndir-group server buffer)
- (nndir-execute-nnmh-command
- `(nnmh-request-article ,id nndir-group ,server ,buffer)))
-
-(defun nndir-request-group (nndir-group &optional server dont-check)
- (nndir-execute-nnmh-command
- `(nnmh-request-group nndir-group "" ,dont-check)))
-
-(defun nndir-request-list (&optional server dir)
- (let ((nndir-directory (concat (file-name-as-directory
- nndir-directory) "dummy")))
- (nndir-execute-nnmh-command
- `(nnmh-request-list ,(concat "nndir+" (or server "")) ,dir))))
-
-(defun nndir-request-newgroups (date &optional server)
- (nndir-execute-nnmh-command
- `(nnmh-request-newgroups ,date ,server)))
-
-(defun nndir-request-expire-articles
- (articles nndir-group &optional server force)
- (nndir-execute-nnmh-command
- `(nnmh-request-expire-articles ',articles nndir-group ,server ,force)))
-
-(defun nndir-request-accept-article (nndir-group &optional server last)
- (nndir-execute-nnmh-command
- `(nnmh-request-accept-article nndir-group ,server ,last)))
-
-(defun nndir-close-group (nndir-group &optional server)
- t)
-
-(defun nndir-request-create-group (group &optional server)
- (if (file-exists-p nndir-directory)
- (if (file-directory-p nndir-directory)
- t
- nil)
- (condition-case ()
- (progn
- (make-directory nndir-directory t)
- t)
- (file-error nil))))
-
-\f
-;;; Low-Level Interface
-
-(defun nndir-execute-nnmh-command (command)
- (let ((dir (file-name-as-directory (expand-file-name nndir-directory))))
- (if (and (not (file-directory-p nndir-group))
- (or (file-directory-p (concat dir nndir-group))
- (file-directory-p
- (concat dir (nnheader-replace-chars-in-string
- nndir-group ?. ?/)))))
- (let ((nnmh-directory nndir-directory)
- (nnmh-get-new-mail nil))
- (eval command))
- (let ((dir (directory-file-name (expand-file-name nndir-directory))))
- (string-match "/[^/]+$" dir)
- (let ((nndir-group (substring dir (1+ (match-beginning 0))))
- (nnmh-directory (substring dir 0 (1+ (match-beginning 0))))
- (nnmh-get-new-mail nil))
- (eval command))))))
-
-(defun nndir-execute-nnml-command (command)
- (let ((dir (file-name-as-directory (expand-file-name nndir-directory))))
- (if (and (not (file-directory-p nndir-group))
- (or (file-directory-p (concat dir nndir-group))
- (file-directory-p
- (concat dir (nnheader-replace-chars-in-string
- nndir-group ?. ?/)))))
- (let ((nnml-directory nndir-directory)
- (nnml-nov-is-evil nndir-nov-is-evil)
- (nnml-get-new-mail nil))
- (eval command))
- (let ((dir (directory-file-name (expand-file-name nndir-directory))))
- (string-match "/[^/]+$" dir)
- (let* ((nndir-group (substring dir (1+ (match-beginning 0))))
- (nnml-directory (substring dir 0 (1+ (match-beginning 0))))
- (nnml-nov-is-evil nndir-nov-is-evil)
- (nnml-get-new-mail nil)
- (defs `((nnml-directory ,nnml-directory)
- (nnml-nov-is-evil ,nnml-nov-is-evil)
- (nnml-get-new-mail))))
- (unless (nnml-server-opened nndir-current-server)
- (nnml-open-server nndir-current-server defs))
- (eval command))))))