(defmacro gnus-agent-with-fetch (&rest forms)
"Do FORMS safely."
`(unwind-protect
- (progn
+ (let ((gnus-agent-fetching t))
(gnus-agent-start-fetch)
,@forms)
(gnus-agent-stop-fetch)))
(while (search-backward "\n" nil t)
(replace-match "\\n" t t))))
+(defun gnus-agent-restore-gcc ()
+ "Restore GCC field from saved header."
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward (concat gnus-agent-gcc-header ":") nil t)
+ (replace-match "Gcc:" 'fixedcase))))
+
+(defun gnus-agent-any-covered-gcc ()
+ (save-restriction
+ (message-narrow-to-headers)
+ (let* ((gcc (mail-fetch-field "gcc" nil t))
+ (methods (and gcc
+ (mapcar 'gnus-inews-group-method
+ (message-unquote-tokens
+ (message-tokenize-header
+ gcc " ,")))))
+ covered)
+ (while (and (not covered) methods)
+ (setq covered
+ (member (car methods) gnus-agent-covered-methods)
+ methods (cdr methods)))
+ covered)))
+
+(defun gnus-agent-possibly-save-gcc ()
+ "Save GCC if Gnus is unplugged."
+ (when (and (not gnus-plugged) (gnus-agent-any-covered-gcc))
+ (save-excursion
+ (goto-char (point-min))
+ (let ((case-fold-search t))
+ (while (re-search-forward "^gcc:" nil t)
+ (replace-match (concat gnus-agent-gcc-header ":") 'fixedcase))))))
+
+(defun gnus-agent-possibly-do-gcc ()
+ "Do GCC if Gnus is plugged."
+ (when (or gnus-plugged (not (gnus-agent-any-covered-gcc)))
+ (gnus-inews-do-gcc)))
+
;;;
;;; Group mode commands
;;;
(error
(unless (funcall gnus-agent-confirmation-function
(format "Error (%s). Continue? " err))
- (error "Cannot fetch articles into the Gnus agent."))))
+ (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."))))
(pop methods))
(gnus-message 6 "Finished fetching articles into the Gnus agent"))))
(caddr category)))
;; Translate score-param into real one
(cond
+ ((not score-param))
((eq score-param 'file)
(setq score-param (gnus-all-score-files group)))
((stringp (car score-param)))