3 my $rcsid='$Id: testrep.channel,v 1.2 2000/08/22 23:52:51 sec Exp sec $';
4 my $len=5; # Max Size in KB of included article.
12 if(!open(ARTICLE,"/usr/lib/news/bin/sm '$_'|")){
13 print "$0 failed to get article $_\n";
19 print "$0 Exiting on eof.\n";
25 my ($nor,$date,$from,$reply,$mid,$path,$subject,$ng);
27 my ($nodes,@paths,$paths,$s);
33 $nor=1 if (/(ignore|no\s?reply)/i);
34 $date=$_ if (s/^date:\s+//i);
35 $from=$_ if (s/^from:\s+//i);
36 $reply=$_ if (s/^reply-to:\s+//i);
37 $mid=$_ if (s/^message-id:\s+//i);
38 $path=$_ if (s/^path:\s+//i);
39 $subject=$_ if (s/^subject:\s+//i);
40 $ng=$_ if (s/^newsgroups:\s+//i);
44 $_ = scalar <ARTICLE>;
46 $nor=1 if (/(ignore|no\s?reply)/i);
49 return if ($ng =~ /,/); # Ignore cross-postings.
50 return if ($nor); # User wanted us to ignore it.
51 return if ($from =~ /NNTP-Monitor\@hero\.vmc\.private\.ntl\.com/) ;
52 # spammy and unmailable
54 my $diff=&timediff(time-
55 UnixDate(ParseDate($date),"%s")
59 my @n=qw(second minute hour day);
60 my @t=(60,60,24,99999);
66 $p=$r%$t[$i];$r=int($r/$t[$i]);
67 #print "p: $p, r: $r\n";
68 if($p){$s=(($f-->0 && $r>0)?"and ":"").$p." ".$n[$i].($p>1?"s":"").($f<-1?",":"").($s?" ".$s:"")}
73 $from=$reply if ($reply);
75 $path =~ /([^!]*)!/; $pathe=$1;
76 $nodes = (($paths = $path)=~ s/!/ /g);
79 @paths=split(/!/,$path);
81 $paths=join(" ->_",reverse @paths).". ";
82 $paths=~s/([^\n]{40,75})[ \n]/$1\n/g;
87 open(FOO,"|/usr/sbin/sendmail -t -f usenet-autoresponder\@ysolde.ucam.org");
89 Subject: Response to a test message. (was: $subject)
90 From: $ng autoresponder <usenet\@ysolde.ucam.org>
93 X-Local-Version: 0.1.0
96 This message has been generated automatically in order to help you track
97 the circulation in the $ng newsgroup. If you do not wish any reply
98 from this program, just include the words "ignore" or "no reply" in the
99 header or in the 10 first lines of the body of your message.
101 Your Message $mid was received by $pathe
104 Assuming your clock was set correctly, this means that your article
105 travelled the network for $diff
106 before arriving here.
108 It had to pass through the following $nodes Usenet node$s starting with
112 Full headers plus the first 10 lines of your original message were:
116 my $str=join ("",@hdrs);
117 print FOO substr($str,0,$len*1024);
118 if (substr($str,$len*1024,1)){
119 print "\n- The above message has been trunctated, because it is longer than $len KB.\n";