From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/62837 Path: news.gmane.org!not-for-mail From: joao.cachopo@inesc-id.pt (=?iso-8859-1?Q?Jo=E3o?= Cachopo) Newsgroups: gmane.emacs.gnus.general Subject: [spam.el] Problem with obtaining the spam score for CRM114 Date: Sat, 15 Apr 2006 12:59:53 +0100 Organization: Grupo de Inteligencia Artificial, Instituto Superior Tecnico Message-ID: <877j5rvykm.fsf@nabla.local> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1145118395 2100 80.91.229.2 (15 Apr 2006 16:26:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Apr 2006 16:26:35 +0000 (UTC) Original-X-From: ding-owner+m11364@lists.math.uh.edu Sat Apr 15 18:26:35 2006 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FUnbT-0007ve-OQ for ding-account@gmane.org; Sat, 15 Apr 2006 18:26:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1FUnbN-0001zA-00; Sat, 15 Apr 2006 11:26:25 -0500 Original-Received: from nas01.math.uh.edu ([129.7.128.39]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1FUjWe-00018Y-00 for ding@lists.math.uh.edu; Sat, 15 Apr 2006 07:05:16 -0500 Original-Received: from quimby.gnus.org ([80.91.224.244]) by nas01.math.uh.edu with esmtp (Exim 4.52) id 1FUjWZ-0007Os-HE for ding@lists.math.uh.edu; Sat, 15 Apr 2006 07:05:16 -0500 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1FUjWX-0005Es-00 for ; Sat, 15 Apr 2006 14:05:09 +0200 Original-Received: from root by ciao.gmane.org with local (Exim 4.43) id 1FUjWQ-0006sB-6P for ding@gnus.org; Sat, 15 Apr 2006 14:05:02 +0200 Original-Received: from 87-196-170-147.net.novis.pt ([87.196.170.147]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 15 Apr 2006 14:05:02 +0200 Original-Received: from joao.cachopo by 87-196-170-147.net.novis.pt with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 15 Apr 2006 14:05:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: ding@gnus.org Original-Lines: 93 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 87-196-170-147.net.novis.pt User-Agent: Gnus/5.110005 (No Gnus v0.5) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:IAUmarzIo8PYLrXV+VS0HmOzyx0= X-Spam-Score: -2.6 (--) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: news.gmane.org gmane.emacs.gnus.general:62837 Archived-At: --=-=-= 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=spam.patch --- 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. --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Best regards, -- Joćo Cachopo --=-=-=--