more info from -p

Adrian Otto aotto at aotto.com
Wed Sep 25 01:48:01 CEST 2002


Clint,

I like your patch. That's a good idea.

Adrian

> -----Original Message-----
> From: Clint Adams [mailto:schizo at debian.org]
> Sent: Saturday, September 21, 2002 1:15 PM
> To: bogofilter-dev at aotto.com
> Cc: 161236-forwarded at bugs.debian.org; Zephaniah E. Hull
> Subject: more info from -p
> 
> 
> This is a slightly-modified patch from Zeph Hull which would add
> spamicity info in X-Spam-Status.
> 
> Index: bogofilter.c
> ===================================================================
> RCS file: /cvsroot/bogofilter/bogofilter/bogofilter.c,v
> retrieving revision 1.11
> diff -u -r1.11 bogofilter.c
> --- bogofilter.c	19 Sep 2002 03:20:32 -0000	1.11
> +++ bogofilter.c	21 Sep 2002 20:11:57 -0000
> @@ -601,7 +601,7 @@
>      return spamicity;
>  }
>  
> -rc_t bogofilter(int fd)
> +rc_t bogofilter(int fd, double *xss)
>  /* evaluate text for spamicity */
>  {
>      rc_t	status;
> @@ -619,6 +619,9 @@
>      spamicity = compute_spamicity(stats);
>  
>      status = (spamicity > SPAM_CUTOFF) ? RC_SPAM : RC_NONSPAM;
> +
> +    if (xss != NULL)
> +        *xss = spamicity;
>  
>      return status;
>  }
> Index: bogofilter.h
> ===================================================================
> RCS file: /cvsroot/bogofilter/bogofilter/bogofilter.h,v
> retrieving revision 1.3
> diff -u -r1.3 bogofilter.h
> --- bogofilter.h	18 Sep 2002 22:30:22 -0000	1.3
> +++ bogofilter.h	21 Sep 2002 20:11:57 -0000
> @@ -32,7 +32,7 @@
>  extern void register_words(int fd, wordlist_t *list, wordlist_t *other);
>  extern int get_token(void);
>  extern void lexer_stream_mode(void);
> -extern rc_t bogofilter(int fd);
> +extern rc_t bogofilter(int fd, double *xss);
>  extern int bogodump(char *file);
>  
>  extern wordlist_t ham_list, spam_list;
> Index: main.c
> ===================================================================
> RCS file: /cvsroot/bogofilter/bogofilter/main.c,v
> retrieving revision 1.6
> diff -u -r1.6 main.c
> --- main.c	20 Sep 2002 15:27:27 -0000	1.6
> +++ main.c	21 Sep 2002 20:11:58 -0000
> @@ -188,7 +188,7 @@
>      }
>      else
>      {
> -	rc_t	status = bogofilter(STDIN_FILENO);
> +	rc_t	status = bogofilter(STDIN_FILENO, &spamicity);
>  
>  	if (passthrough)
>  	{
> @@ -203,8 +203,8 @@
>  
>  	    /* print spam-status at the end of the header
>  	     * then mark the beginning of the message body */
> -	    printf("X-Spam-Status: %s, tests=bogofilter\n", 
> -		    (status==RC_SPAM) ? "Yes" : "No");
> +	    printf("X-Spam-Status: %s, spamicity=%f, tests=bogofilter\n", 
> +		    spamicity, (status==RC_SPAM) ? "Yes" : "No");
>  	    /* If the message terminated early (without body or blank
>  	     * line between header and body), enforce a blank line to
>  	     * prevent anything past us from choking. */
> 



More information about the bogofilter-dev mailing list