* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 [not found] <873biqwtf5.fsf@puyo.nijino.com> @ 2006-02-13 16:42 ` Ted Zlatanov 2006-02-14 15:01 ` Reiner Steib 1 sibling, 0 replies; 7+ messages in thread From: Ted Zlatanov @ 2006-02-13 16:42 UTC (permalink / raw) Cc: Ding Mailing List On 10 Feb 2006, ari@mbf.ocn.ne.jp wrote: > Hi, > > I am using spamassassin 3.1, and (setq spam-use-spamassassin-headers t). > When I typed S t in Summary buffer, reported score is always 0. > > Spamassassin 3.0 or later, the default X-Spam-Status field is changed as: >> X-Spam-Status: No, score=0.1 required=8.0 ... > But, `spam-check-spamassassin-headers' checks only "hits=". > cf. http://issues.apache.org/SpamAssassin/show_bug.cgi?id=1332 > > When I changed spam.el as attached, the reported score is corrected. > > Regards, > ARISAWA Akihiro > 2006-02-11 ARISAWA Akihiro <ari@mbf.ocn.ne.jp> > > * spam.el (spam-check-spamassassin-headers): Improved regexp > for spamassassin 3.0 or later. > > Index: lisp/spam.el > =================================================================== > RCS file: /usr/local/cvsroot/gnus/lisp/spam.el,v > retrieving revision 7.77 > diff -u -r7.77 spam.el > --- lisp/spam.el 8 Feb 2006 04:17:15 -0000 7.77 > +++ lisp/spam.el 11 Feb 2006 01:35:11 -0000 > @@ -2614,8 +2614,8 @@ > (if score ; scoring mode > (let ((header (message-fetch-field spam-spamassassin-spam-status-header))) > (when header > - (if (string-match "hits=\\(-?[0-9.]+\\)" header) > - (match-string 1 header) > + (if (string-match "\\(hits\\|score\\)=\\(-?[0-9.]+\\)" header) > + (match-string 2 header) > "0"))) > ;; spam detection mode > (let ((header (message-fetch-field spam-spamassassin-spam-flag-header))) Thanks! Can someone else on ding with SA 3.x test this patch please? I'll commit it as soon as I get a confirmation. Ted ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 [not found] <873biqwtf5.fsf@puyo.nijino.com> 2006-02-13 16:42 ` spam-check-spamassassin-headers with spamassasin 3.0/3.1 Ted Zlatanov @ 2006-02-14 15:01 ` Reiner Steib 2006-02-25 0:47 ` IRIE Tetsuya 1 sibling, 1 reply; 7+ messages in thread From: Reiner Steib @ 2006-02-14 15:01 UTC (permalink / raw) Cc: ding, bugs On Sat, Feb 11 2006, ARISAWA Akihiro wrote (on bugs@gnus.org): > I am using spamassassin 3.1, and (setq spam-use-spamassassin-headers t). > When I typed S t in Summary buffer, reported score is always 0. > > Spamassassin 3.0 or later, the default X-Spam-Status field is changed as: > |X-Spam-Status: No, score=0.1 required=8.0 ... > But, `spam-check-spamassassin-headers' checks only "hits=". > cf. http://issues.apache.org/SpamAssassin/show_bug.cgi?id=1332 > > When I changed spam.el as attached, the reported score is corrected. [...] > - (if (string-match "hits=\\(-?[0-9.]+\\)" header) > - (match-string 1 header) > + (if (string-match "\\(hits\\|score\\)=\\(-?[0-9.]+\\)" header) > + (match-string 2 header) > "0"))) Thanks for your report. I've committed a slightly different fix in CVS. Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 2006-02-14 15:01 ` Reiner Steib @ 2006-02-25 0:47 ` IRIE Tetsuya 2006-02-25 21:33 ` Reiner Steib 0 siblings, 1 reply; 7+ messages in thread From: IRIE Tetsuya @ 2006-02-25 0:47 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 283 bytes --] Hi, 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'. Best regards, -- IRIE Tetsuya [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: spam.el.patch --] [-- Type: text/x-patch, Size: 624 bytes --] 2006-02-25 IRIE Tetsuya <irie@t.email.ne.jp> * spam.el (spam-extra-header-to-number): Adapt format for spamassassin 3.0 or later. --- spam.el.orig 2006-02-21 08:05:22.000000000 +0900 +++ spam.el 2006-02-25 09:05:31.322535616 +0900 @@ -1181,7 +1181,7 @@ ((eq header 'X-Spam-Status) (string-to-number (gnus-replace-in-string (gnus-extra-header header headers) - ".*hits=" ""))) + ".*\\(?:score\\|hits\\)=" ""))) ;; 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)) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 2006-02-25 0:47 ` IRIE Tetsuya @ 2006-02-25 21:33 ` Reiner Steib 2006-02-26 2:45 ` IRIE Tetsuya 0 siblings, 1 reply; 7+ messages in thread From: Reiner Steib @ 2006-02-25 21:33 UTC (permalink / raw) Cc: ding 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/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 2006-02-25 21:33 ` Reiner Steib @ 2006-02-26 2:45 ` IRIE Tetsuya 2006-02-28 13:44 ` Reiner Steib 0 siblings, 1 reply; 7+ messages in thread From: IRIE Tetsuya @ 2006-02-26 2:45 UTC (permalink / raw) [-- Attachment #1: Type: text/plain, Size: 673 bytes --] Thank you for your reply. Reiner Steib <reinersteib+gmane@imap.cc> writes: > Could you try the following patch, please? `spam-check-spamassassin-headers' works fine, however `spam-extra-header-to-number' doesn't. spamassasin add header like this: | X-Spam-Status: Yes, score=13.1 required=5.0 tests=DNS_FROM_RFC_ABUSE, | DNS_FROM_RFC_WHOIS,FORGED_YAHOO_RCVD,MISSING_SUBJECT,NO_REAL_NAME, | UNDISC_RECIPS autolearn=disabled version=3.0.3 Score always becomes 0 at (string-to-number (gnus-replace-in-string ... )), because "Yes" or "No" flag exist before score=xxx. When I changed spam.el as attached, the displayed score is corrected. Best regards, -- IRIE Tetsuya [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: spam.el.patch --] [-- Type: text/x-patch, Size: 722 bytes --] --- spam.el.orig 2006-02-26 10:46:08.533820872 +0900 +++ spam.el 2006-02-26 09:58:40.303817648 +0900 @@ -1184,10 +1184,11 @@ (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"))) + (if (string-match spam-spamassassin-score-regexp + (gnus-extra-header header headers)) + (string-to-number + (match-string 1 (gnus-extra-header header headers))) + 0)) ;; 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)) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 2006-02-26 2:45 ` IRIE Tetsuya @ 2006-02-28 13:44 ` Reiner Steib 2006-03-01 13:57 ` IRIE Tetsuya 0 siblings, 1 reply; 7+ messages in thread From: Reiner Steib @ 2006-02-28 13:44 UTC (permalink / raw) Cc: ding On Sun, Feb 26 2006, IRIE Tetsuya wrote: > `spam-check-spamassassin-headers' works fine, however > `spam-extra-header-to-number' doesn't. Could you try both in current CVS, please? > spamassasin add header like this: > | X-Spam-Status: Yes, score=13.1 required=5.0 tests=DNS_FROM_RFC_ABUSE, > | DNS_FROM_RFC_WHOIS,FORGED_YAHOO_RCVD,MISSING_SUBJECT,NO_REAL_NAME, > | UNDISC_RECIPS autolearn=disabled version=3.0.3 > > Score always becomes 0 at (string-to-number (gnus-replace-in-string > ... )), because "Yes" or "No" flag exist before score=xxx. Thanks for providing this example and for the analysis. Bye, Reiner. -- ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: spam-check-spamassassin-headers with spamassasin 3.0/3.1 2006-02-28 13:44 ` Reiner Steib @ 2006-03-01 13:57 ` IRIE Tetsuya 0 siblings, 0 replies; 7+ messages in thread From: IRIE Tetsuya @ 2006-03-01 13:57 UTC (permalink / raw) Reiner Steib <reinersteib+gmane@imap.cc> writes: >> `spam-check-spamassassin-headers' works fine, however >> `spam-extra-header-to-number' doesn't. > > Could you try both in current CVS, please? Both function works well. Thank you. -- IRIE Tetsuya ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-03-01 13:57 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <873biqwtf5.fsf@puyo.nijino.com> 2006-02-13 16:42 ` spam-check-spamassassin-headers with spamassasin 3.0/3.1 Ted Zlatanov 2006-02-14 15:01 ` Reiner Steib 2006-02-25 0:47 ` IRIE Tetsuya 2006-02-25 21:33 ` Reiner Steib 2006-02-26 2:45 ` IRIE Tetsuya 2006-02-28 13:44 ` Reiner Steib 2006-03-01 13:57 ` IRIE Tetsuya
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).