1;;; nndir.el --- single directory newsgroup access for Gnus 2 3;; Copyright (C) 1995-2021 Free Software Foundation, Inc. 4 5;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 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 3 of the License, or 13;; (at your option) 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. If not, see <https://www.gnu.org/licenses/>. 22 23;;; Commentary: 24 25;;; Code: 26 27(require 'nnheader) 28(require 'nnmh) 29(require 'nnml) 30(require 'nnoo) 31 32(nnoo-declare nndir 33 nnml nnmh) 34 35(defvoo nndir-directory nil 36 "Where nndir will look for groups." 37 nnml-current-directory nnmh-current-directory) 38 39(defvoo nndir-nov-is-evil nil 40 "Non-nil means that nndir will never retrieve NOV headers." 41 nnml-nov-is-evil) 42 43 44 45(defvoo nndir-current-group "" nil nnml-current-group nnmh-current-group) 46(defvoo nndir-top-directory nil nil nnml-directory nnmh-directory) 47(defvoo nndir-get-new-mail nil nil nnml-get-new-mail nnmh-get-new-mail) 48 49(defvoo nndir-status-string "" nil nnmh-status-string) 50(defconst nndir-version "nndir 1.0") 51 52 53 54;;; Interface functions. 55 56(nnoo-define-basics nndir) 57 58(deffoo nndir-open-server (server &optional defs) 59 (setq nndir-directory 60 (or (cadr (assq 'nndir-directory defs)) 61 server)) 62 (unless (assq 'nndir-directory defs) 63 (push `(nndir-directory ,server) defs)) 64 (push `(nndir-current-group 65 ,(file-name-nondirectory (directory-file-name nndir-directory))) 66 defs) 67 (push `(nndir-top-directory 68 ,(file-name-directory (directory-file-name nndir-directory))) 69 defs) 70 (nnoo-change-server 'nndir server defs) 71 (let (err) 72 (cond 73 ((not (condition-case arg 74 (file-exists-p nndir-directory) 75 (ftp-error (setq err (format "%s" arg))))) 76 (nndir-close-server) 77 (nnheader-report 78 'nndir (or err "No such file or directory: %s" nndir-directory))) 79 ((not (file-directory-p (file-truename nndir-directory))) 80 (nndir-close-server) 81 (nnheader-report 'nndir "Not a directory: %s" nndir-directory)) 82 (t 83 (nnheader-report 'nndir "Opened server %s using directory %s" 84 server nndir-directory) 85 t)))) 86 87(nnoo-map-functions nndir 88 (nnml-retrieve-headers 0 nndir-current-group 0 0) 89 (nnml-request-article 0 nndir-current-group 0 0) 90 (nnmh-request-group nndir-current-group 0 0) 91 (nnml-close-group nndir-current-group 0) 92 (nnml-request-list (nnoo-current-server 'nndir))) 93 94(provide 'nndir) 95 96;;; nndir.el ends here 97