(require 'gnus-range)
(autoload 'gnus-agent-expire "gnus-agent")
+(autoload 'gnus-agent-regenerate-group "gnus-agent")
(autoload 'gnus-agent-read-servers-validate-native "gnus-agent")
(defcustom gnus-open-server-hook nil
`denied', set the server denied; `offline', set the server offline;
nil, ask user. If the server is not covered by Gnus agent, set the
server denied."
+ :version "21.4"
:group 'gnus-start
:type '(choice (const :tag "Ask" nil)
(const :tag "Deny server" denied)
(const :tag "Unplug Agent" offline)))
+(defcustom gnus-servers-that-use-local-marks '(nntp)
+ "A list of backends that store marks locally. This means that
+ the backend is used to set its marks even when unplugged."
+ :version "21.4"
+ :group 'gnus-start
+ :type '(repeat symbol))
+
(defvar gnus-internal-registry-spool-current-method nil
"The current method, for the registry.")
;; Read server name with completion.
(setq gnus-nntp-server
(completing-read "NNTP server: "
- (mapcar (lambda (server) (list server))
+ (mapcar 'list
(cons (list gnus-nntp-server)
gnus-secondary-servers))
nil nil gnus-nntp-server)))
(setq method (gnus-server-to-method method)))
;; Check cache of constructed names.
(let* ((method-sym (if gnus-agent
- (gnus-agent-get-function method)
+ (inline (gnus-agent-get-function method))
(car method)))
(method-fns (get method-sym 'gnus-method-functions))
(func (let ((method-fnlist-elt (assq function method-fns)))
(when (stringp gnus-command-method)
(setq gnus-command-method
(inline (gnus-server-to-method gnus-command-method))))
- (funcall (inline (gnus-get-function gnus-command-method 'request-group))
+ (funcall (inline (gnus-get-function gnus-command-method 'request-group))
(gnus-group-real-name group) (nth 1 gnus-command-method)
dont-check)))
(defun gnus-request-set-mark (group action)
"Set marks on articles in the back end."
- (let ((gnus-command-method (gnus-find-method-for-group group)))
+ (let* ((gnus-command-method (gnus-find-method-for-group group))
+ (gnus-plugged (or gnus-plugged
+ (member (car gnus-command-method)
+ gnus-servers-that-use-local-marks))))
(if (not (gnus-check-backend-function
'request-set-mark (car gnus-command-method)))
action
(defun gnus-request-update-mark (group article mark)
"Allow the back end to change the mark the user tries to put on an article."
- (let ((gnus-command-method (gnus-find-method-for-group group)))
+ (let* ((gnus-command-method (gnus-find-method-for-group group))
+ (gnus-plugged (or gnus-plugged
+ (member (car gnus-command-method)
+ gnus-servers-that-use-local-marks))))
(if (not (gnus-check-backend-function
'request-update-mark (car gnus-command-method)))
mark
(nth 1 gnus-command-method) accept-function last)))
(when (and result gnus-agent
(gnus-agent-method-p gnus-command-method))
- (gnus-agent-expire (list article) group 'force))
+ (gnus-agent-unfetch-articles group (list article)))
result))
(defun gnus-request-accept-article (group &optional gnus-command-method last
(insert "\n"))
(let ((gnus-command-method (or gnus-command-method
(gnus-find-method-for-group group)))
- (result (funcall (gnus-get-function gnus-command-method 'request-accept-article)
- (if (stringp group) (gnus-group-real-name group) group)
- (cadr gnus-command-method)
- last)))
+ (result
+ (funcall
+ (gnus-get-function gnus-command-method 'request-accept-article)
+ (if (stringp group) (gnus-group-real-name group) group)
+ (cadr gnus-command-method)
+ last)))
(when (and gnus-agent (gnus-agent-method-p gnus-command-method))
(gnus-agent-regenerate-group group (list (cdr result))))
result))
(gnus-group-real-name group) (nth 1 gnus-command-method) args)))
(defun gnus-request-delete-group (group &optional force)
- (let ((gnus-command-method (gnus-find-method-for-group group)))
- (funcall (gnus-get-function gnus-command-method 'request-delete-group)
- (gnus-group-real-name group) force (nth 1 gnus-command-method))))
+ (let* ((gnus-command-method (gnus-find-method-for-group group))
+ (result
+ (funcall (gnus-get-function gnus-command-method 'request-delete-group)
+ (gnus-group-real-name group) force (nth 1 gnus-command-method))))
+ (when result
+ (gnus-cache-delete-group group)
+ (gnus-agent-delete-group group))
+ result))
(defun gnus-request-rename-group (group new-name)
- (let ((gnus-command-method (gnus-find-method-for-group group)))
- (funcall (gnus-get-function gnus-command-method 'request-rename-group)
- (gnus-group-real-name group)
- (gnus-group-real-name new-name) (nth 1 gnus-command-method))))
+ (let* ((gnus-command-method (gnus-find-method-for-group group))
+ (result
+ (funcall (gnus-get-function gnus-command-method 'request-rename-group)
+ (gnus-group-real-name group)
+ (gnus-group-real-name new-name) (nth 1 gnus-command-method))))
+ (when result
+ (gnus-cache-rename-group group new-name)
+ (gnus-agent-rename-group group new-name))
+ result))
(defun gnus-close-backends ()
;; Send a close request to all backends that support such a request.