emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rmail-spam-filter.el: also match


From: Bastien Guerry
Subject: rmail-spam-filter.el: also match
Date: Wed, 13 Feb 2008 01:00:13 +0000
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

Someone on help-gnu-emacs asked whether RMAIL could check for the
spamassassion spam headers and keep possible spam in a separate 
folder for later double-check.

Eli pointed on rmail-spam-filter.el, but currently it doesn't let the
user request a check on the X-Spam-Status header.

The patch below fix this.

If no objection, I will apply it tomorrow.

--- rmail-spam-filter.el.~1.19.~        2008-01-08 20:45:08.000000000 +0000
+++ rmail-spam-filter.el        2008-02-13 00:53:32.000000000 +0000
@@ -201,6 +201,9 @@
           (cons :format "%v" :value (contents . "")
                 (const :format ""  contents)
                 (string :tag "Contents"  ""))
+          (cons :format "%v" :value (x-spam-status . "")
+                (const :format ""  x-spam-status)
+                (string :tag "X-Spam-Status"  ""))
           (cons :format "%v" :value (action . output-and-delete)
                 (const :format "" action)
                 (choice :tag "Action selection"
@@ -284,6 +287,7 @@
                            (concat ", " (mail-fetch-field "Cc")))))
          (setq message-subject (mail-fetch-field "Subject"))
          (setq message-content-type (mail-fetch-field "Content-Type"))
+         (setq message-spam-status (mail-fetch-field "X-Spam-Status"))
          )
        ;; Find number of spam-definition elements in the list
        ;; rsf-definitions-alist specified by user:
@@ -363,6 +367,11 @@
                           (rmail-msgbeg msg) (rmail-msgend msg))
                          definition maybe-spam)
 
+           ;; finally, check the X-Spam-Status header.  You will typically
+           ;; look for the "Yes" string in this header field
+           (check-field 'x-spam-status message-spam-status
+                        definition maybe-spam)
+
            ;; if the search in rsf-definitions-alist found
            ;; that this email is spam, output the email to the spam
            ;; rmail file, mark the email for deletion, leave the
-- 
Bastien

reply via email to

[Prev in Thread] Current Thread [Next in Thread]