;;; gnus-agent.el --- unplugged support for Semi-gnus
-;; Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1998, 1999, 2000, 2001
+;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Tatsuya Ichikawa <t-ichi@po.shiojiri.ne.jp>
(require 'timer))
(require 'gnus-group))
+(eval-and-compile
+ (autoload 'gnus-server-update-server "gnus-srvr"))
+
(defcustom gnus-agent-directory (nnheader-concat gnus-directory "agent/")
"Where the Gnus agent will store its files."
:group 'gnus-agent
:group 'gnus-agent
:type 'hook)
+;; Extracted from gnus-xmas-redefine in order to preserve user settings
+(when (featurep 'xemacs)
+ (add-hook 'gnus-agent-group-mode-hook 'gnus-xmas-agent-group-menu-add))
+
(defcustom gnus-agent-summary-mode-hook nil
"Hook run in Agent summary minor modes."
:group 'gnus-agent
:type 'hook)
+;; Extracted from gnus-xmas-redefine in order to preserve user settings
+(when (featurep 'xemacs)
+ (add-hook 'gnus-agent-summary-mode-hook 'gnus-xmas-agent-summary-menu-add))
+
(defcustom gnus-agent-server-mode-hook nil
"Hook run in Agent summary minor modes."
:group 'gnus-agent
:type 'hook)
+;; Extracted from gnus-xmas-redefine in order to preserve user settings
+(when (featurep 'xemacs)
+ (add-hook 'gnus-agent-server-mode-hook 'gnus-xmas-agent-server-menu-add))
+
(defcustom gnus-agent-confirmation-function 'y-or-n-p
"Function to confirm when error happens."
:version "21.1"
\(gnus-agentize)
-This will modify the `gnus-before-startup-hook', `gnus-post-method',
-and `message-send-mail-function' variables, and install the Gnus
-agent minor mode in all Gnus buffers."
+This will modify the `gnus-setup-news-hook', and
+`message-send-mail-real-function' variables, and install the Gnus agent
+minor mode in all Gnus buffers."
(interactive)
(gnus-open-agent)
(add-hook 'gnus-setup-news-hook 'gnus-agent-queue-setup)
(unless gnus-agent-send-mail-function
- (setq gnus-agent-send-mail-function message-send-mail-function
- message-send-mail-function 'gnus-agent-send-mail))
+ (setq gnus-agent-send-mail-function (or
+ message-send-mail-real-function
+ message-send-mail-function)
+ message-send-mail-real-function 'gnus-agent-send-mail))
(unless gnus-agent-covered-methods
(setq gnus-agent-covered-methods (list gnus-select-method))))
(when (member method gnus-agent-covered-methods)
(error "Server already in the agent program"))
(push method gnus-agent-covered-methods)
+ (gnus-server-update-server server)
(gnus-agent-write-servers)
(message "Entered %s into the Agent" server)))
(error "Server not in the agent program"))
(setq gnus-agent-covered-methods
(delete method gnus-agent-covered-methods))
+ (gnus-server-update-server server)
(gnus-agent-write-servers)
(message "Removed %s from the agent" server)))
(gnus-agent-method-p gnus-command-method))
(gnus-agent-load-alist gnus-newsgroup-name)
;; First mark all undownloaded articles as undownloaded.
- (let ((articles (append gnus-newsgroup-unreads
- gnus-newsgroup-marked
- gnus-newsgroup-dormant))
- article)
- (while (setq article (pop articles))
- (unless (or (cdr (assq article gnus-agent-article-alist))
- (memq article gnus-newsgroup-downloadable)
- (memq article gnus-newsgroup-cached))
- (push article gnus-newsgroup-undownloaded))))
+ (dolist (article (mapcar (lambda (header) (mail-header-number header))
+ gnus-newsgroup-headers))
+ (unless (or (cdr (assq article gnus-agent-article-alist))
+ (memq article gnus-newsgroup-downloadable)
+ (memq article gnus-newsgroup-cached))
+ (push article gnus-newsgroup-undownloaded)))
;; Then mark downloaded downloadable as not-downloadable,
;; if you get my drift.
- (let ((articles gnus-newsgroup-downloadable)
- article)
- (while (setq article (pop articles))
- (when (cdr (assq article gnus-agent-article-alist))
- (setq gnus-newsgroup-downloadable
- (delq article gnus-newsgroup-downloadable))))))))
+ (dolist (article gnus-newsgroup-downloadable)
+ (when (cdr (assq article gnus-agent-article-alist))
+ (setq gnus-newsgroup-downloadable
+ (delq article gnus-newsgroup-downloadable)))))))
(defun gnus-agent-catchup ()
"Mark all undownloaded articles as read."
(defun gnus-agent-save-alist (group &optional articles state dir)
"Save the article-state alist for GROUP."
(let ((file-name-coding-system nnmail-pathname-coding-system)
- (pathname-coding-system nnmail-pathname-coding-system))
+ (pathname-coding-system nnmail-pathname-coding-system)
+ print-level print-length)
(with-temp-file (if dir
(expand-file-name ".agentview" dir)
(gnus-agent-article-name ".agentview" group))
(error
(unless (funcall gnus-agent-confirmation-function
(format "Error (%s). Continue? " err))
- (error "Cannot fetch articles into the Gnus agent.")))
- (quit
+ (error "Cannot fetch articles into the Gnus agent")))
+ (quit
(unless (funcall gnus-agent-confirmation-function
- (format "Quit (%s). Continue? " err))
- (signal 'quit "Cannot fetch articles into the Gnus agent."))))
+ (format "Quit fetching session (%s). Continue? "
+ err))
+ (signal 'quit "Cannot fetch articles into the Gnus agent"))))
(pop methods))
(gnus-message 6 "Finished fetching articles into the Gnus agent"))))
(if (numberp fetch-date)
(> fetch-date day)
;; History file is corrupted.
- (gnus-message
- 5
+ (gnus-message
+ 5
(format "File %s is corrupted!"
(gnus-agent-lib-file "history")))
(sit-for 1)