1 ;;; nnagent.el --- offline backend for Gnus
2 ;; Copyright (C) 1997,98 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
5 ;; Keywords: news, mail
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
39 (defconst nnagent-version "nnagent 1.0")
41 (defvoo nnagent-directory nil
45 (defvoo nnagent-active-file nil
49 (defvoo nnagent-newsgroups-file nil
53 (defvoo nnagent-get-new-mail nil
57 ;;; Interface functions.
59 (nnoo-define-basics nnagent)
61 (deffoo nnagent-open-server (server &optional defs)
63 `((nnagent-directory ,(gnus-agent-directory))
64 (nnagent-active-file ,(gnus-agent-lib-file "active"))
65 (nnagent-newsgroups-file ,(gnus-agent-lib-file "newsgroups"))
66 (nnagent-get-new-mail nil)))
67 (nnoo-change-server 'nnagent server defs)
68 (let ((dir (gnus-agent-directory))
71 ((not (condition-case arg
73 (ftp-error (setq err (format "%s" arg)))))
74 (nnagent-close-server)
76 'nnagent (or err "No such file or directory: %s" dir)))
77 ((not (file-directory-p (file-truename dir)))
78 (nnagent-close-server)
79 (nnheader-report 'nnagent "Not a directory: %s" dir))
81 (nnheader-report 'nnagent "Opened server %s using directory %s"
85 (deffoo nnagent-retrieve-groups (groups &optional server)
88 ((file-exists-p (gnus-agent-lib-file "groups"))
89 (nnmail-find-file (gnus-agent-lib-file "groups"))
91 ((file-exists-p (gnus-agent-lib-file "active"))
92 (nnmail-find-file (gnus-agent-lib-file "active"))
96 (defun nnagent-request-type (group article)
97 (let ((gnus-plugged t))
98 (if (not (gnus-check-backend-function
99 'request-type (car gnus-command-method)))
101 (funcall (gnus-get-function gnus-command-method 'request-type)
102 (gnus-group-real-name group) article))))
104 (deffoo nnagent-request-newgroups (date server)
107 (deffoo nnagent-request-update-info (group info &optional server)
110 (deffoo nnagent-request-post (&optional server)
111 (gnus-request-accept-article "nndraft:queue"))
113 ;; Use nnml functions for just about everything.
118 ;;; Internal functions.
122 ;;; nnagent.el ends here