chiark / gitweb /
Merge branch 'master' of /u/webstump/live/
[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   my $fromaddr = $From;
13   $fromaddr =~ s/^[-A-Za-z]+\s*\:\s*//;
14   $needAck = ! &nameIsInListExactly( $fromaddr, "noack.list" );
15
16 }
17
18
19 ######################################################################
20 # Getting data
21 sub readMessage {
22
23   $IsBody = 0;
24   
25   while( <> ) {
26     $Body .= $_;
27
28     chop;
29   
30     if( /^$/ ) {
31       $IsBody = 1;
32     }
33   
34     if( !$IsBody ) {
35   
36       if( /^Newsgroups: / ) {
37         $Newsgroups = $_;
38         $Newsgroups =~ s/^Newsgroups: //i;
39       } elsif( /^Subject: / ) {
40         $Subject = $_;
41       } elsif( /^From: / ) {
42         $From = $_;
43       } elsif( /^Path: / ) {
44         $Path = $_;
45       } elsif( /^Keywords: / ) {
46         $Keywords = $_;
47       } elsif( /^Summary: / ) {
48         $Summary = $_;
49       } elsif( /^Message-ID: / ) {
50         $Message_ID = $_;
51       }
52   
53     }
54   }
55
56   close( TMPFILE );
57 }
58
59 ######################################################################
60 # read the thing
61 &readMessage();
62
63 ######################################################################
64 # process acks
65 &checkAck;
66
67 if( $needAck ) {
68   exit 0;
69 } else {
70   exit 1;
71 }