diff -bur testnews.OLD/include/storage.h testnews/include/storage.h
old
|
new
|
|
44 | 44 | void *private; /* A pointer to method specific data */ |
45 | 45 | time_t arrived; /* The time when the article arrived */ |
46 | 46 | time_t expires; /* The time when the article will be expired */ |
| 47 | bool filtered; /* Article was marked by the filter */ |
47 | 48 | char *groups; /* Where Newsgroups header starts */ |
48 | 49 | int groupslen; /* Length of Newsgroups header */ |
49 | 50 | TOKEN *token; /* A pointer to the article's TOKEN */ |
diff -bur testnews.OLD/innd/art.c testnews/innd/art.c
old
|
new
|
|
518 | 518 | arth.arrived = (time_t)0; |
519 | 519 | arth.token = (TOKEN *)NULL; |
520 | 520 | arth.expires = data->Expires; |
| 521 | arth.filtered = data->Filtered; |
521 | 522 | if (innconf->storeonxref) { |
522 | 523 | arth.groups = data->Replic; |
523 | 524 | arth.groupslen = data->ReplicLength; |
… |
… |
|
1886 | 1887 | TMRstop(TMR_PYTHON); |
1887 | 1888 | if (filterrc != NULL) { |
1888 | 1889 | if (innconf->dontrejectfiltered) { |
| 1890 | snprintf(cp->Error, sizeof(cp->Error), "%d %.200s", NNTP_REJECTIT_VAL, |
| 1891 | filterrc); |
| 1892 | syslog(L_NOTICE, "filtering[python] %s %s", HDR(HDR__MESSAGE_ID), |
| 1893 | cp->Error); |
1889 | 1894 | Filtered = true; |
1890 | 1895 | } else { |
1891 | 1896 | snprintf(cp->Error, sizeof(cp->Error), "%d %.200s", NNTP_REJECTIT_VAL, |
… |
… |
|
1913 | 1918 | if (filterrc) { |
1914 | 1919 | if (innconf->dontrejectfiltered) { |
1915 | 1920 | Filtered = true; |
| 1921 | snprintf(cp->Error, sizeof(cp->Error), "%d %.200s", NNTP_REJECTIT_VAL, |
| 1922 | filterrc); |
| 1923 | syslog(L_NOTICE, "filtering[perl] %s %s", HDR(HDR__MESSAGE_ID), |
| 1924 | cp->Error); |
1916 | 1925 | } else { |
1917 | 1926 | snprintf(cp->Error, sizeof(cp->Error), "%d %.200s", NNTP_REJECTIT_VAL, |
1918 | 1927 | filterrc); |
… |
… |
|
2295 | 2304 | for (i = 0; (ngp = GroupPointers[i]) != NULL; i++) |
2296 | 2305 | ngp->PostCount = 0; |
2297 | 2306 | |
| 2307 | data->Filtered = Filtered; |
2298 | 2308 | token = ARTstore(cp); |
2299 | 2309 | /* change trailing '\r\n' to '\0\n' of all system header */ |
2300 | 2310 | for (i = 0 ; i < MAX_ARTHEADER ; i++) { |
diff -bur testnews.OLD/innd/innd.h testnews/innd/innd.h
old
|
new
|
|
197 | 197 | int HeaderLines; /* number of header lines */ |
198 | 198 | long BytesValue; /* size of stored article, "\r\n" is |
199 | 199 | counted as 1 byte */ |
| 200 | bool Filtered; /* Marked by filter */ |
200 | 201 | char Bytes[16]; /* generated Bytes header */ |
201 | 202 | int BytesLength; /* generated Bytes header length */ |
202 | 203 | char * BytesHeader; /* where Bytes header begins in |
diff -bur testnews.OLD/scripts/innreport_inn.pm testnews/scripts/innreport_inn.pm
old
|
new
|
|
244 | 244 | # SERVER cancelled +id |
245 | 245 | return 1 if $left =~ /^SERVER cancelled /o; |
246 | 246 | } |
247 | | # rejecting[perl] |
248 | | if ($left =~ /^rejecting\[perl\] <[^>]+> \d+ (.*)/o) { |
| 247 | # rejecting[perl]/filtering[perl] |
| 248 | if ($left =~ /^(?:rejecting|filtering)\[perl\] <[^>]+> \d+ (.*)/o) { |
249 | 249 | $innd_filter_perl{$1}++; |
250 | 250 | return 1; |
251 | 251 | } |
diff -bur testnews.OLD/storage/interface.c testnews/storage/interface.c
old
|
new
|
|
334 | 334 | #define SMexpire 14 |
335 | 335 | #define SMoptions 15 |
336 | 336 | #define SMexactmatch 16 |
| 337 | #define SMfiltered 17 |
337 | 338 | |
338 | 339 | static CONFTOKEN smtoks[] = { |
339 | 340 | { SMlbrace, "{" }, |
… |
… |
|
345 | 346 | { SMexpire, "expires:" }, |
346 | 347 | { SMoptions, "options:" }, |
347 | 348 | { SMexactmatch, "exactmatch:" }, |
| 349 | { SMfiltered, "filtered:" }, |
348 | 350 | { 0, 0 } |
349 | 351 | }; |
350 | 352 | |
… |
… |
|
371 | 373 | char *options = 0; |
372 | 374 | int inbrace; |
373 | 375 | bool exactmatch = false; |
| 376 | bool filtered = false; |
374 | 377 | |
375 | 378 | /* if innconf isn't already read in, do so. */ |
376 | 379 | if (innconf == NULL) { |
… |
… |
|
423 | 426 | minexpire = 0; |
424 | 427 | maxexpire = 0; |
425 | 428 | exactmatch = false; |
| 429 | filtered = false; |
426 | 430 | |
427 | 431 | } else { |
428 | 432 | type = tok->type; |
… |
… |
|
470 | 474 | || strcasecmp(p, "on") == 0) |
471 | 475 | exactmatch = true; |
472 | 476 | break; |
| 477 | case SMfiltered: |
| 478 | if (strcasecmp(p, "true") == 0 |
| 479 | || strcasecmp(p, "yes") == 0 |
| 480 | || strcasecmp(p, "on") == 0) |
| 481 | filtered = true; |
| 482 | break; |
473 | 483 | default: |
474 | 484 | SMseterror(SMERR_CONFIG, "Unknown keyword in method declaration"); |
475 | 485 | syslog(L_ERROR, "SM Unknown keyword in method declaration, line %d: %s", f->lineno, tok->name); |
… |
… |
|
512 | 522 | sub->minexpire = minexpire; |
513 | 523 | sub->maxexpire = maxexpire; |
514 | 524 | sub->exactmatch = exactmatch; |
| 525 | sub->filtered = filtered; |
515 | 526 | |
516 | 527 | free(method); |
517 | 528 | method = 0; |
… |
… |
|
694 | 705 | (!sub->minexpire || article.expires >= sub->minexpire) && |
695 | 706 | (!sub->maxexpire || (article.expires <= sub->maxexpire)) && |
696 | 707 | MatchGroups(article.groups, article.groupslen, sub->pattern, |
697 | | sub->exactmatch)) { |
| 708 | sub->exactmatch) && |
| 709 | (sub->filtered == article.filtered)) { |
698 | 710 | if (InitMethod(typetoindex[sub->type])) |
699 | 711 | return sub; |
700 | 712 | } |
diff -bur testnews.OLD/storage/interface.h testnews/storage/interface.h
old
|
new
|
|
45 | 45 | method */ |
46 | 46 | bool exactmatch; /* all newsgroups to which article belongs |
47 | 47 | should match the patterns */ |
| 48 | bool filtered; /* article was marked by the filter */ |
48 | 49 | struct __S_SUB__ *next; |
49 | 50 | } STORAGE_SUB; |