* gnus-agent.el (gnus-agent-synchronize-group-flags): Fixed typo in preceeding check-in.
[gnus] / lisp / gnus-agent.el
index 91d947e..e0f628a 100644 (file)
@@ -114,7 +114,7 @@ If nil, only read articles will be expired."
   :group 'gnus-agent
   :type 'function)
 
-(defcustom gnus-agent-synchronize-flags 'ask
+(defcustom gnus-agent-synchronize-flags nil
   "Indicate if flags are synchronized when you plug in.
 If this is `ask' the hook will query the user."
   :version "21.1"
@@ -847,7 +847,8 @@ be a select method."
                (delete-file (gnus-agent-lib-file "flags")))
               (error
                (let ((file (gnus-agent-lib-file "flags")))
-                 (write-file file)
+                 (write-region (point-min) (point-max)
+                               (gnus-agent-lib-file "flags") nil 'silent)
                  (error "Couldn't set flags from file %s due to %s"
                         file (error-message-string err)))))))
       (kill-buffer nil))))
@@ -1208,9 +1209,16 @@ This can be added to `gnus-select-article-hook' or
 (defun gnus-agent-synchronize-group-flags (group actions server)
 "Update a plugged group by performing the indicated actions."
   (let* ((gnus-command-method (gnus-server-to-method server))
-        (info (or (gnus-get-info group)
-                  (gnus-get-info (gnus-group-full-name 
-                                  group gnus-command-method)))))
+        (info
+         ;; This initializer is required as gnus-request-set-mark
+         ;; calls gnus-group-real-name to strip off the host name
+         ;; before calling the backend.  Now that the backend is
+         ;; trying to call gnus-request-set-mark, I have to
+         ;; reconstruct the original group name.
+         (or (gnus-get-info group)
+             (gnus-get-info 
+              (setq group (gnus-group-full-name 
+                           group gnus-command-method))))))
     (gnus-request-set-mark group actions)
 
     (when info
@@ -1218,17 +1226,27 @@ This can be added to `gnus-select-article-hook' or
        (let ((range (nth 0 action))
              (what  (nth 1 action))
              (marks (nth 2 action)))
-         (when (memq 'read marks)
-           (gnus-info-set-read 
-            info
-            (funcall (if (eq what 'add)
-                         'gnus-range-add
-                       'gnus-remove-from-range)
-                     (gnus-info-read info)
-                     range))
-           (gnus-get-unread-articles-in-group 
-            info
-            (gnus-active (gnus-info-group info)))))))
+         (dolist (mark marks)
+           (cond ((eq mark 'read)
+                  (gnus-info-set-read 
+                   info
+                   (funcall (if (eq what 'add)
+                                'gnus-range-add
+                              'gnus-remove-from-range)
+                            (gnus-info-read info)
+                            range))
+                  (gnus-get-unread-articles-in-group 
+                   info
+                   (gnus-active (gnus-info-group info))))
+                 ((memq mark '(tick))
+                  (let ((info-marks (assoc mark (gnus-info-marks info))))
+                    (unless info-marks
+                      (gnus-info-set-marks info (cons (setq info-marks (list mark)) (gnus-info-marks info))))
+                    (setcdr info-marks (funcall (if (eq what 'add)
+                                 'gnus-range-add
+                               'gnus-remove-from-range)
+                             (cdr info-marks)
+                             range)))))))))
     nil))
 
 (defun gnus-agent-save-active (method)