Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / gnus-int.el
index 330b300..fc8fc33 100644 (file)
@@ -398,6 +398,7 @@ If BUFFER, insert the article in that group."
           (gnus-cache-request-article article group))
       (setq res (cons group article)
            clean-up t))
+     ;; Check the agent cache.
      ((and gnus-agent gnus-agent-cache gnus-plugged
           (numberp article)
           (gnus-agent-request-article article group))
@@ -484,17 +485,26 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned."
             info (nth 1 gnus-command-method))))
 
 (defun gnus-request-expire-articles (articles group &optional force)
-  (let ((gnus-command-method (gnus-find-method-for-group group)))
-    (funcall (gnus-get-function gnus-command-method 'request-expire-articles)
-            articles (gnus-group-real-name group) (nth 1 gnus-command-method)
-            force)))
-
-(defun gnus-request-move-article
-  (article group server accept-function &optional last)
-  (let ((gnus-command-method (gnus-find-method-for-group group)))
-    (funcall (gnus-get-function gnus-command-method 'request-move-article)
-            article (gnus-group-real-name group)
-            (nth 1 gnus-command-method) accept-function last)))
+  (let* ((gnus-command-method (gnus-find-method-for-group group))
+        (not-deleted
+         (funcall
+          (gnus-get-function gnus-command-method 'request-expire-articles)
+          articles (gnus-group-real-name group) (nth 1 gnus-command-method)
+          force)))
+    (when (and gnus-agent gnus-agent-cache
+              (gnus-sorted-difference articles not-deleted))
+      (gnus-agent-expire (gnus-sorted-difference articles not-deleted)
+                        group 'force))
+    not-deleted))
+
+(defun gnus-request-move-article (article group server accept-function &optional last)
+  (let* ((gnus-command-method (gnus-find-method-for-group group))
+        (result (funcall (gnus-get-function gnus-command-method 'request-move-article)
+                         article (gnus-group-real-name group)
+                         (nth 1 gnus-command-method) accept-function last)))
+    (when (and result gnus-agent gnus-agent-cache)
+      (gnus-agent-expire (list article) group 'force))
+    result))
 
 (defun gnus-request-accept-article (group &optional gnus-command-method last
                                          no-encode)