Article View: news.software.nntp
Article #53084INN: Perl filtering on Subject
From: `matte
Date: Fri, 29 Jun 2001 14:51
Date: Fri, 29 Jun 2001 14:51
61 lines
2500 bytes
2500 bytes
Hi, I want enable perl filtering in filter_innd.pl, but I have read the
documentation, and it says :
--------------
The %hdr hash should not be modified inside filter_art(). Instead,
any of the contents need to be modified temporarily during filtering
(smashing case, for example), copy them into a seperate variable first
and perform the modifications on the copy. Currently, `$hdr{__BODY__}'
---------------
I'm not understanding the right way to modify my headers. I have tried
to make a copy to another variable, but it doesn works...
I'm working on filter_art() in filter_innd.pl, but when I try to
put the spoolfile into innd, filter_art() has no effect on subjects.[1]
Wrong Subjects are correctly recognized by filter, but they are not
corrected...
Instead, filter_nnrpd.pl works correctly. When a message is posted
locally, if it has malformed subject, it is correctly recognized and
corrected.
And now, the code:
----------
sub filter_art {
my $rval = "" ; # Assume we'll accept.
$modify_headers = 1; # I dont know if it is necessary
if ($hdr{"Subject"} =~ /^(RE: |Re: |R: ){2,}/) {
$hdr{"Subject"} =~ s/(RE: |Re: |R: ){2,}/Re: /;
} elsif ($hdr{"Subject"} =~ /^R: /) {
$hdr{"Subject"} =~ s/^R: /Re: /;
} elsif ($hdr{"Subject"} =~ /^RE: /) {
$hdr{"Subject"} =~ s/^RE: /Re: /;
}
$rval ;
}
-------------
That's all ;-))
[1] I'm using ``rnews spoolfile'' to put my spool in INNd.
Bye, `matte.
ps: Sorry, but I am a newbie with perl scripting ;-))
pps: SOrry for my English :P
--
err: signature too big
Technical Details
Message-ID:
<slrn9jp5g1.5ue.fake@mat.home.xs>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!62-122-98-29.flat.galactica.IT!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <slrn9jp5g1.5ue.fake@mat.home.xs> Subject: INN: Perl filtering on Subject Date: Fri, 29 Jun 2001 14:51:45 +0000 From: fake@address.com (`matte) Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!62-122-98-29.flat.galactica.IT!not-for-mail Newsgroups: news.software.nntp Organization: LinuxBox Lines: 60 NNTP-Posting-Host: 62-122-98-29.flat.galactica.it (62.122.98.29) X-Trace: fu-berlin.de 993826344 14930640 62.122.98.29 (16 [57973]) User-Agent: slrn/0.9.7.1 (Linux)