1 ;;; nnagent.el --- offline backend for Gnus
2 ;; Copyright (C) 1997,98 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
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.
30 (eval-when-compile (require 'cl))
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)
77 (format "No such file or directory: %s" dir))))
78 ((not (file-directory-p (file-truename dir)))
79 (nnagent-close-server)
80 (nnheader-report 'nnagent "Not a directory: %s" dir))
82 (nnheader-report 'nnagent "Opened server %s using directory %s"
86 (deffoo nnagent-retrieve-groups (groups &optional server)
89 ((file-exists-p (gnus-agent-lib-file "groups"))
90 (nnmail-find-file (gnus-agent-lib-file "groups"))
92 ((file-exists-p (gnus-agent-lib-file "active"))
93 (nnmail-find-file (gnus-agent-lib-file "active"))
97 (defun nnagent-request-type (group article)
98 (unless (stringp article)
99 (let ((gnus-plugged t))
100 (if (not (gnus-check-backend-function
101 'request-type (car gnus-command-method)))
103 (funcall (gnus-get-function gnus-command-method 'request-type)
104 (gnus-group-real-name group) article)))))
106 (deffoo nnagent-request-newgroups (date server)
109 (deffoo nnagent-request-update-info (group info &optional server)
112 (deffoo nnagent-request-post (&optional server)
113 (gnus-agent-insert-meta-information 'news gnus-command-method)
114 (gnus-request-accept-article "nndraft:queue"))
116 ;; Use nnml functions for just about everything.
121 ;;; Internal functions.
125 ;;; nnagent.el ends here