+2004-09-25 Kevin Greiner <kgreiner@compsol.cc>
+
+ * gnus-agent.el (gnus-agent-possibly-synchronize-flags): Ignore
+ servers that are offline. Avoids having gnus-agent-toggle-plugged
+ first ask if you want to open a server and then, even when you
+ responded with no, asking if you want to synchronize the server's
+ flags.
+ (gnus-agent-synchronize-flags-server): Rewrote read loop to handle
+ multi-line expressions.
+ (gnus-agent-synchronize-group-flags): New internal function.
+ Updates marks in memory (in the info structure) AND in the
+ backend.
+
+ * gnus-util.el (gnus-remassoc): Fixed typo in documentation.
+
+ * nnagent.el (nnagent-request-set-mark): Use
+ gnus-agent-synchronize-group-flags, not backend's request-set-mark
+ method, to ensure that synchronization updates marks in the
+ backend and in the info (in memory) structure.
+
2004-09-24 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-uu.el (gnus-uu-digest-mail-forward): Obey the process/prefix
(interactive)
(save-excursion
(dolist (gnus-command-method (gnus-agent-covered-methods))
- (when (file-exists-p (gnus-agent-lib-file "flags"))
+ (when (and (file-exists-p (gnus-agent-lib-file "flags"))
+ (not (eq (gnus-server-status gnus-command-method) 'offline)))
(gnus-agent-possibly-synchronize-flags-server gnus-command-method)))))
(defun gnus-agent-synchronize-flags-server (method)
(gnus-message
1 "Couldn't open server %s" (nth 1 gnus-command-method)))
(t
- (while (not (eobp))
- (if (null (eval (read (current-buffer))))
- (gnus-delete-line)
- (write-file (gnus-agent-lib-file "flags"))
- (error "Couldn't set flags from file %s"
- (gnus-agent-lib-file "flags"))))
- (delete-file (gnus-agent-lib-file "flags"))))
+ (condition-case err
+ (while t
+ (let ((bgn (point)))
+ (eval (read (current-buffer)))
+ (delete-region bgn (point))))
+ (end-of-file
+ (delete-file (gnus-agent-lib-file "flags")))
+ (error
+ (let ((file (gnus-agent-lib-file "flags")))
+ (write-file file)
+ (error "Couldn't set flags from file %s due to %s"
+ file (error-message-string err)))))))
(kill-buffer nil))))
(defun gnus-agent-possibly-synchronize-flags-server (method)
;;; Internal functions
;;;
+(defun gnus-agent-synchronize-group-flags (group action server)
+"Update a plugged group by performing the indicated action."
+ (let* ((gnus-command-method (gnus-server-to-method server))
+ (info (gnus-get-info group)))
+ (gnus-request-set-mark group action)
+
+ (when info
+ (gnus-request-update-info info gnus-command-method))
+ nil))
+
(defun gnus-agent-save-active (method)
(when (gnus-agent-method-p method)
(let* ((gnus-command-method method)
"Delete by side effect any elements of LIST whose car is `equal' to KEY.
The modified LIST is returned. If the first member
of LIST has a car that is `equal' to KEY, there is no way to remove it
-by side effect; therefore, write `(setq foo (remassoc key foo))' to be
+by side effect; therefore, write `(setq foo (gnus-remassoc key foo))' to be
sure of changing the value of `foo'."
(when alist
(if (equal key (caar alist))
(deffoo nnagent-request-set-mark (group action server)
(with-temp-buffer
- (insert (format "(%s-request-set-mark \"%s\" '%s \"%s\")\n"
- (nth 0 gnus-command-method) group action
- (or server (nth 1 gnus-command-method))))
+ (insert "(gnus-agent-synchronize-group-flags \""
+ group
+ "\" '")
+ (gnus-pp action)
+ (insert " \""
+ (gnus-method-to-server gnus-command-method)
+ "\"")
+ (insert ")\n")
(append-to-file (point-min) (point-max) (gnus-agent-lib-file "flags")))
nil)