1 ;;; nnagent.el --- offline backend for Gnus
3 ;; Copyright (C) 1997-2011 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
6 ;; Keywords: news, mail
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 3 of the License, or
13 ;; (at your option) any later version.
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. If not, see <http://www.gnu.org/licenses/>.
29 (eval-when-compile (require 'cl))
38 (defconst nnagent-version "nnagent 1.0")
40 (defvoo nnagent-directory nil
44 (defvoo nnagent-active-file nil
48 (defvoo nnagent-newsgroups-file nil
52 (defvoo nnagent-get-new-mail nil
56 ;;; Interface functions.
58 (nnoo-define-basics nnagent)
60 (defun nnagent-server (server)
61 (and server (format "%s+%s" (car gnus-command-method) server)))
63 (deffoo nnagent-open-server (server &optional defs)
65 `((nnagent-directory ,(gnus-agent-directory))
66 (nnagent-active-file ,(gnus-agent-lib-file "active"))
67 (nnagent-newsgroups-file ,(gnus-agent-lib-file "newsgroups"))
68 (nnagent-get-new-mail nil)))
69 (nnoo-change-server 'nnagent
70 (nnagent-server server)
72 (let ((dir (gnus-agent-directory))
75 ((not (condition-case arg
77 (ftp-error (setq err (format "%s" arg)))))
78 (nnagent-close-server)
81 (format "No such file or directory: %s" dir))))
82 ((not (file-directory-p (file-truename dir)))
83 (nnagent-close-server)
84 (nnheader-report 'nnagent "Not a directory: %s" dir))
86 (nnheader-report 'nnagent "Opened server %s using directory %s"
90 (deffoo nnagent-retrieve-groups (groups &optional server)
93 ((file-exists-p (gnus-agent-lib-file "groups"))