Date: Wed, 30 Aug 1995 00:50:43 +0800 (CST) From: Chien-Ta Lee <jdli@linux.csie.nctu.edu.tw> To: freebsd-hackers@FreeBSD.ORG Subject: Solution : How to read mailing-list via newsgroups Message-ID: <199508291650.AAA15721@linux.csie.nctu.edu.tw>
next in thread | raw e-mail | index | archive | help
Hi :
I am now reading FreeBSD mailing-list via newsgroups, but this
is a small local news server setup myself.
Here is a little perl script to "post" mails onto newsgroups,
we call it "mail-post.pl".
How to use this ?
1. create freebsd mailing-list newsgroups
2. add new lines into /etc/aliases, like this ..
freebsd-cvs-all: "|/usr/lib/news/bin/mail-post.pl mailing.freebsd.cvs"
freebsd-announce: "|/usr/lib/news/bin/mail-post.pl mailing.freebsd.announce"
(freebsd-announce is the alias to receive mails, you should
registe freebsd-announce@hostname to majordomo server;
mailing.freebsd.announce is the newsgroup name)
Then you will be able to read mailing-list via newsgroups. :)
Problem: I use tin to read news, while I press "r" to reply posts,
it will NOT forward my reply mails to mailing-list, only
the author of that post can receive ur reply.
Add CC: by hand seems no use. :(
Maybe tin needs a hack to do the forwarding. (at least when
I add CC: by hand)
Any idea ?
Problem: Use tin to post on the mailing-list newsgroup will NOT
be sent to mailing-list. It's ok I think.
-------< mail-post.pl >--------
#!/usr/bin/perl
$ENV{"NNTPSERVER"}="news.csie.nctu.edu.tw";
($program = $0) =~ s%.*/%%;
( $version ) = $] =~ /(\d+\.\d+).*\nPatch level/;
die "$program: requires at least version 3 of perl\n"
if $version < 3;
$inews = "/usr/lib/news/inews";
$inews = "/usr/lib/news/inews" unless -x $inews;
die "$program: can't find inews\n" unless -x $inews;
$iopts = "-h";
if ($#ARGV < 0) {
$newsgroup = "linux.test";
# Default test newsgroup if there's none supplied.
# we'll expect the newsgroup line in the body
} elsif ($#ARGV == 0) {
$newsgroup = $ARGV[0];
} else {
die "usage: $program [newsgroup]\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";
# 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 INEWS
if /^(From|Subject):/i;
$saw_subject |= ( $+ eq 'Subject' );
}
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;
print INEWS "\n";
print INEWS while <STDIN>; # gobble rest of message
close INEWS;
exit $?;
------< CUT CUT CUT >-------
--
李 建 達 (Adonis) 交大資工
Mail: jdli@csie.nctu.edu.tw
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508291650.AAA15721>
