Re: Thunderbird [Re: fido, inn, auth]
- From
- Yuriy Vlasov (2:6090/5.99)
- To
- Paul Argentoff
- Date
- 2007-09-20T00:03:04Z
- Area
- RU.UNIX.FTN
From: "Yuriy Vlasov" <mobv@mail.ru>
19.09.07 в 18:26 Paul Argentoff в своём письме писал(а):
>> Проще научить свой гейт делать это.
>>
>> 2ALL:е пора ли в FAQ ?
>
> Рецептом не поделитесь? FAQ я просмотрел -- что-то не нашел там
> такого.
> Идея сама по себе разумна. Но как это сделать, если сократить задачу,
>
> скажем, до X-Comment-To?
Если система FreeBSD и сервер - inn, то в /usr/local/news/bin/filter
надо поместить файл filter_nnrpd.pl следующего содержания:
#!/usr/bin/perl -w
#use strict;
#
# Do any initialization steps.
#
my %config = (checkincludedtext => 0,
includedcutoff => 40,
includedratio => 0.6,
quotere => '^[>:]',
antiquotere => '^[<]', # so as not to reject dict(1) output
);
sub filter_post {
my $rval = "" ; # assume we'll accept.
if ($config{checkincludedtext}) {
my ($lines, $quoted, $antiquoted) = analyze($body);
if ($lines > $config{includedcutoff}
&& $quoted - $antiquoted > $lines *
$config{includedratio}) {
$rval = "Article contains too much quoted text";
}
}
my $grephistory = '/usr/local/news/bin/grephistory';
my $sm = '/usr/local/news/bin/sm';
if( $hdr{"Newsgroups"} =~ /fido\./ ) {
if ( $hdr{"Newsgroups"} =~ /,/ ) {
$rval = "More than one newsgroup requested, only one allowed";
}
if ( !(($hdr{"Comment-To"} ne "") ||
($hdr{"X-Comment-To"} ne "") ||
($hdr{"X-FTN-To"} ne "") ||
($hdr{"X-Fidonet-Comment-To"} ne "") ||
($hdr{"X-Apparently-To"} ne ""))) {
my $refs = $hdr{"References"};
if( $refs ne "" ) {
my @refs = split(/ /, $refs);
my $msgid = pop @refs;
$msgid =~ s/[<>|;\s'"]//g;
my $fn=`$grephistory \'$msgid\' 2>&1`;
if( (!($fn =~ /\/dev\/null/)) &&
(!($fn =~ /Not found/)) ) {
my $orig_from = `$sm $fn`;
my @orig_from = grep(/^From:/, split(/\n/,
$orig_from));
$orig_from = shift @orig_from;
$orig_from =~ s/^From:\s*//;
$orig_from =~
s/^\s*(.+[^\s])\s*<[^\s><"\(\)\@]+\@[^\s><"\(\
)\@]+>\s*$/$1/;
$orig_from =~
s/^\s*<{0,1}[^\s><"\(\)\@]+\@[^\s><"\(\)\@]+>{
0,1}\s*\((.+)\)\s*$/$1/;
$orig_from =~ s/^"//;
$orig_from =~ s/"$//;
$hdr{"X-Comment-To"} = $orig_from;
$modify_headers = 1;
}
}
}
}
return $rval;
}
sub analyze {
my ($lines, $quoted, $antiquoted) = (0, 0, 0);
local $_ = shift;
do {
if ( /\G$config{quotere}/mgc ) {
$quoted++;
} elsif ( /\G$config{antiquotere}/mgc ) {
$antiquoted++;
}
} while ( /\G(.*)\n/gc && ++$lines );
return ($lines, $quoted, $antiquoted);
}
--
[Team] Злой Сисоп [Team] Kalabaha [Team] Lexx
The Ubuntu Counter Project - user number # 17409
ICQ: 170701066
Всего доброго, Юра.
--- Opera Mail/9.23 (Linux)
* Origin: Kalabaha BBS (2:6090/5.99)
SEEN-BY: 50/12 13 58 203 400/814 450/186 451/30 454/9 465/285 469/418 550/196
SEEN-BY: 4646/15 5000/5000 5001/5001 5002/50 5010/53 5011/13 5012/23 46
SEEN-BY: 5015/28 5019/26 40 5020/154 175 400 545 639 758 1523 1604 1982 2142
SEEN-BY: 5020/2238 2871 4441 5021/29 5022/128 5025/3 750 5026/45 5027/12
SEEN-BY: 5030/556 966 1900 1957 2828 5031/47 70 5035/38 5040/47 5042/13
SEEN-BY: 5049/50 5054/1 8 9 37 45 67 89 5059/9 37 5061/120 5062/1 10 18 5063/3
SEEN-BY: 5064/7 5071/166 5077/70 5080/80 1003 5083/1 5084/9 5085/13 5090/108
SEEN-BY: 5090/113 5095/20 5096/18 5099/11 6001/10 6002/3 6090/1 5 9 14 35
PATH: 6090/5 1 5020/4441 545 5054/1 37