head 1.2; access; symbols; locks; strict; comment @# @; 1.2 date 2001.05.04.12.42.18; author ahuxley; state Exp; branches; next 1.1; 1.1 date 2001.05.04.11.18.24; author ahuxley; state Exp; branches; next ; desc @INEWS REPLACEMENT TO USE MAIL2NEWS GATEWAT @ 1.2 log @comment changed @ text @#!MARKER_PERL_CMD #shpp include ../bldcfg/paths.shpp require 5; use strict; ($main::progname = $0) =~ s/^.*\/([^\/]+)/$1/; $main::rcs_id = '$Header: /home/ahuxley/dev/active/small/bin/RCS/inews-mail2news.shpp,v 1.1 2001/05/04 11:18:24 ahuxley Exp ahuxley $'; $main::version_scheme = 'rcs'; ############################################################################## # # CONFIGURABLE STUFF STARTS HERE # ############################################################################## ############################################################################## # # CONFIGURABLE STUFF ENDS HERE # ############################################################################## sub main { my(@@ARGV) = @@_; my($letter_file, %headers, @@bodylines, $newsgroups_header); my($article_file, $article_handle); my($newsgroups_header_name, $newsgroups_header_value, $formatted_date, $recipient, @@mailto); while (defined($ARGV[0]) && $ARGV[0] =~ /^-/) { $_ = shift @@ARGV; if (/^-d(.*)/) { $main::verboselevel = ($1 ? $1 : shift @@ARGV); } elsif (/^-v$/) { $main::verboselevel = 3; } elsif (/^-V$/) { print "$main::progname $main::version\n"; exit 0; } else { &usage; } } ########################################################################## # # SANITY CHECKS # ########################################################################## (defined($ARGV[1])) && &usage; ########################################################################## # # GUTS START HERE # ########################################################################## %headers = (); @@bodylines = (); &debug(4, "main: loading rc file ..."); &load_rc(\%headers); if (defined($ARGV[0])) { &debug(4, "main: loading news article from cmdline par ..."); $article_file = $ARGV[0]; open(ARTICLE_HANDLE, $ARGV[0]) || &error("can't open article file ($ARGV[0]): $!"); $article_handle = \*ARTICLE_HANDLE; } else { &debug(4, "main: loading news article from stdin ..."); $article_handle = \*STDIN; } &parse_mail($article_handle, \%headers, \@@bodylines); if (defined(@@ARGV)) { close(ARTICLE_HANDLE); } &debug(4, "main: converting 'Newsgroups' to 'To' ..."); $newsgroups_header = &mail_header_del(\%headers, 'Newsgroups'); ($newsgroups_header_name, $newsgroups_header_value) = split(/:\s+/, $newsgroups_header, 2); chomp($formatted_date = `date '+%Y%m%d'`); $recipient = "mail2news-$formatted_date-$newsgroups_header_value\@@anon.lcs.mit.edu"; #$recipient = "alexis\@@pobox.sk"; @@mailto = ($recipient); &mail_header_add(\%headers, "To: $recipient"); &mail_display(\%headers, \@@bodylines); &debug(4, "main: adding X-Mailer ..."); &mail_header_add(\%headers, "X-Mailer: $main::progname $main::version"); &debug(4, "main: dispatching ..."); &dispatch_mail(\%headers, \@@bodylines, \@@mailto); return(0); } sub usage { print STDERR "Usage: $main::progname [ -v | -d ] [ ]\n"; print STDERR " $main::progname -V\n"; exit 1; } #shpp include ../lib/utils.pl.shpp #shpp include ../lib/mail.pl.shpp #shpp include ../lib/gep.pl.shpp @ 1.1 log @Initial revision @ text @d6 1 a6 1 $main::rcs_id = '$Header: /diskb/home/alexis/dev/active/small/bin/RCS/reset-xringd-after-ppp.shpp,v 1.1 2001/02/04 15:23:41 alexis Exp alexis $'; d82 1 a82 1 #$recipient = "ahuxley\@@eso.org"; @