bogofilter patch for UNSURE-tag in subject line
Burkhard Kaas
bkaas at geva.de
Mon Dec 1 13:10:45 CET 2003
Hello,
we have patched bogofilter to tag unsure mails in the subject line:
*** ./bogofilter.cf.example Thu Oct 2 13:29:51 2003
--- ../bogofilter-0.15.7/./bogofilter.cf.example Mon Dec 1 13:00:46 2003
***************
*** 48,57 ****
#### SPAM_SUBJECT_TAG
#
! # tag added to "Subject: " line for identifying spam
# default is to add nothing.
##spam_subject_tag=***SPAM***
##### STATS_IN_HEADER
--- 48,58 ----
#### SPAM_SUBJECT_TAG
#
! # tag added to "Subject: " line for identifying spam or unsure
# default is to add nothing.
##spam_subject_tag=***SPAM***
+ ##unsure_subject_tag=???SPAM???
##### STATS_IN_HEADER
*** ./src/format.h Fri Aug 29 14:43:31 2003
--- ../bogofilter-0.15.7/./src/format.h Mon Dec 1 12:28:27 2003
***************
*** 11,16 ****
--- 11,17 ----
extern const char *spam_header_name;
extern const char *spam_subject_tag;
+ extern const char *unsure_subject_tag;
/* needed by bogoconfig.c */
*** ./src/format.c Sun Sep 7 01:52:23 2003
--- ../bogofilter-0.15.7/./src/format.c Mon Dec 1 12:29:16 2003
***************
*** 46,51 ****
--- 46,52 ----
const char *spam_header_name = SPAM_HEADER_NAME; /* used by lexer */
const char *spam_subject_tag = NULL; /* used in passthrough mode */
+ const char *unsure_subject_tag = NULL; /* used in
passthrough mode */
/*
** formatting characters:
***************
*** 96,101 ****
--- 97,103 ----
{
{ "spam_header_name", CP_STRING, { &spam_header_name } },
{ "spam_subject_tag", CP_STRING, { &spam_subject_tag } },
+ { "unsure_subject_tag",CP_STRING, { &unsure_subject_tag } },
{ "header_format", CP_STRING, { &header_format } },
{ "terse_format", CP_STRING, { &terse_format } },
{ "log_header_format", CP_STRING, { &log_header_format } },
*** ./src/passthrough.c Tue Sep 30 14:37:53 2003
--- ../bogofilter-0.15.7/./src/passthrough.c Mon Dec 1 12:31:14 2003
***************
*** 178,183 ****
--- 178,194 ----
seen_subj = 1;
continue;
}
+ if (status == RC_UNSURE &&
+ rd >= subjlen &&
+ unsure_subject_tag != NULL &&
+ strncasecmp(out, subjstr, subjlen) == 0) {
+ (void) fprintf(fpo, "%.*s %s", subjlen, out, unsure_subject_tag);
+ if (out[subjlen] != ' ')
+ fputc(' ', fpo);
+ (void) fwrite(out + subjlen, 1, rd - subjlen, fpo);
+ seen_subj = 1;
+ continue;
+ }
hadlf = (out[rd-1] == '\n');
(void) fwrite(out, 1, rd, fpo);
***************
*** 208,213 ****
--- 219,229 ----
if (passthrough && !seen_subj &&
status == RC_SPAM && spam_subject_tag != NULL) {
(void) fprintf(fpo, "Subject: %s\n", spam_subject_tag);
+ }
+
+ if (passthrough && !seen_subj &&
+ status == RC_UNSURE && unsure_subject_tag != NULL) {
+ (void) fprintf(fpo, "Subject: %s\n", unsure_subject_tag);
}
if (passthrough) {
More information about the bogofilter-dev
mailing list