Thread View: news.software.nntp
1 messages
1 total messages
Started by Max Heffler
Fri, 19 Jan 1996 00:00
Re: Gate mail into News
Author: Max Heffler
Date: Fri, 19 Jan 1996 00:00
Date: Fri, 19 Jan 1996 00:00
96 lines
3050 bytes
3050 bytes
In <4dci21$22c@mailgate.bender.com> "John J. Waterbury" <John.J.Waterbury@bender.com> writes:
>Is there any software available for easily gateing
>Mail into INN (ie: spooling mailining lists into NEWS to keep
>hundred of users from susbscribing to the same groups)?
I don't remember where I got the following script. I added the
inews.log stuff:
#!/usr/local/bin/perl
require "ctime.pl";
$log = "/home/max/.procmail/inews.log";
($program = $0) =~ s%.*/%%;
( $version ) = $] =~ /(\d+\.\d+).*\nPatch level/;
#die "$program: requires at least version 3 of perl\n"
# if $version < 3;
$inews = "/bin/inews";
$inews = "/usr/local/news/inews" unless -x $inews;
die "$program: can't find inews\n" unless -x $inews;
$iopts = "-h -S";
if ($#ARGV < 0) {
# $newsgroup = "test";
# we'll expect the newsgroup line in the body
} elsif ($#ARGV == 0) {
$newsgroup = $ARGV[0];
} elsif ($#ARGV == 1) {
$newsgroup = $ARGV[0];
$approval = $ARGV[1];
} else {
die "usage: $program [newsgroup] [approval]\n";
}
# in case inews dumps core or something crazy
$SIG{'PIPE'} = "plumber";
sub plumber { die "$program: \"$inews\" died prematurely!\n"; }
open (INEWS, "| $inews $iopts") ||
die "$program: can't run $inews\n";
open (LOG, ">> $log") ||
die "$program: can't open $log\n";
$ENV{'TZ'} = "CST6CDT";
print LOG &ctime(time);
# header munging loop
while (<STDIN>) {
last if /^$/;
# transform real from: line back to icky style
s/^From:\s+(.*) <(.*)>/From: $2 ($1)/;
# transform from_ line to path header; also works locally
s/^From\s+(\S+)@(\S+).*/Path: $2!$1/
|| s/^From\s+(\S+)[^@]*$/Path: $1\n/;
print LOG
if /^(From|To|Sender|Cc):/i;
print INEWS
if /^(From|Subject|Date|Path|Newsgroups|Organization|Message-ID):/i;
$saw_subject |= ( $+ eq 'Subject' );
$saw_newsgroup |= ( $+ eq 'Newsgroups' );
}
close LOG;
chmod 0666, $log;
warn "$program: didn't expect newsgroup in both headers and ARGV\n"
if $newsgroup && $saw_newsgroup;
die "$program: didn't get newsgroup from either headers or ARGV\n"
unless $newsgroup || $saw_newsgroup;
printf INEWS "Newsgroups: %s\n", $newsgroup if $newsgroup;
print INEWS "Subject: Untitled\n" unless $saw_subject;
printf INEWS "Approved: %s\n", $approval if $approval;
print INEWS "\n";
print INEWS while <STDIN>; # gobble rest of message
close INEWS;
exit $?;
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads