From cb43f010255803a7baf0e6d1976bdcc6b7d70b33 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 29 Oct 2004 23:29:27 +0000 Subject: [PATCH] Synch to No Gnus 200410291913. --- lisp/ChangeLog | 13 +++++++++++++ lisp/gnus-registry.el | 4 +++- lisp/spam.el | 22 ++++++++++++++++++++-- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d8a7979..717c1f6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2004-10-29 Teodor Zlatanov + + * gnus-registry.el (gnus-registry-hashtb): create the registry + when package is loaded + + * spam.el (spam-summary-score-preferred-header): global preference + for people who want to override the default SpamAssassin over + Bogofilter preference (when both are set) + (spam-necessary-extra-headers): add spam-use-bogofilter as an option + (spam-user-format-function-S): check spam-summary-score-preferred-header + (spam-extra-header-to-number): add X-Bogosity header parsing + (spam-user-format-function-S): format the score correctly + 2004-10-29 Katsumi Yamaoka * gnus-msg.el (gnus-configure-posting-styles): Work with empty diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el index c939d6a..31c0b1d 100644 --- a/lisp/gnus-registry.el +++ b/lisp/gnus-registry.el @@ -68,7 +68,9 @@ "The Gnus registry." :group 'gnus) -(defvar gnus-registry-hashtb nil +(defvar gnus-registry-hashtb (make-hash-table + :size 256 + :test 'equal) "*The article registry by Message ID.") (defcustom gnus-registry-unfollowed-groups '("delayed" "drafts" "queue") diff --git a/lisp/spam.el b/lisp/spam.el index 52043ae..cd3a39e 100644 --- a/lisp/spam.el +++ b/lisp/spam.el @@ -379,6 +379,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 +1132,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 +1153,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 +1164,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)) -- 1.7.10.4