Bind RET and TAB on images for better UX.
[gnus] / lisp / spam.el
index 5c2f9c8..d079be2 100644 (file)
@@ -1,6 +1,7 @@
 ;;; spam.el --- Identifying spam
 
 ;;; spam.el --- Identifying spam
 
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;;   Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
 
 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Maintainer: Ted Zlatanov <tzz@lifelogs.com>
@@ -8,20 +9,18 @@
 
 ;; This file is part of GNU Emacs.
 
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 
 ;;; Commentary:
 
 
 ;;{{{ compilation directives and autoloads/requires
 
 
 ;;{{{ compilation directives and autoloads/requires
 
+;; For Emacs < 22.2.
+(eval-and-compile
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+
 (eval-when-compile (require 'cl))
 (eval-when-compile (require 'cl))
-(eval-when-compile (require 'spam-report))
-(eval-when-compile (require 'hashcash))
 
 
+(require 'message)             ;for the message-fetch-field functions
 (require 'gnus-sum)
 (require 'gnus-sum)
-
 (require 'gnus-uu)                     ; because of key prefix issues
 ;;; for the definitions of group content classification and spam processors
 (require 'gnus)
 (require 'gnus-uu)                     ; because of key prefix issues
 ;;; for the definitions of group content classification and spam processors
 (require 'gnus)
-(require 'message)             ;for the message-fetch-field functions
+
+(eval-when-compile (require 'spam-report))
+(eval-when-compile (require 'hashcash))
 
 ;; for nnimap-split-download-body-default
 (eval-when-compile (require 'nnimap))
 
 ;; autoload query-dig
 
 ;; for nnimap-split-download-body-default
 (eval-when-compile (require 'nnimap))
 
 ;; autoload query-dig
-(eval-and-compile
-  (autoload 'query-dig "dig"))
+(autoload 'query-dig "dig")
 
 ;; autoload spam-report
 (eval-and-compile
 
 ;; autoload spam-report
 (eval-and-compile
   (autoload 'spam-report-resend "spam-report"))
 
 ;; autoload gnus-registry
   (autoload 'spam-report-resend "spam-report"))
 
 ;; autoload gnus-registry
-(eval-and-compile
-  (autoload 'gnus-registry-group-count "gnus-registry")
-  (autoload 'gnus-registry-add-group "gnus-registry")
-  (autoload 'gnus-registry-store-extra-entry "gnus-registry")
-  (autoload 'gnus-registry-fetch-extra "gnus-registry"))
+(autoload 'gnus-registry-group-count "gnus-registry")
+(autoload 'gnus-registry-add-group "gnus-registry")
+(autoload 'gnus-registry-store-extra-entry "gnus-registry")
+(autoload 'gnus-registry-fetch-extra "gnus-registry")
 
 
-;; autoload query-dns
-(eval-and-compile
-  (autoload 'query-dns "dns"))
+;; autoload dns-query
+(autoload 'dns-query "dns")
 
 ;;}}}
 
 ;;{{{ Main parameters.
 (defvar spam-backends nil
   "List of spam.el backends with all the pertinent data.
 
 ;;}}}
 
 ;;{{{ Main parameters.
 (defvar spam-backends nil
   "List of spam.el backends with all the pertinent data.
-Populated by spam-install-backend-super.")
+Populated by `spam-install-backend-super'.")
 
 (defgroup spam nil
   "Spam configuration."
 
 (defgroup spam nil
   "Spam configuration."
@@ -91,13 +91,13 @@ Populated by spam-install-backend-super.")
 
 (defcustom spam-summary-exit-behavior 'default
   "Exit behavior at the time of summary exit.
 
 (defcustom spam-summary-exit-behavior 'default
   "Exit behavior at the time of summary exit.
-Note that setting the spam-use-move or spam-use-copy backends on
+Note that setting the `spam-use-move' or `spam-use-copy' backends on
 a group through group/topic parameters overrides this mechanism."
 a group through group/topic parameters overrides this mechanism."
-  :type '(choice (const 'default :tag 
+  :type '(choice (const 'default :tag
                        "Move spam out of all groups.  Move ham out of spam groups.")
                        "Move spam out of all groups.  Move ham out of spam groups.")
-                (const 'move-all :tag 
+                (const 'move-all :tag
                        "Move spam out of all groups.  Move ham out of all groups.")
                        "Move spam out of all groups.  Move ham out of all groups.")
-                (const 'move-none :tag 
+                (const 'move-none :tag
                        "Never move spam or ham out of any groups."))
   :group 'spam)
 
                        "Never move spam or ham out of any groups."))
   :group 'spam)
 
@@ -124,8 +124,7 @@ a group through group/topic parameters overrides this mechanism."
 
 (defcustom spam-split-symbolic-return-positive nil
   "Whether `spam-split' should ALWAYS work with symbols or group names.
 
 (defcustom spam-split-symbolic-return-positive nil
   "Whether `spam-split' should ALWAYS work with symbols or group names.
-Do not set this if you use `spam-split' in a fancy split
-  method."
+Do not set this if you use `spam-split' in a fancy split method."
   :type 'boolean
   :group 'spam)
 
   :type 'boolean
   :group 'spam)
 
@@ -139,7 +138,7 @@ without losing it to the automatic spam-marking process."
 
 (defcustom spam-mark-ham-unread-before-move-from-spam-group nil
   "Whether ham should be marked unread before it's moved.
 
 (defcustom spam-mark-ham-unread-before-move-from-spam-group nil
   "Whether ham should be marked unread before it's moved.
-The article is moved out of a spam group according to ham-process-destination.
+The article is moved out of a spam group according to `ham-process-destination'.
 This variable is an official entry in the international Longest Variable Name
 Competition."
   :type 'boolean
 This variable is an official entry in the international Longest Variable Name
 Competition."
   :type 'boolean
@@ -174,7 +173,7 @@ The regular expression is matched against the address."
   :group 'spam)
 
 (defcustom spam-use-dig t
   :group 'spam)
 
 (defcustom spam-use-dig t
-  "Whether `query-dig' should be used instead of `query-dns'."
+  "Whether `query-dig' should be used instead of `dns-query'."
   :type 'boolean
   :group 'spam)
 
   :type 'boolean
   :group 'spam)
 
@@ -372,6 +371,7 @@ Only meaningful if you enable `spam-use-blackholes'."
   :group 'spam)
 ;; backward-compatibility alias
 (put 'spam-face 'face-alias 'spam)
   :group 'spam)
 ;; backward-compatibility alias
 (put 'spam-face 'face-alias 'spam)
+(put 'spam-face 'obsolete-face "22.1")
 
 (defcustom spam-face 'spam
   "Face for spam-marked articles."
 
 (defcustom spam-face 'spam
   "Face for spam-marked articles."
@@ -403,7 +403,7 @@ Only meaningful if you enable `spam-use-regex-body'."
   :group 'spam)
 
 (defcustom spam-summary-score-preferred-header nil
   :group 'spam)
 
 (defcustom spam-summary-score-preferred-header nil
-  "Preferred header to use for spam-summary-score."
+  "Preferred header to use for `spam-summary-score'."
   :type '(choice :tag "Header name"
          (symbol :tag "SpamAssassin etc" X-Spam-Status)
          (symbol :tag "Bogofilter"       X-Bogosity)
   :type '(choice :tag "Header name"
          (symbol :tag "SpamAssassin etc" X-Spam-Status)
          (symbol :tag "Bogofilter"       X-Bogosity)
@@ -414,14 +414,18 @@ Only meaningful if you enable `spam-use-regex-body'."
   "Spam ifile configuration."
   :group 'spam)
 
   "Spam ifile configuration."
   :group 'spam)
 
-(defcustom spam-ifile-path (executable-find "ifile")
-  "File path of the ifile executable program."
+(make-obsolete-variable 'spam-ifile-path 'spam-ifile-program
+                        "Gnus 5.10.9 (Emacs 22.1)")
+(defcustom spam-ifile-program (executable-find "ifile")
+  "Name of the ifile program."
   :type '(choice (file :tag "Location of ifile")
                 (const :tag "ifile is not installed"))
   :group 'spam-ifile)
 
   :type '(choice (file :tag "Location of ifile")
                 (const :tag "ifile is not installed"))
   :group 'spam-ifile)
 
-(defcustom spam-ifile-database-path nil
-  "File path of the ifile database."
+(make-obsolete-variable 'spam-ifile-database-path 'spam-ifile-database
+                        "Gnus 5.10.9 (Emacs 22.1)")
+(defcustom spam-ifile-database nil
+  "File name of the ifile database."
   :type '(choice (file :tag "Location of the ifile database")
                 (const :tag "Use the default"))
   :group 'spam-ifile)
   :type '(choice (file :tag "Location of the ifile database")
                 (const :tag "Use the default"))
   :group 'spam-ifile)
@@ -449,8 +453,10 @@ your main source of newsgroup names."
   "Spam bogofilter configuration."
   :group 'spam)
 
   "Spam bogofilter configuration."
   :group 'spam)
 
-(defcustom spam-bogofilter-path (executable-find "bogofilter")
-  "File path of the Bogofilter executable program."
+(make-obsolete-variable 'spam-bogofilter-path 'spam-bogofilter-program
+                        "Gnus 5.10.9 (Emacs 22.1)")
+(defcustom spam-bogofilter-program (executable-find "bogofilter")
+  "Name of the Bogofilter program."
   :type '(choice (file :tag "Location of bogofilter")
                 (const :tag "Bogofilter is not installed"))
   :group 'spam-bogofilter)
   :type '(choice (file :tag "Location of bogofilter")
                 (const :tag "Bogofilter is not installed"))
   :group 'spam-bogofilter)
@@ -488,7 +494,8 @@ your main source of newsgroup names."
   :group 'spam-bogofilter)
 
 (defcustom spam-bogofilter-database-directory nil
   :group 'spam-bogofilter)
 
 (defcustom spam-bogofilter-database-directory nil
-  "Directory path of the Bogofilter databases."
+  "Location of the Bogofilter database.
+When nil, use the default location."
   :type '(choice (directory
                  :tag "Location of the Bogofilter database directory")
                 (const :tag "Use the default"))
   :type '(choice (directory
                  :tag "Location of the Bogofilter database directory")
                 (const :tag "Use the default"))
@@ -498,8 +505,10 @@ your main source of newsgroup names."
   "Spam bsfilter configuration."
   :group 'spam)
 
   "Spam bsfilter configuration."
   :group 'spam)
 
-(defcustom spam-bsfilter-path (executable-find "bsfilter")
-  "File path of the Bsfilter executable program."
+(make-obsolete-variable 'spam-bsfilter-path 'spam-bsfilter-program
+                        "Gnus 5.10.9 (Emacs 22.1)")
+(defcustom spam-bsfilter-program (executable-find "bsfilter")
+  "Name of the Bsfilter program."
   :type '(choice (file :tag "Location of bsfilter")
                 (const :tag "Bsfilter is not installed"))
   :group 'spam-bsfilter)
   :type '(choice (file :tag "Location of bsfilter")
                 (const :tag "Bsfilter is not installed"))
   :group 'spam-bsfilter)
@@ -519,7 +528,7 @@ your main source of newsgroup names."
   :type 'string
   :group 'spam-bsfilter)
 
   :type 'string
   :group 'spam-bsfilter)
 
-(defcustom spam-bsfilter-ham-switch "--add-ham"
+(defcustom spam-bsfilter-ham-switch "--add-clean"
   "The switch that Bsfilter uses to register ham messages."
   :type 'string
   :group 'spam-bsfilter)
   "The switch that Bsfilter uses to register ham messages."
   :type 'string
   :group 'spam-bsfilter)
@@ -562,8 +571,10 @@ When nil, use the default spamoracle database."
   "Spam SpamAssassin configuration."
   :group 'spam)
 
   "Spam SpamAssassin configuration."
   :group 'spam)
 
-(defcustom spam-spamassassin-path (executable-find "spamassassin")
-  "File path of the spamassassin executable program.
+(make-obsolete-variable 'spam-spamassassin-path
+  'spam-spamassassin-program "Gnus 5.10.9 (Emacs 22.1)")
+(defcustom spam-assassin-program (executable-find "spamassassin")
+  "Name of the spamassassin program.
 Hint: set this to \"spamc\" if you have spamd running.  See the spamc and
 spamd man pages for more information on these programs."
   :type '(choice (file :tag "Location of spamc")
 Hint: set this to \"spamc\" if you have spamd running.  See the spamc and
 spamd man pages for more information on these programs."
   :type '(choice (file :tag "Location of spamc")
@@ -592,8 +603,10 @@ identification"
   :type 'string
   :group 'spam-spamassassin)
 
   :type 'string
   :group 'spam-spamassassin)
 
-(defcustom spam-sa-learn-path (executable-find "sa-learn")
-  "File path of the sa-learn executable program."
+(make-obsolete-variable 'spam-sa-learn-path 'spam-sa-learn-program
+                        "Gnus 5.10.9 (Emacs 22.1)")
+(defcustom spam-sa-learn-program (executable-find "sa-learn")
+  "Name of the sa-learn program."
   :type '(choice (file :tag "Location of spamassassin")
                 (const :tag "spamassassin is not installed"))
   :group 'spam-spamassassin)
   :type '(choice (file :tag "Location of spamassassin")
                 (const :tag "spamassassin is not installed"))
   :group 'spam-spamassassin)
@@ -608,17 +621,17 @@ order for SpamAssassin to recognize the new registered spam."
   :group 'spam-spamassassin)
 
 (defcustom spam-sa-learn-spam-switch "--spam"
   :group 'spam-spamassassin)
 
 (defcustom spam-sa-learn-spam-switch "--spam"
-  "The switch that sa-learn uses to register spam messages"
+  "The switch that sa-learn uses to register spam messages."
   :type 'string
   :group 'spam-spamassassin)
 
 (defcustom spam-sa-learn-ham-switch "--ham"
   :type 'string
   :group 'spam-spamassassin)
 
 (defcustom spam-sa-learn-ham-switch "--ham"
-  "The switch that sa-learn uses to register ham messages"
+  "The switch that sa-learn uses to register ham messages."
   :type 'string
   :group 'spam-spamassassin)
 
 (defcustom spam-sa-learn-unregister-switch "--forget"
   :type 'string
   :group 'spam-spamassassin)
 
 (defcustom spam-sa-learn-unregister-switch "--forget"
-  "The switch that sa-learn uses to unregister messages messages"
+  "The switch that sa-learn uses to unregister messages messages."
   :type 'string
   :group 'spam-spamassassin)
 
   :type 'string
   :group 'spam-spamassassin)
 
@@ -647,12 +660,12 @@ order for SpamAssassin to recognize the new registered spam."
   :type 'string
   :group 'spam-crm114)
 
   :type 'string
   :group 'spam-crm114)
 
-(defcustom spam-crm114-spam-strong-switch "--UNKNOWN"
+(defcustom spam-crm114-spam-strong-switch "--unlearn"
   "The switch that CRM114 Mailfilter uses to unregister ham messages."
   :type 'string
   :group 'spam-crm114)
 
   "The switch that CRM114 Mailfilter uses to unregister ham messages."
   :type 'string
   :group 'spam-crm114)
 
-(defcustom spam-crm114-ham-strong-switch "--UNKNOWN"
+(defcustom spam-crm114-ham-strong-switch "--unlearn"
   "The switch that CRM114 Mailfilter uses to unregister spam messages."
   :type 'string
   :group 'spam-crm114)
   "The switch that CRM114 Mailfilter uses to unregister spam messages."
   :type 'string
   :group 'spam-crm114)
@@ -709,7 +722,7 @@ finds ham or spam.")
 ;;{{{ convenience functions
 
 (defun spam-clear-cache (symbol)
 ;;{{{ convenience functions
 
 (defun spam-clear-cache (symbol)
-  "Clear the spam-caches entry for a check."
+  "Clear the `spam-caches' entry for a check."
   (remhash symbol spam-caches))
 
 (defun spam-xor (a b)
   (remhash symbol spam-caches))
 
 (defun spam-xor (a b)
@@ -717,7 +730,7 @@ finds ham or spam.")