Synch to No Gnus 200411282151.
[elisp/gnus.git-] / lisp / gnus-agent.el
index 35424d3..b018bb6 100644 (file)
@@ -171,6 +171,7 @@ read articles as they would just be downloaded again."
   "Chunk size for `gnus-agent-fetch-session'.
 The function will split its article fetches into chunks smaller than
 this limit."
+  :version "21.4"
   :group 'gnus-agent
   :type 'integer)
 
@@ -181,6 +182,7 @@ contents from a group's local storage.  This value may be overridden
 to disable expiration in specific categories, topics, and groups.  Of
 course, you could change gnus-agent-enable-expiration to DISABLE then
 enable expiration per categories, topics, and groups."
+  :version "21.4"
   :group 'gnus-agent
   :type '(radio (const :format "Enable " ENABLE)
                 (const :format "Disable " DISABLE)))
@@ -206,6 +208,7 @@ See Info node `(gnus)Server Buffer'."
   "Whether and when outgoing mail should be queued by the agent.
 When `always', always queue outgoing mail.  When nil, never
 queue.  Otherwise, queue if and only if unplugged."
+  :version "21.4"
   :group 'gnus-agent
   :type '(radio (const :format "Always" always)
                (const :format "Never" nil)
@@ -214,6 +217,7 @@ queue.  Otherwise, queue if and only if unplugged."
 (defcustom gnus-agent-prompt-send-queue nil
   "If non-nil, `gnus-group-send-queue' will prompt if called when
 unplugged."
+  :version "21.4"
   :group 'gnus-agent
   :type 'boolean)
 
@@ -1221,9 +1225,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
@@ -1231,17 +1242,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)
@@ -3904,7 +3925,7 @@ entry of article %s deleted." l1))
                             gnus-agent-article-alist))))
 
        (when regenerated
-           (gnus-agent-update-files-total-fetched-for group nil)))
+         (gnus-agent-update-files-total-fetched-for group nil)))
 
       (gnus-message 5 "")
       regenerated)))