From: joao.cachopo@inesc-id.pt (João Cachopo)
Subject: [spam.el] Problem with obtaining the spam score for CRM114
Date: Sat, 15 Apr 2006 12:59:53 +0100 [thread overview]
Message-ID: <877j5rvykm.fsf@nabla.local> (raw)
[-- Attachment #1: Type: text/plain, Size: 768 bytes --]
Hi!
I switched recently from bogofilter to CRM114 and when I tried to sort
the summary of my spam group by the article spam score assigned by
CRM114, I couldn't made it to work. The spam score of every article
showed up as 0.00 in the summary buffer.
One of the problems seems to be that the spam-necessary-extra-headers
function on spam.el only deals with SpamAssassin and Bogofilter. I
guess that the header added by the CRM114 filter should be added to
the list of extra headers, also.
Once that is fixed, there remains another problem in the
spam-extra-header-to-number function, which already extracts the
proper score from the CRM114 header, but returns a string instead of a
number.
I include below a patch against spam.el that fixes both these errors.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: spam.patch --]
[-- Type: text/x-patch, Size: 2163 bytes --]
--- spam.el.orig 2006-03-28 20:51:41.000000000 +0100
+++ spam.el 2006-04-15 12:33:48.000000000 +0100
@@ -1156,6 +1156,8 @@
(push 'X-Spam-Status list))
(when spam-use-bogofilter
(push 'X-Bogosity list))
+ (when spam-use-crm114
+ (push 'X-CRM114-Status list))
list))
(defun spam-user-format-function-S (headers)
@@ -1186,24 +1188,25 @@
(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."
- (if (gnus-extra-header header headers)
- (cond
- ((eq header 'X-Spam-Status)
- (string-to-number (gnus-replace-in-string
- (gnus-extra-header header headers)
- 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))
- ((eq header 'X-Bogosity)
- (string-to-number (gnus-replace-in-string
- (gnus-replace-in-string
- (gnus-extra-header header headers)
- ".*spamicity=" "")
- ",.*" "")))
- (t nil))
- nil))
+ (let ((header-content (gnus-extra-header header headers)))
+ (if header-content
+ (cond
+ ((eq header 'X-Spam-Status)
+ (string-to-number (gnus-replace-in-string
+ header-content
+ 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-content))
+ (string-to-number (match-string 1 header-content)))
+ ((eq header 'X-Bogosity)
+ (string-to-number (gnus-replace-in-string
+ (gnus-replace-in-string
+ header-content
+ ".*spamicity=" "")
+ ",.*" "")))
+ (t nil))
+ nil)))
(defun spam-summary-score (headers &optional specific-header)
"Score an article for the summary buffer, as fast as possible.
[-- Attachment #3: Type: text/plain, Size: 31 bytes --]
Best regards,
--
João Cachopo
next reply other threads:[~2006-04-15 11:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-15 11:59 João Cachopo [this message]
2006-04-15 23:45 ` Miles Bader
2006-04-17 9:09 ` João Cachopo
2006-04-18 20:27 ` Ted Zlatanov
2006-04-16 16:31 ` Lars Magne Ingebrigtsen
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=877j5rvykm.fsf@nabla.local \
--to=joao.cachopo@inesc-id.pt \
/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).