X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fspam.el;h=946f7153480b04b7ca867d35f385bc299f5cb04f;hb=7d3cebb22d43e3ae26e7b1ab3b40c12ec80be154;hp=9a44ab20239153a377610b9e41d0cb0e3642c165;hpb=48990ac593481a0fad129fc4d426fada65143c4a;p=elisp%2Fgnus.git- diff --git a/lisp/spam.el b/lisp/spam.el index 9a44ab2..946f715 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -79,7 +79,8 @@ Populated by spam-install-backend-super.") (defgroup spam nil - "Spam configuration.") + "Spam configuration." + :version "21.4") (defcustom spam-summary-exit-behavior 'default "Exit behavior at the time of summary exit. @@ -379,6 +380,14 @@ Only meaningful if you enable `spam-use-regex-body'." :type '(repeat (regexp :tag "Regular expression to match ham body")) :group 'spam) +(defcustom spam-summary-score-preferred-header nil + "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) + (const :tag "No preference, take best guess." nil)) + :group 'spam) + (defgroup spam-ifile nil "Spam ifile configuration." :group 'spam) @@ -1124,11 +1133,14 @@ backends)." spam-use-spamassassin-headers spam-use-regex-headers) (push 'X-Spam-Status list)) + (when spam-use-bogofilter + (push 'X-Bogosity list)) list)) (defun spam-user-format-function-S (headers) (when headers - (spam-summary-score headers))) + (format "%3.2f" + (spam-summary-score headers spam-summary-score-preferred-header)))) (defun spam-article-sort-by-spam-status (h1 h2) "Sort articles by score." @@ -1142,7 +1154,8 @@ backends)." result)) (defun spam-extra-header-to-number (header headers) - "Transform an extra header to a number." + "Transform an extra HEADER to a number, using list of HEADERS. +Note this has to be fast." (if (gnus-extra-header header headers) (cond ((eq header 'X-Spam-Status) @@ -1152,6 +1165,12 @@ backends)." ;; for CRM checking, it's probably faster to just do the string match ((and spam-use-crm114 (string-match "( pR: \\([0-9.-]+\\)" header)) (match-string 1 header)) + ((eq header 'X-Bogosity) + (string-to-number (gnus-replace-in-string + (gnus-replace-in-string + (gnus-extra-header header headers) + ".*spamicity=" "") + ",.*" ""))) (t nil)) nil)) @@ -2867,6 +2886,8 @@ installed through spam-necessary-extra-headers." (remove-hook 'gnus-get-new-news-hook 'spam-setup-widening) (remove-hook 'gnus-summary-prepare-hook 'spam-find-spam)) +(add-hook 'spam-unload-hook 'spam-unload-hook) + (when spam-install-hooks (spam-initialize)) ;;}}}