X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fspam.el;h=4ebd8a9f83887f2fa9daa99c48f2d7039a8a8f5c;hb=851278bf56a0156a4dd5896e9959f63e33d07ee2;hp=7ff8c53abbd68602347e7d2479ad831163ad7ba2;hpb=956db6a3e41381305e5ccb716b1055bd9f5fed8f;p=gnus diff --git a/lisp/spam.el b/lisp/spam.el index 7ff8c53ab..4ebd8a9f8 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -1,6 +1,6 @@ ;;; spam.el --- Identifying spam -;; Copyright (C) 2002-2011 Free Software Foundation, Inc. +;; Copyright (C) 2002-2015 Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Maintainer: Ted Zlatanov @@ -38,10 +38,6 @@ ;;{{{ compilation directives and autoloads/requires -;; For Emacs <22.2 and XEmacs. -(eval-and-compile - (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) - (eval-when-compile (require 'cl)) (require 'message) ;for the message-fetch-field functions @@ -50,7 +46,6 @@ ;;; for the definitions of group content classification and spam processors (require 'gnus) -(eval-when-compile (require 'spam-report)) (eval-when-compile (require 'hashcash)) ;; for nnimap-split-download-body-default @@ -60,11 +55,10 @@ (autoload 'query-dig "dig") ;; autoload spam-report -(eval-and-compile - (autoload 'spam-report-gmane "spam-report") - (autoload 'spam-report-gmane-spam "spam-report") - (autoload 'spam-report-gmane-ham "spam-report") - (autoload 'spam-report-resend "spam-report")) +(autoload 'spam-report-gmane "spam-report") +(autoload 'spam-report-gmane-spam "spam-report") +(autoload 'spam-report-gmane-ham "spam-report") +(autoload 'spam-report-resend "spam-report") ;; autoload gnus-registry (autoload 'gnus-registry-group-count "gnus-registry") @@ -94,14 +88,14 @@ Note that setting the `spam-use-move' or `spam-use-copy' backends on a group through group/topic parameters overrides this mechanism." :type '(choice (const - 'default - :tag "Move spam out of all groups and ham out of spam groups.") + :tag "Move spam out of all groups and ham out of spam groups" + default) (const - 'move-all - :tag "Move spam out of all groups and ham out of all groups.") + :tag "Move spam out of all groups and ham out of all groups" + move-all) (const - 'move-none - :tag "Never move spam or ham out of any groups.")) + :tag "Never move spam or ham out of any groups" + move-none)) :group 'spam) (defcustom spam-directory (nnheader-concat gnus-directory "spam/") @@ -2060,7 +2054,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (if spam-use-dig (let ((query-result (query-dig query-string))) (when query-result - (gnus-message 6 "(DIG): positive blackhole check '%s'" + (gnus-message 6 "(DIG): positive blackhole check `%s'" query-result) (push (list ip server query-result) matches))) @@ -2092,22 +2086,24 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details." (declare-function gnus-extract-address-components "gnus-util" (from)) (eval-and-compile - (when (condition-case nil - (progn - (require 'bbdb) - (require 'bbdb-com)) - (file-error - ;; `bbdb-records' should not be bound as an autoload function - ;; before loading bbdb because of `bbdb-hashtable-size'. - (defalias 'bbdb-buffer 'ignore) - (defalias 'bbdb-create-internal 'ignore) - (defalias 'bbdb-records 'ignore) - (defalias 'spam-BBDB-register-routine 'ignore) - (defalias 'spam-enter-ham-BBDB 'ignore) - (defalias 'spam-exists-in-BBDB-p 'ignore) - (defalias 'bbdb-gethash 'ignore) - nil)) + (condition-case nil + (progn + (require 'bbdb) + (require 'bbdb-com)) + (file-error + ;; `bbdb-records' should not be bound as an autoload function + ;; before loading bbdb because of `bbdb-hashtable-size'. + (defalias 'bbdb-buffer 'ignore) + (defalias 'bbdb-create-internal 'ignore) + (defalias 'bbdb-records 'ignore) + (defalias 'spam-BBDB-register-routine 'ignore) + (defalias 'spam-enter-ham-BBDB 'ignore) + (defalias 'spam-exists-in-BBDB-p 'ignore) + (defalias 'bbdb-gethash 'ignore) + nil))) +(eval-and-compile + (when (featurep 'bbdb-com) ;; when the BBDB changes, we want to clear out our cache (defun spam-clear-cache-BBDB (&rest immaterial) (spam-clear-cache 'spam-use-BBDB)) @@ -2236,15 +2232,6 @@ Uses `gnus-newsgroup-name' if category is nil (for ham registration)." ;;{{{ spam-stat -(eval-when-compile - (autoload 'spam-stat-buffer-change-to-non-spam "spam-stat") - (autoload 'spam-stat-buffer-change-to-spam "spam-stat") - (autoload 'spam-stat-buffer-is-non-spam "spam-stat") - (autoload 'spam-stat-buffer-is-spam "spam-stat") - (autoload 'spam-stat-load "spam-stat") - (autoload 'spam-stat-save "spam-stat") - (autoload 'spam-stat-split-fancy "spam-stat")) - (require 'spam-stat) (defun spam-check-stat () @@ -2471,7 +2458,10 @@ With a non-nil REMOVE, remove the ADDRESSES." (defun spam-report-resend-register-ham-routine (articles) (spam-report-resend-register-routine articles t)) +(defvar spam-report-resend-to) + (defun spam-report-resend-register-routine (articles &optional ham) + (require 'spam-report) (let* ((resend-to-gp (if ham (gnus-parameter-ham-resend-to gnus-newsgroup-name) @@ -2900,25 +2890,27 @@ explicitly, and matters only if you need the extra headers installed through `spam-necessary-extra-headers'." (interactive) - (dolist (var symbols) - (set var t)) - - (dolist (header (spam-necessary-extra-headers)) - (add-to-list 'nnmail-extra-headers header) - (add-to-list 'gnus-extra-headers header)) - - (setq spam-install-hooks t) - ;; TODO: How do we redo this every time the `spam' face is customized? - (push '((eq mark gnus-spam-mark) . spam) - gnus-summary-highlight) - ;; Add hooks for loading and saving the spam stats - (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save) - (add-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load) - (add-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load) - (add-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit) - (add-hook 'gnus-summary-prepare-hook 'spam-summary-prepare) - (add-hook 'gnus-get-new-news-hook 'spam-setup-widening) - (add-hook 'gnus-summary-prepared-hook 'spam-find-spam)) + (when spam-install-hooks + (dolist (var symbols) + (set var t)) + + (dolist (header (spam-necessary-extra-headers)) + (add-to-list 'nnmail-extra-headers header) + (add-to-list 'gnus-extra-headers header)) + + ;; TODO: How do we redo this every time the `spam' face is customized? + (push '((eq mark gnus-spam-mark) . spam) + gnus-summary-highlight) + ;; Add hooks for loading and saving the spam stats + (add-hook 'gnus-save-newsrc-hook 'spam-maybe-spam-stat-save) + (add-hook 'gnus-get-top-new-news-hook 'spam-maybe-spam-stat-load) + (add-hook 'gnus-startup-hook 'spam-maybe-spam-stat-load) + (add-hook 'gnus-summary-prepare-exit-hook 'spam-summary-prepare-exit) + (add-hook 'gnus-summary-prepare-hook 'spam-summary-prepare) + (add-hook 'gnus-get-new-news-hook 'spam-setup-widening) + (add-hook 'gnus-summary-prepared-hook 'spam-find-spam) + ;; Don't install things more than once. + (setq spam-install-hooks nil))) (defun spam-unload-hook () "Uninstall the spam.el hooks." @@ -2933,8 +2925,6 @@ installed through `spam-necessary-extra-headers'." (add-hook 'spam-unload-hook 'spam-unload-hook) -(when spam-install-hooks - (spam-initialize)) ;;}}} (provide 'spam)