]> git.eshelyaron.com Git - emacs.git/commitdiff
(rmail-get-new-mail): Integrate the rmail spam filter into rmail.
authorPaul Reilly <pmr@pajato.com>
Fri, 21 Feb 2003 18:44:45 +0000 (18:44 +0000)
committerPaul Reilly <pmr@pajato.com>
Fri, 21 Feb 2003 18:44:45 +0000 (18:44 +0000)
lisp/mail/rmail.el

index cec69a39e7c6e6ab37043156ad7e58d363a31754..9a22176a6a9209690d3a636e3bb0a2b444d8c0ff 100644 (file)
@@ -1490,9 +1490,30 @@ It returns t if it got any new messages."
                (setq current-message (rmail-first-unseen-message))
                (if (rmail-summary-exists)
                    (with-current-buffer rmail-summary-buffer
-                      (rmail-update-summary)
+                      (rmail-update-summary)))
+
+                ;; Process the new messages for spam using the
+                ;; integrated spam filter.  The spam filter can mark
+                ;; messages for deletion and can output a message.
+                (if rmail-use-spam-filter
+                    ;; Loop through the new messages processing each
+                    ;; message for spam.
+                    (save-excursion
+                      (while (<= current-message rmail-total-messages)
+                        (narrow-to-region
+                         (rmail-desc-get-start current-message)
+                         (rmail-desc-get-end current-message))
+                        (rmail-spam-filter current-message)
+                        (setq current-message (1+ current-message)))))
+          
+                ;; Position the mail cursor again.
+               (setq current-message (rmail-first-unseen-message))
+               (if (rmail-summary-exists)
+                   (with-current-buffer rmail-summary-buffer
                       (rmail-summary-goto-msg current-message))
                   (rmail-show-message current-message))
+
+                ;; Run the after get new mail hook.
                (run-hooks 'rmail-after-get-new-mail-hook)
                (message "%d new message%s read"
                         new-messages (if (= 1 new-messages) "" "s"))