Synch to No Gnus 200409290324.
[elisp/gnus.git-] / lisp / gnus-agent.el
index 020ae83..b4b46e9 100644 (file)
@@ -1217,14 +1217,30 @@ This can be added to `gnus-select-article-hook' or
 ;;; Internal functions
 ;;;
 
-(defun gnus-agent-synchronize-group-flags (group action server)
-"Update a plugged group by performing the indicated action."
+(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 (gnus-get-info group)))
-    (gnus-request-set-mark group action)
+        (info (or (gnus-get-info group)
+                  (gnus-get-info (gnus-group-full-name 
+                                  group gnus-command-method)))))
+    (gnus-request-set-mark group actions)
 
     (when info
-      (gnus-request-update-info info gnus-command-method))
+      (dolist (action actions)
+       (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)))))))
     nil))
 
 (defun gnus-agent-save-active (method)
@@ -1657,7 +1673,7 @@ and that there are no duplicates."
                   (setq backed-up (gnus-agent-backup-overview-buffer)))
               (gnus-message 1
                            "Duplicate overview line for %d" cur)
-             (delete-region (point) (progn (forward-line 1) (point))))
+             (delete-region p (progn (forward-line 1) (point))))
             ((< cur prev-num)
              (or backed-up
                   (setq backed-up (gnus-agent-backup-overview-buffer)))