chiark / gitweb /
Split nameIsInList into nameIsInListRegexp (for most things) and nameIsInListExactly...
[modbot-mtm.git] / stump / bin / needAck
1 #!/usr/bin/perl
2 #
3
4 $MNG_ROOT = $ENV{'MNG_ROOT'} || die "Root dir for moderation not specified";
5
6 require "$MNG_ROOT/bin/robomod.pl";
7
8 ###################################################################### checkAck
9 # checks if poster needs ack
10 sub checkAck {
11
12   $needAck = ! &nameIsInListExactly( $From, "noack.list" );
13
14 }
15
16
17 ######################################################################
18 # Getting data
19 sub readMessage {
20
21   $IsBody = 0;
22   
23   while( <> ) {
24     $Body .= $_;
25
26     chop;
27   
28     if( /^$/ ) {
29       $IsBody = 1;
30     }
31   
32     if( !$IsBody ) {
33   
34       if( /^Newsgroups: / ) {
35         $Newsgroups = $_;
36         $Newsgroups =~ s/^Newsgroups: //i;
37       } elsif( /^Subject: / ) {
38         $Subject = $_;
39       } elsif( /^From: / ) {
40         $From = $_;
41       } elsif( /^Path: / ) {
42         $Path = $_;
43       } elsif( /^Keywords: / ) {
44         $Keywords = $_;
45       } elsif( /^Summary: / ) {
46         $Summary = $_;
47       } elsif( /^Message-ID: / ) {
48         $Message_ID = $_;
49       }
50   
51     }
52   }
53
54   close( TMPFILE );
55 }
56
57 ######################################################################
58 # read the thing
59 &readMessage();
60
61 ######################################################################
62 # process acks
63 &checkAck;
64
65 if( $needAck ) {
66   exit 0;
67 } else {
68   exit 1;
69 }