1 # $Id: filter_innd.pl,v 1.4 2004/10/10 20:26:24 jochen Exp $
2 # Copyright (c) 2004 Jochen Striepe <t-prot@tolot.escape.de>
4 # This file is provided as an example how t-prot can be used for
5 # Perl filtering with INN2. It is NOT meant for production use.
6 # Read the README.perl_hook coming with your version of INN2, and
7 # adapt the script to your needs.
9 # Please see t-prot's man page for command line parameter details.
11 # Requirements/Bugs: mktemp(1) should be quite widely spread by
12 # now -- if it is not installed on your system, get the sources
13 # from Debian Linux or OpenBSD. Of course, rm(1) is POSIX and will
14 # be present on any reasonably Unix-like system.
15 # The script should not be run on any heavy-duty machines -- the
16 # writes to /tmp will be costly when many articles are committed
17 # at the same time. Sadly, there seems to be no really clean,
18 # portable, and standard way to realize a two-way pipe with perl.
19 # Please point me to some documentation if I am wrong. Thank you. :)
21 # License: This file is part of the t-prot package and therefore
22 # available under the same conditions. See t-prot's man page for
24 # The whole idea is robbed from Martin Dietze -- see his version at
25 # http://www.fh-wedel.de/pub/fh-wedel/staff/herbert/linux/
26 # Please note that there is no code copied from there, so the files
27 # in the t-prot package are *not* available under the terms of the
31 my $rval = "" ; # Assume we'll accept. Cannot be `0'
33 if ($hdr{'Newsgroups'} =~ /^local\./) {
34 my $foo = $hdr{'__BODY__'};
37 open(TMP, '/usr/bin/mktemp -q /tmp/INN2.tmp.XXXXXX | tr -d \'\n\'|')
47 open(IN, "/usr/bin/t-prot -m -t -p --check -i $f|")
52 FINISH: system('/bin/rm', $f);
61 sub filter_messageid {