Hello uanog, Странные люди... Hello Konstantin, Newscache is now maintained by Herbert Straub, the new project website is: http://members.aon.at/hstraub/linux/newscache/ There is a Mailinglist newscache@linuxhacker.org, where I am forwarding your request. Current version is 1.1.90, so I am not sure, if your patch still applies. regards arved * Konstantin Nikonenko [Mon, Nov 24, 2003 at 05:15:26PM +0200]:
Hello tom, arved,
i'm patched newscache to add functionality in filter newsgroup. In config file now can see next: Server news.prov.net nntp { Retries 3 Read *,!porno,!adult,!sex,!^alt,!picture,!erotic PostTo * GroupTimeout 150
# diff work/NewsCache-1.1.12/NServer-0.9.1/NVActiveDB.cc.old work/NewsCache-1.1.12/NServer-0.9.1/NVActiveDB.cc 186c186 < if (!filter || matchgroup(filter, line.c_str()) > 0) { ---
if (!filter || matchgroup(filter, line.c_str()) >= 0) {
214c214 < ((matchgroup(filter, gd.name()) > 0))) && ---
((matchgroup(filter, gd.name()) >= 0))) &&
# diff work/NewsCache-1.1.12/NServer-0.9.1/MPList.cc.old work/NewsCache-1.1.12/NServer-0.9.1/MPList.cc 12c12 < if (clen > bmlen) { ---
if (clen >= bmlen) {
30c30 < if (clen > bmlen) { ---
if (clen >= bmlen) {
# diff work/NewsCache-1.1.12/NServer-0.9.1/util.cc.old work/NewsCache-1.1.12/NServer-0.9.1/util.cc 11a12,13
#include
#include 13c15 < #include"util.h"
#include "util.h" 71,117c73,142 < char c; < int j, clen, bmlen = 0, bmrej = 0; < int rejrule = 0; < < j = 0; < do { < clen = 0; < if (pattern[j] == '!') { < j++; < rejrule = 1; < } else { < rejrule = 0; < } < while ((c = pattern[j]) && c == group[clen]) { < clen++; < j++; < } < < switch (c) { < case ',': < case '\0': < if (group[clen] != '\0' && !isspace(group[clen])) { < clen = -2; < } < clen++; < break; < case '*': < clen++; < break; < default: < clen = -1; < break; < } < < if (clen > bmlen) { < bmlen = clen; < bmrej = rejrule; < } < < while (c && c != ',') { < j++; < c = pattern[j]; < } < j++; < } while (c); < < return bmrej ? -bmlen : bmlen;
int err_no; regex_t *regex; regmatch_t *result; size_t match_num = 0; int rejrule, max_rej, rule_len, max_len=0; char rules[15][255]; unsigned int rules_num=0, i, r_len=0, lr_len;
// memset(rules, NULL, sizeof(rules)); while(rules_num<15) { lr_len=0; while(r_len < 255){ if(pattern[r_len] == '\0' || pattern[r_len] == ',' ) break; rules[rules_num][lr_len] = pattern[r_len]; r_len++; lr_len++; } rules_num++; if(pattern[r_len] == '\0' || r_len == 255 ) break; r_len++; }
for(i=0; i
regex = ( regex_t * ) malloc( sizeof( regex_t ) ); if ( regex == ( regex_t * ) 0 ) { // fprintf( stderr, "Memory allocation failed. Exiting.\n" ); exit( -1 ); } memset( regex, 0, sizeof( regex_t ) );
/* Compile the regex */ if ( ( err_no = regcomp( regex, pattern, 0 ) ) != 0 ) { size_t length; char *buffer; length = regerror( err_no, regex, NULL, 0 ); buffer = (char *)malloc( length ); regerror( err_no, regex, buffer, length ); // fprintf( stderr, "%s\n", buffer ); /* Print the error */ free( buffer ); regfree( regex ); exit( -1 ); } result = ( regmatch_t * ) malloc( sizeof( regmatch_t ) ); if ( result == ( regmatch_t * ) 0 ) { // fprintf( stderr, "Memory allocation failed. Exiting.\n" ); exit( -1 ); } memset ( result, 0, sizeof( regmatch_t ) );
err_no = regexec( regex, group, 0 , result, 0 ); if ( err_no == 0 ) { if(rule_len > max_len){ max_len = rule_len; max_rej = rejrule; } } regfree( regex ); free( regex ); free( result ); } return max_rej ? -max_len : max_len;
-- Cheers, Konstantin Nikonenko http://www.kot.dp.ua/ Spetztekhosnastka JSC http://www.d-sto.com/ =================================================================== uanog mailing list. To Unsubscribe: send mail to majordomo@uanog.kiev.ua with "unsubscribe uanog" in the body of the message
participants (1)
-
Konstantin Nikonenko