(spam-mark-spam-as-expired-and-move-routine): Return the
authorTSUCHIYA Masatoshi <tsuchiya@namazu.org>
Thu, 20 May 2004 16:13:40 +0000 (16:13 +0000)
committerTSUCHIYA Masatoshi <tsuchiya@namazu.org>
Thu, 20 May 2004 16:13:40 +0000 (16:13 +0000)
number of processed spam messages.
(spam-ham-copy-or-move-routine): Return the number of processed
ham messages.
(spam-summary-prepare-exit): Use the above values to decide
whether status messages shouled be displayed.

lisp/ChangeLog
lisp/spam.el

index f2e3f4c..a3c4ba4 100644 (file)
@@ -1,3 +1,12 @@
+2004-05-20  TSUCHIYA Masatoshi  <tsuchiya@namazu.org>
+
+       * spam.el (spam-mark-spam-as-expired-and-move-routine): Return the
+       number of processed spam messages.
+       (spam-ham-copy-or-move-routine): Return the number of processed
+       ham messages.
+       (spam-summary-prepare-exit): Use the above values to decide
+       whether status messages shouled be displayed.
+
 2004-05-20  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * rfc2047.el (rfc2047-encode-function-alist): Renamed from
index b19899e..07c3651 100644 (file)
@@ -847,7 +847,7 @@ Will not return a nil score."
            ;; call spam-register-routine with specific articles to unregister,
            ;; when there are articles to unregister and the check is enabled
            (when (and unregister-list (symbol-value check))
-             (spam-register-routine 
+             (spam-register-routine
               classification check t unregister-list))))))
 
     ;; find all the spam processors applicable to this group
@@ -861,22 +861,21 @@ Will not return a nil score."
 
     (unless (and spam-move-spam-nonspam-groups-only
                 (spam-group-spam-contents-p gnus-newsgroup-name))
-      (when (< 0 (length (spam-list-articles
-                         gnus-newsgroup-articles
-                         'spam)))
-       (gnus-message 6 "Marking spam as expired and moving it to %s"
-                     (gnus-parameter-spam-process-destination 
-                      gnus-newsgroup-name))
-       (spam-mark-spam-as-expired-and-move-routine
-        (gnus-parameter-spam-process-destination gnus-newsgroup-name))))
+      (let* ((group (gnus-parameter-spam-process-destination
+                    gnus-newsgroup-name))
+            (num (spam-mark-spam-as-expired-and-move-routine group)))
+       (when (> num 0)
+         (gnus-message 6
+                       "%d spam messages are marked as expired and moved it to %s"
+                       num group))))
 
     ;; now we redo spam-mark-spam-as-expired-and-move-routine to only
     ;; expire spam, in case the above did not expire them
-    (when (< 0 (length (spam-list-articles
-                       gnus-newsgroup-articles
-                       'spam)))
-      (gnus-message 6 "Marking spam as expired without moving it")
-      (spam-mark-spam-as-expired-and-move-routine nil))
+    (let ((num (spam-mark-spam-as-expired-and-move-routine nil)))
+      (when (> num 0)
+       (gnus-message 6
+                     "%d spam messages are markd as expired without moving it"
+                     num)))
 
     (when (or (spam-group-ham-contents-p gnus-newsgroup-name)
              (and (spam-group-spam-contents-p gnus-newsgroup-name)
@@ -891,19 +890,20 @@ Will not return a nil score."
                     (spam-group-processor-p gnus-newsgroup-name processor))
            (spam-register-routine classification check)))))
 
-    (when (< 0 (length (spam-list-articles
-                       gnus-newsgroup-articles
-                       'ham)))
-      (when (spam-group-ham-processor-copy-p gnus-newsgroup-name)
-       (gnus-message 6 "Copying ham")
-       (spam-ham-copy-routine
-        (gnus-parameter-ham-process-destination gnus-newsgroup-name)))
-
-      ;; now move all ham articles out of spam groups
-      (when (spam-group-spam-contents-p gnus-newsgroup-name)
-       (gnus-message 6 "Moving ham messages from spam group")
-       (spam-ham-move-routine
-        (gnus-parameter-ham-process-destination gnus-newsgroup-name)))))
+    (when (spam-group-ham-processor-copy-p gnus-newsgroup-name)
+      (let ((num
+            (spam-ham-copy-routine
+             (gnus-parameter-ham-process-destination gnus-newsgroup-name))))
+       (when (> num 0)
+         (gnus-message 6 "%d ham messages are copied" num))))
+
+    ;; now move all ham articles out of spam groups
+    (when (spam-group-spam-contents-p gnus-newsgroup-name)
+      (let ((num
+            (spam-ham-move-routine
+             (gnus-parameter-ham-process-destination gnus-newsgroup-name))))
+       (when (> num 0)
+         (gnus-message 6 "%d ham messages are moved from spam group" num)))))
 
   (setq spam-old-ham-articles nil)
   (setq spam-old-spam-articles nil))
@@ -973,7 +973,8 @@ When either list is nil, the other is returned."
          (let ((gnus-novice-user nil)) ; don't ask me if I'm sure
            (gnus-summary-delete-article nil))))
 
-      (gnus-summary-yank-process-mark))))
+      (gnus-summary-yank-process-mark)
+      (length tomove))))
 
 (defun spam-ham-copy-or-move-routine (copy groups)
   (gnus-summary-kill-process-mark)
@@ -1017,9 +1018,10 @@ When either list is nil, the other is returned."
          (gnus-summary-set-process-mark article))
        (when todo
          (let ((gnus-novice-user nil)) ; don't ask me if I'm sure
-           (gnus-summary-delete-article nil))))))
+           (gnus-summary-delete-article nil)))))
 
-  (gnus-summary-yank-process-mark))
+    (gnus-summary-yank-process-mark)
+    (length todo)))
 
 (defun spam-ham-copy-routine (&rest groups)
   (if (and (car-safe groups) (listp (car-safe groups)))