[Bogofilter-cvs] bogofilter bogofilter.h,1.1.1.1,1.2 bogofilter.c,1.5,1.6 main.c,1.2,1.3
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <re...@us...> - 2002-09-15 19:07:15
|
Update of /cvsroot/bogofilter/bogofilter In directory usw-pr-cvs1:/tmp/cvs-serv11982 Modified Files: bogofilter.h bogofilter.c main.c Log Message: Add an enumerated type for return codes of RC_SPAM and RC_NONSPAM, which values of 0 and 1 as called for by procmail. Use the new codes and type for bogofilter() and when generating the X-Spam-Status message. Index: bogofilter.h =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/bogofilter.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** bogofilter.h 14 Sep 2002 22:15:20 -0000 1.1.1.1 --- bogofilter.h 15 Sep 2002 19:07:12 -0000 1.2 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ */ /* $Log$ + /* Revision 1.2 2002/09/15 19:07:12 relson + /* Add an enumerated type for return codes of RC_SPAM and RC_NONSPAM, which values of 0 and 1 as called for by procmail. + /* Use the new codes and type for bogofilter() and when generating the X-Spam-Status message. + /* /* Revision 1.1.1.1 2002/09/14 22:15:20 adrian_otto /* 0.7.3 Base Source *************** *** 6,9 **** --- 10,15 ---- // constants and declarations for bogofilter + typedef enum rc_e {RC_SPAM=0, RC_NONSPAM=1} rc_t; + typedef struct { *************** *** 21,30 **** extern int get_token(void); extern void lexer_stream_mode(void); ! extern int bogofilter(int fd); extern int bogodump(char *file); extern wordlist_t ham_list, spam_list; extern int verbose; - extern int status; // discard tokens longer than this, so as not to clutter up our --- 27,35 ---- extern int get_token(void); extern void lexer_stream_mode(void); ! extern rc_t bogofilter(int fd); extern int bogodump(char *file); extern wordlist_t ham_list, spam_list; extern int verbose; // discard tokens longer than this, so as not to clutter up our *************** *** 36,40 **** #define FROM 2 // Mail message delimiter extern FILE *yyin; ! extern char *yytext; struct textblock --- 41,45 ---- #define FROM 2 // Mail message delimiter extern FILE *yyin; ! extern char *yytext; struct textblock Index: bogofilter.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/bogofilter.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** bogofilter.c 15 Sep 2002 18:29:04 -0000 1.5 --- bogofilter.c 15 Sep 2002 19:07:13 -0000 1.6 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ */ /* $Log$ + /* Revision 1.6 2002/09/15 19:07:13 relson + /* Add an enumerated type for return codes of RC_SPAM and RC_NONSPAM, which values of 0 and 1 as called for by procmail. + /* Use the new codes and type for bogofilter() and when generating the X-Spam-Status message. + /* /* Revision 1.5 2002/09/15 18:29:04 relson /* bogofilter.c: *************** *** 423,427 **** } ! int bogofilter(int fd) /* evaluate text for spamicity */ { --- 427,431 ---- } ! rc_t bogofilter(int fd) /* evaluate text for spamicity */ { *************** *** 544,552 **** } - if (verbose) printf("# Spamicity of %f\n", spamicity); ! return((spamicity > SPAM_CUTOFF) ? 0 : 1); } --- 548,555 ---- } if (verbose) printf("# Spamicity of %f\n", spamicity); ! return((spamicity > SPAM_CUTOFF) ? RC_SPAM : RC_NONSPAM); } Index: main.c =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** main.c 15 Sep 2002 16:31:41 -0000 1.2 --- main.c 15 Sep 2002 19:07:13 -0000 1.3 *************** *** 1,4 **** --- 1,8 ---- /* $Id$ */ /* $Log$ + /* Revision 1.3 2002/09/15 19:07:13 relson + /* Add an enumerated type for return codes of RC_SPAM and RC_NONSPAM, which values of 0 and 1 as called for by procmail. + /* Use the new codes and type for bogofilter() and when generating the X-Spam-Status message. + /* /* Revision 1.2 2002/09/15 16:31:41 relson /* Substitute STDIN_FILENO where numeric constant 0 is used as a file descriptor. *************** *** 162,166 **** else { ! int status = bogofilter(STDIN_FILENO); if (passthrough) --- 166,170 ---- else { ! rc_t status = bogofilter(STDIN_FILENO); if (passthrough) *************** *** 183,187 **** /* Append the X-Spam-Status: header before subject */ printf("X-Spam-Status: %s, tests=bogofilter\n", ! status ? "No" : "Yes"); (void) fputs(textend->block, stdout); } --- 187,191 ---- /* Append the X-Spam-Status: header before subject */ printf("X-Spam-Status: %s, tests=bogofilter\n", ! (status==RC_SPAM) ? "Yes" : "No"); (void) fputs(textend->block, stdout); } |