From: Reiner Steib <reinersteib+gmane@imap.cc>
Cc: ding@gnus.org
Subject: Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1
Date: Sat, 25 Feb 2006 22:33:06 +0100 [thread overview]
Message-ID: <v9pslb2kfh.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <874q2owb1f.fsf%irie@t.email.ne.jp> (IRIE Tetsuya's message of "Sat, 25 Feb 2006 09:47:09 +0900")
On Sat, Feb 25 2006, IRIE Tetsuya wrote:
[ "hits=" vs. "score=" ]
> Score displayed in summary buffer becomes incorrect if using with
> spamassassin 3.x.
> (info "(gnus)Spam ELisp Package Sorting and Score Display in Summary
> Buffer")
>
> I think that a similar change is necessary also for
> `spam-extra-header-to-number'.
Could you try the following patch, please?
--8<---------------cut here---------------start------------->8---
--- spam.el 14 Feb 2006 15:57:49 +0100 7.78
+++ spam.el 25 Feb 2006 22:26:08 +0100
@@ -1173,6 +1173,11 @@
(return))))
result))
+(defvar spam-spamassassin-score-regexp "\\(?:score\\|hits\\)=\\(-?[0-9.]+\\)"
+ "Regexp matching SpamAssassin score header.
+The first group must match the number.")
+;; "score" for Spamassassin 3.0 or later.
+
(defun spam-extra-header-to-number (header headers)
"Transform an extra HEADER to a number, using list of HEADERS.
Note this has to be fast."
@@ -1181,7 +1186,8 @@
((eq header 'X-Spam-Status)
(string-to-number (gnus-replace-in-string
(gnus-extra-header header headers)
- ".*hits=" "")))
+ spam-spamassassin-score-regexp
+ "\\1")))
;; 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))
@@ -2615,8 +2621,7 @@
(if score ; scoring mode
(let ((header (message-fetch-field spam-spamassassin-spam-status-header)))
(when header
- (if (string-match "\\(?:score\\|hits\\)=\\(-?[0-9.]+\\)" header)
- ;; "score" for Spamassassin 3.0 or later.
+ (if (string-match spam-spamassassin-score-regexp header)
(match-string 1 header)
"0")))
;; spam detection mode
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
next prev parent reply other threads:[~2006-02-25 21:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <873biqwtf5.fsf@puyo.nijino.com>
2006-02-13 16:42 ` Ted Zlatanov
2006-02-14 15:01 ` Reiner Steib
2006-02-25 0:47 ` IRIE Tetsuya
2006-02-25 21:33 ` Reiner Steib [this message]
2006-02-26 2:45 ` IRIE Tetsuya
2006-02-28 13:44 ` Reiner Steib
2006-03-01 13:57 ` IRIE Tetsuya
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v9pslb2kfh.fsf@marauder.physik.uni-ulm.de \
--to=reinersteib+gmane@imap.cc \
--cc=Reiner.Steib@gmx.de \
--cc=ding@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).