chiark / gitweb /
Strip X-Complaints-To too
[modbot-mtm.git] / stump / bin / robomod.pl
1 #!/usr/bin/perl
2 #
3 # Collection of common functions
4 #
5
6 $MNG_ROOT = $ENV{'MNG_ROOT'} || die "Root dir for moderation not specified";
7
8 ###################################################################### checkAck
9 # checks if poster needs ack
10 sub nameIsInList {
11   local( $listName ) = pop( @_ );
12   local( $address ) = pop( @_ );
13
14   local( $item );
15
16   $Result = 0;
17
18   open( LIST, "$MNG_ROOT/data/$listName" );
19
20   while( $item = <LIST> ) {
21
22     chop $item;
23
24     next if $item =~ /^ *$/;
25
26     if( eval { $address =~ /$item/i; } || "\L$address" eq "\L$item" ) {
27       $Result = $item;
28     }
29   }
30
31   close( LIST );
32
33   return $Result;
34 }
35
36 sub logAction {
37   my $msg = pop( @_ );
38
39   print STDERR $msg . "\n";
40 }
41
42
43 ######################################################################
44 # Setting variables
45
46 if( defined( $ENV{'STUMP_PARANOID_PGP'} ) ) {
47   $paranoid_pgp = $ENV{'STUMP_PARANOID_PGP'}  eq "YES";
48 } else {
49    $paranoid_pgp = 0;
50 }
51
52 1;