#!/usr/bin/perl -P
###############################################################################
## pcp - Perl Cron-Poster: a short perlprogram that helps you posting ..     ##
##                                                       .. FAQ's and stuff  ##
## Copyright (C) 2000 by Rhonda D'Vine <rhonda@deb.at>                       ##
##                                                                           ##
## This program is free software; you can redistribute it and/or modify      ##
## it under the terms of the GNU General Public License as published by      ##
## the Free Software Foundation; either version 2 of the License, or         ##
## (at your option) any later version.                                       ##
##                                                                           ##
## This program is distributed in the hope that it will be useful,           ##
## but WITHOUT ANY WARRANTY; without even the implied warranty of            ##
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             ##
## GNU General Public License for more details.                              ##
##                                                                           ##
## You should have received a copy of the GNU General Public License         ##
## along with this program; if not, write to the Free Software               ##
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA ##
###############################################################################

#define VERSION '0.8.2'
#define GROUP   'alt.test'
#define SUBJECT '[info] mini-FAQ zur FAQ'
#define ORG     'FAQ-Team for at.linux'
#define MID     '<FAQ-at.linux-Posting.%4d-%02d-%02d@skater.priv.at>'
#define MIDFILE '/home/rhonda/share/faq.mid'

@mons=("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
@wds =("Sun","Mon","Tue","Wed","Thu","Fri","Sat");

($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime(time);

# generate Date:-Header string
$timestr = sprintf("%s, %d %s %d %02d:%02d:%02d +0100",
              $wds[$wday], $mday, $mons[$mon], ($year+1900), $hour, $min, $sec);

# generate MID
$mid = sprintf(MID, ($year+1900), ($mon+1), $mday);

# get old MID
open (OLD, "<".MIDFILE) || die "%0: can't read old mid\n";
$midold = <OLD>;
close (OLD);

# write new MID
open (NEW, ">".MIDFILE) || die "%0: can't write new mid\n";
print NEW ("$mid");
close (NEW);

use Net::NNTP;

$nntp=Net::NNTP->new || die ("$0: connect failed\n");  # connect to NNTPSERVER

$nntp->post("From: Rhonda D'Vine <rhonda\@deb.at>
Date: $timestr
Newsgroups: ".GROUP."
Organization: ".ORG."
User-Agent: pcp/".VERSION." (Perl)
Message-ID: $mid
Supersedes: $midold
Subject: [Info] ".SUBJECT."
X-Complaints-To: rhonda\@deb.at
X-User-Agent-URL: <https://rhonda.deb.at/pcp/>

Nur ein Test, also nicht drueber aufregen, passiert ja nichts :)

So long!
 perl, i.A. Rhonda D'Vine\n");

$nntp->quit;
