aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2004-02-16 18:06:23 +0000
committerEli Zaretskii2004-02-16 18:06:23 +0000
commit88fcbeaa953c0501848f2362fad60c2fe03f5aa4 (patch)
treeae9e6d5b575970fb0093b08fe8b61b482a3b4dfc
parentdffc4dfc5d0cffee98e8668f1be8b3ae1ed0588e (diff)
downloademacs-88fcbeaa953c0501848f2362fad60c2fe03f5aa4.tar.gz
emacs-88fcbeaa953c0501848f2362fad60c2fe03f5aa4.zip
(vm-use-spam-filter)
(rsf-min-region-length-added-to-spam-list): New variables. (rsf-bbdb-auto-delete-spam-bbdb-entries): Renamed from rmail-bbdb-auto-delete-spam-entries. Added cc: to recipients for spam testing. Don't delete spam message if automatic deletion after output via variable rmail-delete-after-output is turned on. (rsf-bbdb-dont-create-entries-for-deleted-messages): Renamed from rsf-bbdb-dont-create-entries-for-spam. (check-field): New function, extracted from code in rmail-spam-filter to ease addition of header fields like content-type. (message-content-type): New variable to check the content-type: field added, also in defcustom of rsf-definitions-alist. (rmail-spam-filter): Replace repeated test code for header fields by calls to check-field; change the call to rmail-output-to-rmail-file such that rmail-current-message stays the same to avoid wrong deletion of unseen flags. (rsf-add-contents-type): New function to convert old format of rmail-spam-definitions-alist into new one. Changed prefixes of all variables and functions from rmail-spam-filter- or spam-filter- or rmail-spam- to rsf-.
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/mail/rmail-spam-filter.el26
2 files changed, 38 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index be15fffb6e5..09d5dc617f2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,28 @@
12004-02-16 Eli Tziperman <eli@deas.harvard.edu>
2
3 * rmail-spam-filter.el: (vm-use-spam-filter)
4 (rsf-min-region-length-added-to-spam-list): New variables.
5 (rsf-bbdb-auto-delete-spam-bbdb-entries): Renamed from
6 rmail-bbdb-auto-delete-spam-entries. Added cc: to recipients for
7 spam testing. Don't delete spam message if automatic deletion
8 after output via variable rmail-delete-after-output is turned on.
9 (rsf-bbdb-dont-create-entries-for-deleted-messages): Renamed from
10 rsf-bbdb-dont-create-entries-for-spam.
11 (check-field): New function, extracted from code in
12 rmail-spam-filter to ease addition of header fields like
13 content-type.
14 (message-content-type): New variable to check the content-type:
15 field added, also in defcustom of rsf-definitions-alist.
16 (rmail-spam-filter): Replace repeated test code for header fields
17 by calls to check-field; change the call to
18 rmail-output-to-rmail-file such that rmail-current-message stays
19 the same to avoid wrong deletion of unseen
20 flags.
21 (rsf-add-contents-type): New function to convert old format
22 of rmail-spam-definitions-alist into new one.
23 Changed prefixes of all variables and functions from
24 rmail-spam-filter- or spam-filter- or rmail-spam- to rsf-.
25
12004-02-16 Eli Zaretskii <eliz@elta.co.il> 262004-02-16 Eli Zaretskii <eliz@elta.co.il>
2 27
3 * loadhist.el (unload-hook-features-list): New defvar. 28 * loadhist.el (unload-hook-features-list): New defvar.
diff --git a/lisp/mail/rmail-spam-filter.el b/lisp/mail/rmail-spam-filter.el
index b811e5991e7..f3bc0bcaa68 100644
--- a/lisp/mail/rmail-spam-filter.el
+++ b/lisp/mail/rmail-spam-filter.el
@@ -1,7 +1,7 @@
1;;; rmail-spam-filter.el --- spam filter for rmail, the emacs mail reader. 1;;; rmail-spam-filter.el --- spam filter for rmail, the emacs mail reader.
2 2
3;; Copyright (C) 2002 Free Software Foundation, Inc. 3;; Copyright (C) 2002
4 4;; Free Software Foundation, Inc.
5;; Keywords: email, spam, filter, rmail 5;; Keywords: email, spam, filter, rmail
6;; Author: Eli Tziperman <eli AT deas.harvard.edu> 6;; Author: Eli Tziperman <eli AT deas.harvard.edu>
7 7
@@ -28,7 +28,7 @@
28;;; Automatically recognize and delete junk email before it is 28;;; Automatically recognize and delete junk email before it is
29;;; displayed in rmail/rmail-summary. Spam emails are defined by 29;;; displayed in rmail/rmail-summary. Spam emails are defined by
30;;; specifying one or more of the sender, subject and contents. 30;;; specifying one or more of the sender, subject and contents.
31;;; URL: http://deas.harvard.edu/climate/eli/Downloads/rmail-spam-filter/ 31;;; URL: http://www.weizmann.ac.il/~eli/Downloads/rmail-spam-filter/
32 32
33;;; Usage: 33;;; Usage:
34;;; ------ 34;;; ------
@@ -83,7 +83,9 @@
83;;; sender's bbdb entry as well _if_ it was created at the same day. 83;;; sender's bbdb entry as well _if_ it was created at the same day.
84 84
85(require 'rmail) 85(require 'rmail)
86(require 'rmailsum) 86(if (> emacs-major-version 20)
87 (require 'rmailsum)
88 (if (not (fboundp 'rmail-make-summary-line)) (load-library "rmailsum")))
87 89
88;; For find-if and other cool common lisp functions we may want to use. 90;; For find-if and other cool common lisp functions we may want to use.
89(eval-when-compile 91(eval-when-compile
@@ -93,7 +95,6 @@
93 "Spam filter for RMAIL, the mail reader for Emacs." 95 "Spam filter for RMAIL, the mail reader for Emacs."
94 :group 'rmail) 96 :group 'rmail)
95 97
96;;;###autoload
97(defcustom rmail-use-spam-filter nil 98(defcustom rmail-use-spam-filter nil
98 "*Non-nil to activate the rmail spam filter. 99 "*Non-nil to activate the rmail spam filter.
99Specify `rsf-definitions-alist' to define what you consider spam 100Specify `rsf-definitions-alist' to define what you consider spam
@@ -214,7 +215,7 @@ for interaction with `rsf-bbdb-auto-delete-spam-entries'")
214 215
215;; the advantage over the automatic filter definitions is the AND conjunction 216;; the advantage over the automatic filter definitions is the AND conjunction
216;; of in-one-definition-elements 217;; of in-one-definition-elements
217(defun rsf-check-field (field-symbol message-data definition result) 218(defun check-field (field-symbol message-data definition result)
218 "Check if field-symbol is in `rsf-definitions-alist'. 219 "Check if field-symbol is in `rsf-definitions-alist'.
219Capture maybe-spam and this-is-a-spam-email in a cons in result, 220Capture maybe-spam and this-is-a-spam-email in a cons in result,
220where maybe-spam is in first and this-is-a-spam-email is in rest. 221where maybe-spam is in first and this-is-a-spam-email is in rest.
@@ -313,7 +314,7 @@ it from rmail file. Called for each new message retrieved by
313 this-is-a-spam-email nil)) 314 this-is-a-spam-email nil))
314 315
315 ;; maybe-spam is in first, this-is-a-spam-email in rest, this 316 ;; maybe-spam is in first, this-is-a-spam-email in rest, this
316 ;; simplifies the call to rsf-check-field 317 ;; simplifies the call to check-field
317 (setq maybe-spam (cons maybe-spam this-is-a-spam-email)) 318 (setq maybe-spam (cons maybe-spam this-is-a-spam-email))
318 319
319 ;; scan all elements of the list rsf-definitions-alist 320 ;; scan all elements of the list rsf-definitions-alist
@@ -344,18 +345,18 @@ it from rmail file. Called for each new message retrieved by
344 ;; scanned, AND if "from" field does not appear in spam 345 ;; scanned, AND if "from" field does not appear in spam
345 ;; definitions for this element, this may still be spam 346 ;; definitions for this element, this may still be spam
346 ;; due to another element... 347 ;; due to another element...
347 (rsf-check-field 'from message-sender definition maybe-spam) 348 (check-field 'from message-sender definition maybe-spam)
348 ;; next, if spam was not ruled out already, check recipients: 349 ;; next, if spam was not ruled out already, check recipients:
349 (rsf-check-field 'to message-recipients definition maybe-spam) 350 (check-field 'to message-recipients definition maybe-spam)
350 ;; next, if spam was not ruled out already, check subject: 351 ;; next, if spam was not ruled out already, check subject:
351 (rsf-check-field 'subject message-subject definition maybe-spam) 352 (check-field 'subject message-subject definition maybe-spam)
352 ;; next, if spam was not ruled out already, check content-type: 353 ;; next, if spam was not ruled out already, check content-type:
353 (rsf-check-field 'content-type message-content-type 354 (check-field 'content-type message-content-type
354 definition maybe-spam) 355 definition maybe-spam)
355 ;; next, if spam was not ruled out already, check 356 ;; next, if spam was not ruled out already, check
356 ;; contents: if contents field is not specified, this may 357 ;; contents: if contents field is not specified, this may
357 ;; still be spam due to another element... 358 ;; still be spam due to another element...
358 (rsf-check-field 'contents 359 (check-field 'contents
359 (buffer-substring 360 (buffer-substring
360 (rmail-msgbeg msg) (rmail-msgend msg)) 361 (rmail-msgbeg msg) (rmail-msgend msg))
361 definition maybe-spam) 362 definition maybe-spam)
@@ -631,5 +632,4 @@ automatically, no user input is required."
631 632
632(provide 'rmail-spam-filter) 633(provide 'rmail-spam-filter)
633 634
634;;; arch-tag: 03e1d45d-b72f-4dd7-8f04-e7fd78249746
635;;; rmail-spam-fitler ends here 635;;; rmail-spam-fitler ends here