1 ;;; nnagent.el --- offline backend for Gnus
3 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
4 ;; Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Keywords: news, mail
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.
32 (eval-when-compile (require 'cl))
41 (defconst nnagent-version "nnagent 1.0")
43 (defvoo nnagent-directory nil
47 (defvoo nnagent-active-file nil
51 (defvoo nnagent-newsgroups-file nil
55 (defvoo nnagent-get-new-mail nil
59 ;;; Interface functions.
61 (nnoo-define-basics nnagent)
63 (defun nnagent-server (server)
64 (and server (format "%s+%s" (car gnus-command-method) server)))
66 (deffoo nnagent-open-server (server &optional defs)
68 `((nnagent-directory ,(gnus-agent-directory))
69 (nnagent-active-file ,(gnus-agent-lib-file "active"))
70 (nnagent-newsgroups-file ,(gnus-agent-lib-file "newsgroups"))
71 (nnagent-get-new-mail nil)))
72 (nnoo-change-server 'nnagent
73 (nnagent-server server)
75 (let ((dir (gnus-agent-directory))
78 ((not (condition-case arg
80 (ftp-error (setq err (format "%s" arg)))))
81 (nnagent-close-server)
84 (format "No such file or directory: %s" dir))))
85 ((not (file-directory-p (file-truename dir)))
86 (nnagent-close-server)
87 (nnheader-report 'nnagent "Not a directory: %s" dir))
89 (nnheader-report 'nnagent "Opened server %s using directory %s"
93 (deffoo nnagent-retrieve-groups (groups &optional server)