comparison lisp/gnus/spam.el @ 58835:9bdd97960431

Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-716 Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-74 Update from CVS 2004-12-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/message.el (message-forward-make-body-mml): Remove headers according to message-forward-ignored-headers if a message is decoded. 2004-12-02 Romain Francoise <romain@orebokech.com> * lisp/gnus/message.el (message-forward-make-body-plain): Always remove headers according to message-forward-ignored-headers. 2004-11-26 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/lpath.el: Remove bbdb-create-internal, bbdb-records, spam-BBDB-register-routine and spam-enter-ham-BBDB. * lisp/gnus/nnrss.el (nnrss-string-as-multibyte): Redefine it as a macro in order to silence the byte compiler. * lisp/gnus/pop3.el (pop3-md5): Define it before being used. * lisp/gnus/spam.el: Fix the way to silence the byte compiler, which complained about bbdb-buffer, bbdb-create-internal, bbdb-search-simple, mail-check-payment, spam-BBDB-register-routine, spam-enter-ham-BBDB, spam-stat-buffer-change-to-non-spam, spam-stat-buffer-change-to-spam, spam-stat-buffer-is-non-spam, spam-stat-buffer-is-spam, spam-stat-load, spam-stat-register-ham-routine, spam-stat-register-spam-routine, spam-stat-save and spam-stat-split-fancy. 2004-11-26 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/canlock.el (canlock-password): Remove `:size 0' or `:size 1' which may confuse users. (canlock-password-for-verify): Ditto. * lisp/gnus/deuglify.el (gnus-outlook-deuglify-unwrap-stop-chars): Ditto. * lisp/gnus/gnus-art.el (gnus-emphasis-alist): Ditto. * lisp/gnus/gnus-registry.el (gnus-registry-max-entries): Ditto. * lisp/gnus/gnus-score.el (gnus-adaptive-word-length-limit): Ditto. * lisp/gnus/gnus-start.el (gnus-save-killed-list): Ditto. * lisp/gnus/gnus-sum.el (gnus-thread-hide-subtree): Ditto. (gnus-sum-thread-tree-root): Ditto. (gnus-sum-thread-tree-false-root): Ditto. (gnus-sum-thread-tree-single-indent): Ditto. * lisp/gnus/message.el (message-courtesy-message): Ditto. (message-archive-note): Ditto. (message-subscribed-address-file): Ditto. (message-user-fqdn): Ditto. * lisp/gnus/spam-report.el (spam-report-gmane-regex): Ditto. * lisp/gnus/spam.el (spam-blackhole-good-server-regex): Ditto. 2004-11-25 Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/message.el (message-forbidden-properties): Fixed typo in doc string. 2004-11-25 Lars Magne Ingebrigtsen <larsi@gnus.org> * lisp/gnus/message.el (message-strip-forbidden-properties): Bind buffer-read-only (etc) to nil. 2004-11-25 Reiner Steib <Reiner.Steib@gmx.de> * lisp/gnus/gnus-util.el (gnus-replace-in-string): Added doc string. * lisp/gnus/nnmail.el (nnmail-split-header-length-limit): Increase to 2048 to avoid problems when splitting mails with many recipients. 2004-11-23 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/rfc2047.el (rfc2047-header-encoding-alist): Add In-Reply-To to address-mime. Suggested by ARISAWA Akihiro <ari@mbf.ocn.ne.jp>. 2004-11-22 Marek Martin <marek.martin@mum.pri.ee> (tiny change) * lisp/gnus/nnfolder.el (nnfolder-request-create-group): Save current buffer. 2004-11-22 Reiner Steib <Reiner.Steib@gmx.de> * man/message.texi (Various Message Variables): Mention that all mail file variables are derived from `message-directory'. * man/gnus.texi (Splitting Mail): Clarify bogus group. 2004-11-16 Reiner Steib <Reiner.Steib@gmx.de> * man/gnus.texi (Filtering Spam Using The Spam ELisp Package):
author Miles Bader <miles@gnu.org>
date Tue, 07 Dec 2004 21:56:42 +0000
parents a40ae7cf2194
children cf93431040c9
comparison
equal deleted inserted replaced
58834:88cf8c060c08 58835:9bdd97960431
293 :type '(repeat (string :tag "Server")) 293 :type '(repeat (string :tag "Server"))
294 :group 'spam) 294 :group 'spam)
295 295
296 (defcustom spam-blackhole-good-server-regex nil 296 (defcustom spam-blackhole-good-server-regex nil
297 "String matching IP addresses that should not be checked in the blackholes." 297 "String matching IP addresses that should not be checked in the blackholes."
298 :type '(radio (const nil) 298 :type '(radio (const nil) regexp)
299 (regexp :format "%t: %v\n" :size 0))
300 :group 'spam) 299 :group 'spam)
301 300
302 (defcustom spam-face 'gnus-splash-face 301 (defcustom spam-face 'gnus-splash-face
303 "Face for spam-marked articles." 302 "Face for spam-marked articles."
304 :type 'face 303 :type 'face
1255 (when matches 1254 (when matches
1256 spam-split-group))) 1255 spam-split-group)))
1257 1256
1258 ;;;; Hashcash. 1257 ;;;; Hashcash.
1259 1258
1259 (eval-when-compile
1260 (autoload 'mail-check-payment "hashcash"))
1261
1260 (condition-case nil 1262 (condition-case nil
1261 (progn 1263 (progn
1262 (require 'hashcash) 1264 (require 'hashcash)
1263 1265
1264 (defun spam-check-hashcash () 1266 (defun spam-check-hashcash ()
1265 "Check the headers for hashcash payments." 1267 "Check the headers for hashcash payments."
1266 (mail-check-payment))) ;mail-check-payment returns a boolean 1268 (mail-check-payment))) ;mail-check-payment returns a boolean
1267 1269
1268 (file-error (progn 1270 (file-error))
1269 (defalias 'mail-check-payment 'ignore)
1270 (defalias 'spam-check-hashcash 'ignore))))
1271 1271
1272 ;;;; BBDB 1272 ;;;; BBDB
1273 1273
1274 ;;; original idea for spam-check-BBDB from Alexander Kotelnikov 1274 ;;; original idea for spam-check-BBDB from Alexander Kotelnikov
1275 ;;; <sacha@giotto.sj.ru> 1275 ;;; <sacha@giotto.sj.ru>
1276 1276
1277 ;; all this is done inside a condition-case to trap errors 1277 ;; all this is done inside a condition-case to trap errors
1278 1278
1279 (condition-case nil 1279 (eval-when-compile
1280 (progn 1280 (autoload 'bbdb-buffer "bbdb")
1281 (require 'bbdb) 1281 (autoload 'bbdb-create-internal "bbdb")
1282 (require 'bbdb-com) 1282 (autoload 'bbdb-search-simple "bbdb"))
1283 1283
1284 (defun spam-enter-ham-BBDB (addresses &optional remove) 1284 (eval-and-compile
1285 "Enter an address into the BBDB; implies ham (non-spam) sender" 1285 (when (condition-case nil
1286 (dolist (from addresses) 1286 (progn
1287 (when (stringp from) 1287 (require 'bbdb)
1288 (let* ((parsed-address (gnus-extract-address-components from)) 1288 (require 'bbdb-com))
1289 (name (or (nth 0 parsed-address) "Ham Sender")) 1289 (file-error
1290 (remove-function (if remove 1290 (defalias 'spam-BBDB-register-routine 'ignore)
1291 'bbdb-delete-record-internal 1291 (defalias 'spam-enter-ham-BBDB 'ignore)
1292 'ignore)) 1292 nil))
1293 (net-address (nth 1 parsed-address)) 1293
1294 (record (and net-address 1294 (defun spam-enter-ham-BBDB (addresses &optional remove)
1295 (bbdb-search-simple nil net-address)))) 1295 "Enter an address into the BBDB; implies ham (non-spam) sender"
1296 (when net-address 1296 (dolist (from addresses)
1297 (gnus-message 5 "%s address %s %s BBDB" 1297 (when (stringp from)
1298 (if remove "Deleting" "Adding") 1298 (let* ((parsed-address (gnus-extract-address-components from))
1299 from 1299 (name (or (nth 0 parsed-address) "Ham Sender"))
1300 (if remove "from" "to")) 1300 (remove-function (if remove
1301 (if record 1301 'bbdb-delete-record-internal
1302 (funcall remove-function record) 1302 'ignore))
1303 (bbdb-create-internal name nil net-address nil nil 1303 (net-address (nth 1 parsed-address))
1304 "ham sender added by spam.el"))))))) 1304 (record (and net-address
1305 1305 (bbdb-search-simple nil net-address))))
1306 (defun spam-BBDB-register-routine (articles &optional unregister) 1306 (when net-address
1307 (let (addresses) 1307 (gnus-message 5 "%s address %s %s BBDB"
1308 (dolist (article articles) 1308 (if remove "Deleting" "Adding")
1309 (when (stringp (spam-fetch-field-from-fast article)) 1309 from
1310 (push (spam-fetch-field-from-fast article) addresses))) 1310 (if remove "from" "to"))
1311 ;; now do the register/unregister action 1311 (if record
1312 (spam-enter-ham-BBDB addresses unregister))) 1312 (funcall remove-function record)
1313 1313 (bbdb-create-internal name nil net-address nil nil
1314 (defun spam-BBDB-unregister-routine (articles) 1314 "ham sender added by spam.el")))))))
1315 (spam-BBDB-register-routine articles t)) 1315
1316 1316 (defun spam-BBDB-register-routine (articles &optional unregister)
1317 (defun spam-check-BBDB () 1317 (let (addresses)
1318 "Mail from people in the BBDB is classified as ham or non-spam" 1318 (dolist (article articles)
1319 (let ((who (nnmail-fetch-field "from")) 1319 (when (stringp (spam-fetch-field-from-fast article))
1320 (spam-split-group (if spam-split-symbolic-return 1320 (push (spam-fetch-field-from-fast article) addresses)))
1321 'spam 1321 ;; now do the register/unregister action
1322 spam-split-group))) 1322 (spam-enter-ham-BBDB addresses unregister)))
1323 (when who 1323
1324 (setq who (nth 1 (gnus-extract-address-components who))) 1324 (defun spam-BBDB-unregister-routine (articles)
1325 (if (bbdb-search-simple nil who) 1325 (spam-BBDB-register-routine articles t))
1326 t 1326
1327 (if spam-use-BBDB-exclusive 1327 (defun spam-check-BBDB ()
1328 spam-split-group 1328 "Mail from people in the BBDB is classified as ham or non-spam"
1329 nil)))))) 1329 (let ((who (nnmail-fetch-field "from"))
1330 1330 (spam-split-group (if spam-split-symbolic-return
1331 (file-error (progn 1331 'spam
1332 (defalias 'bbdb-search-simple 'ignore) 1332 spam-split-group)))
1333 (defalias 'spam-check-BBDB 'ignore) 1333 (when who
1334 (defalias 'spam-BBDB-register-routine 'ignore) 1334 (setq who (nth 1 (gnus-extract-address-components who)))
1335 (defalias 'spam-enter-ham-BBDB 'ignore) 1335 (if (bbdb-search-simple nil who)
1336 (defalias 'bbdb-create-internal 'ignore) 1336 t
1337 (defalias 'bbdb-delete-record-internal 'ignore) 1337 (if spam-use-BBDB-exclusive
1338 (defalias 'bbdb-records 'ignore)))) 1338 spam-split-group
1339 nil)))))))
1339 1340
1340 1341
1341 ;;;; ifile 1342 ;;;; ifile
1342 1343
1343 ;;; check the ifile backend; return nil if the mail was NOT classified 1344 ;;; check the ifile backend; return nil if the mail was NOT classified
1409 (spam-ifile-register-ham-routine articles t)) 1410 (spam-ifile-register-ham-routine articles t))
1410 1411
1411 1412
1412 ;;;; spam-stat 1413 ;;;; spam-stat
1413 1414
1414 (condition-case nil 1415 (eval-when-compile
1415 (progn 1416 (autoload 'spam-stat-buffer-change-to-non-spam "spam-stat")
1416 (let ((spam-stat-install-hooks nil)) 1417 (autoload 'spam-stat-buffer-change-to-spam "spam-stat")
1417 (require 'spam-stat)) 1418 (autoload 'spam-stat-buffer-is-non-spam "spam-stat")
1418 1419 (autoload 'spam-stat-buffer-is-spam "spam-stat")
1419 (defun spam-check-stat () 1420 (autoload 'spam-stat-load "spam-stat")
1420 "Check the spam-stat backend for the classification of this message" 1421 (autoload 'spam-stat-save "spam-stat")
1421 (let ((spam-split-group (if spam-split-symbolic-return 1422 (autoload 'spam-stat-split-fancy "spam-stat"))
1422 'spam 1423
1423 spam-split-group)) 1424 (eval-and-compile
1424 (spam-stat-split-fancy-spam-group spam-split-group) ; override 1425 (when (condition-case nil
1425 (spam-stat-buffer (buffer-name)) ; stat the current buffer 1426 (let ((spam-stat-install-hooks nil))
1426 category return) 1427 (require 'spam-stat))
1427 (spam-stat-split-fancy))) 1428 (file-error
1428 1429 (defalias 'spam-stat-register-ham-routine 'ignore)
1429 (defun spam-stat-register-spam-routine (articles &optional unregister) 1430 (defalias 'spam-stat-register-spam-routine 'ignore)
1430 (dolist (article articles) 1431 nil))
1431 (let ((article-string (spam-get-article-as-string article))) 1432
1432 (with-temp-buffer 1433 (defun spam-check-stat ()
1433 (insert article-string) 1434 "Check the spam-stat backend for the classification of this message"
1434 (if unregister 1435 (let ((spam-split-group (if spam-split-symbolic-return
1435 (spam-stat-buffer-change-to-non-spam) 1436 'spam
1437 spam-split-group))
1438 (spam-stat-split-fancy-spam-group spam-split-group) ; override
1439 (spam-stat-buffer (buffer-name)) ; stat the current buffer
1440 category return)
1441 (spam-stat-split-fancy)))
1442
1443 (defun spam-stat-register-spam-routine (articles &optional unregister)
1444 (dolist (article articles)
1445 (let ((article-string (spam-get-article-as-string article)))
1446 (with-temp-buffer
1447 (insert article-string)
1448 (if unregister
1449 (spam-stat-buffer-change-to-non-spam)
1436 (spam-stat-buffer-is-spam)))))) 1450 (spam-stat-buffer-is-spam))))))
1437 1451
1438 (defun spam-stat-unregister-spam-routine (articles) 1452 (defun spam-stat-unregister-spam-routine (articles)
1439 (spam-stat-register-spam-routine articles t)) 1453 (spam-stat-register-spam-routine articles t))
1440 1454
1441 (defun spam-stat-register-ham-routine (articles &optional unregister) 1455 (defun spam-stat-register-ham-routine (articles &optional unregister)
1442 (dolist (article articles) 1456 (dolist (article articles)
1443 (let ((article-string (spam-get-article-as-string article))) 1457 (let ((article-string (spam-get-article-as-string article)))
1444 (with-temp-buffer 1458 (with-temp-buffer
1445 (insert article-string) 1459 (insert article-string)
1446 (if unregister 1460 (if unregister
1447 (spam-stat-buffer-change-to-spam) 1461 (spam-stat-buffer-change-to-spam)
1448 (spam-stat-buffer-is-non-spam)))))) 1462 (spam-stat-buffer-is-non-spam))))))
1449 1463
1450 (defun spam-stat-unregister-ham-routine (articles) 1464 (defun spam-stat-unregister-ham-routine (articles)
1451 (spam-stat-register-ham-routine articles t)) 1465 (spam-stat-register-ham-routine articles t))
1452 1466
1453 (defun spam-maybe-spam-stat-load () 1467 (defun spam-maybe-spam-stat-load ()
1454 (when spam-use-stat (spam-stat-load))) 1468 (when spam-use-stat (spam-stat-load)))
1455 1469
1456 (defun spam-maybe-spam-stat-save () 1470 (defun spam-maybe-spam-stat-save ()
1457 (when spam-use-stat (spam-stat-save)))) 1471 (when spam-use-stat (spam-stat-save)))))
1458
1459 (file-error (progn
1460 (defalias 'spam-stat-load 'ignore)
1461 (defalias 'spam-stat-save 'ignore)
1462 (defalias 'spam-maybe-spam-stat-load 'ignore)
1463 (defalias 'spam-maybe-spam-stat-save 'ignore)
1464 (defalias 'spam-stat-register-ham-routine 'ignore)
1465 (defalias 'spam-stat-unregister-ham-routine 'ignore)
1466 (defalias 'spam-stat-register-spam-routine 'ignore)
1467 (defalias 'spam-stat-unregister-spam-routine 'ignore)
1468 (defalias 'spam-stat-buffer-is-spam 'ignore)
1469 (defalias 'spam-stat-buffer-change-to-spam 'ignore)
1470 (defalias 'spam-stat-buffer-is-non-spam 'ignore)
1471 (defalias 'spam-stat-buffer-change-to-non-spam 'ignore)
1472 (defalias 'spam-stat-split-fancy 'ignore)
1473 (defalias 'spam-check-stat 'ignore))))
1474 1472
1475 1473
1476 1474
1477 ;;;; Blacklists and whitelists. 1475 ;;;; Blacklists and whitelists.
1478 1476