[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [leafnode-list] Filtering crossposts to gmane.spam.detected



Reiner Steib <4.uce.03.r.s@xxxxxxxxxxxxxx> writes:

> (1)
> pattern = ^Xref:.* gmane\.spam\.detected:
> action = kill

Fetchnews wasn't up to this job, it didn't include the Xref in the
header it filtered on. Try this patch and let me know if it works
(debugmode=33 will log the headers fetchnews creates from XOVER when it
filters, provided you're using enough -v options on the fetchnews
command line):

Index: fetchnews.c
===================================================================
RCS file: /var/CVS/leafnode-2/fetchnews.c,v
retrieving revision 1.114
diff -u -r1.114 fetchnews.c
--- fetchnews.c	5 May 2003 21:02:56 -0000	1.114
+++ fetchnews.c	6 May 2003 21:24:09 -0000
@@ -715,7 +715,7 @@
 static /*@only@*/ mastr *
 create_pseudo_header(const char *subject, const char *from,
 	const char *date, const char *messageid, const char *references,
-	char **newsgroups_list, int num_groups, const char *bytes, const char *lines)
+	char **newsgroups_list, int num_groups, const char *bytes, const char *lines, const char *xref)
 {
     int n;
     mastr *s = mastr_new(2048);
@@ -734,6 +734,9 @@
 	mastr_vcat(s, "Lines: ", lines, "\n", NULL);
     if (bytes)
 	mastr_vcat(s, "Bytes: ", bytes, "\n", NULL);
+    if (xref)
+	mastr_vcat(s, xref, "\n", NULL); /* Xref headers usually come
+					    with their name in XOVER */
     return s;
 }
 
@@ -806,7 +809,7 @@
     while ((l = getaline(nntpin)) && strcmp(l, ".")) {
 	char *xover[20];	/* RATS: ignore */
 	char *artno, *subject, *from, *date, *messageid;
-	char *references, *lines, *bytes;
+	char *references, *lines, *bytes, *xref;
 	char **newsgroups_list = NULL;
 	int num_groups;
 
@@ -830,6 +833,7 @@
 	references = xover[5];
 	bytes = xover[6];
 	lines = xover[7];
+	xref = xover[8];
 
 	/* is there an Xref: header present as well? */
 	if (xover[8] == NULL ||
@@ -844,12 +848,17 @@
 	    mastr *s;
 
 	    s = create_pseudo_header(subject, from, date, messageid,
-		    references, newsgroups_list, num_groups, bytes, lines);
+		    references, newsgroups_list, num_groups, bytes, lines,
+		    xref);
 
 	    if (filtlst && killfilter(filtlst, mastr_str(s))) {
 		groupkilled++;
 		ln_log(LNLOG_SDEBUG, LNLOG_CARTICLE,
 			"filtered out article %s", artno);
+		if (debugmode & DEBUG_FILTER)
+		    ln_log(LNLOG_SDEBUG, LNLOG_CARTICLE,
+			    "Headers: %s", mastr_str(s));
+
 		/* filter pseudoheaders */
 		mastr_delete(s);
 		goto next_over;


-- 
Matthias Andree
leafnode-1 download: http://sourceforge.net/projects/leafnode/
leafnode-1 docs/new: http://mandree.home.pages.de/leafnode/
leafnode-2 homepage: http://mandree.home.pages.de/leafnode/beta/

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list