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.
6 use POSIX qw(strftime);
13 if(!open(ARTICLE,"/usr/lib/news/bin/sm '$_'|")){
14 print "$0 failed to get article $_\n";
20 print "$0 Exiting on eof.\n";
26 my ($nor,$date,$from,$reply,$mid,$path,$subject,$ng);
28 my ($nodes,@paths,$paths,$s);
34 $nor=1 if (/(ignore|no\s?reply)/i);
35 $date=$_ if (s/^date:\s+//i);
36 $from=$_ if (s/^from:\s+//i);
37 $reply=$_ if (s/^reply-to:\s+//i);
38 $mid=$_ if (s/^message-id:\s+//i);
39 $path=$_ if (s/^path:\s+//i);
40 $subject=$_ if (s/^subject:\s+//i);
41 $ng=$_ if (s/^newsgroups:\s+//i);
45 $_ = scalar <ARTICLE>;
47 $nor=1 if (/(ignore|no\s?reply)/i);
50 return if ($ng =~ /,/); # Ignore cross-postings.
51 return if ($nor); # User wanted us to ignore it.
52 return if ($from =~ /NNTP-Monitor\@hero\.vmc\.private\.ntl\.com/) ;
53 # spammy and unmailable
55 my $diff=&timediff(time-
56 UnixDate(ParseDate($date),"%s")
60 my @n=qw(second minute hour day);
61 my @t=(60,60,24,99999);
67 $s="less than one second";
71 $p=$r%$t[$i];$r=int($r/$t[$i]);
72 #print "p: $p, r: $r\n";
73 if($p){$s=(($f-->0 && $r>0)?"and ":"").$p." ".$n[$i].($p>1?"s":"").($f<-1?",":"").($s?" ".$s:"")}
79 $from=$reply if ($reply);
81 $path =~ /([^!]*)!/; $pathe=$1;
82 $nodes = (($paths = $path)=~ s/!/ /g);
85 @paths=split(/!/,$path);
87 $paths=join(" ->_",reverse @paths).". ";
88 $paths=~s/([^\n]{40,75})[ \n]/$1\n/g;
91 my $rdate=strftime "%a %b %e %H:%M:%S UTC %Y", gmtime;
93 open(FOO,"|/usr/sbin/sendmail -t -f usenet-autoresponder\@ysolde.ucam.org");
95 Subject: Response to a test message. (was: $subject)
96 From: $ng autoresponder <usenet\@ysolde.ucam.org>
99 X-Local-Version: 0.1.0
102 This message has been generated automatically in order to help you track
103 the circulation in the $ng newsgroup. If you do not wish any reply
104 from this program, just include the words "ignore" or "no reply" in the
105 header or in the 10 first lines of the body of your message.
107 Your Message $mid was received by $pathe
110 Assuming your clock was set correctly, this means that your article
111 travelled the network for $diff
112 before arriving here.
114 It had to pass through the following $nodes Usenet node$s starting with
118 Full headers plus the first 10 lines of your original message were:
122 my $str=join ("",@hdrs);
123 print FOO substr($str,0,$len*1024);
124 if (substr($str,$len*1024,1)){
125 print "\n- The above message has been trunctated, because it is longer than $len KB.\n";