🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #31685

Re: How to synchronize two news servers

#31685
From: Hans Lambermont
Date: Thu, 24 Sep 1998 00:00
137 lines
4498 bytes
Claire Harrison wrote:
> It seems that I spoke too soon...
> For those articles that are cross-posted, there is an Xref header and life is
> good.
> 
> But, if the article isn't cross-posted then Netscape's News Server does not seem
> to give it an Xref header so my inn 2.1 rejects it.  I suspect Netscape's news
> server was based on inn 1.4 rather than 1.5.
> 
> Does anyone happen to know how to get Netscape News 3.5 to add an Xref header to
> ALL articles?

I think these will work for you: (addxref.pl and createbatch.pl)

-------------------------------------------------------------
#!/usr/local/bin/perl5
# Add Xref: header lines for articles that don't have them yet.
# This works for the so called traditional spool (INN oriented)
# Lateron use something like createbatch.pl to hand the existing article
# list to ao. innfeed. Crufted by Hans Lambermont newsmaster@philips.com

$pathname='fill_in_your_news_header_path';
# cd /your_news_spool && find . -type f -print | addxref.pl

$justtest=1;

&looparticles;

sub looparticles {
  while (<>) {
    chomp;
    if (/^.*\/\d*$/) {
      # only take number files
      $artfile = $_;
      &doarticle;
    } else {
      print "Ignore $_\n";
    }
  }
  exit 0;
}

sub doarticle {
  $header=1;
  $xreffound=0;
  open(ARTFILE,"$artfile") || die "Cant open $artfile : $!";
  open(NEWARTF,">${artfile}.new") || die "Cant create ${artfile}.new :
$!";
  while (<ARTFILE>) {
    if (/(^Xref:.*$)/) { 
      $xreffound=$1;
    }
    if (/Message-ID:\s+/) {
      $id=$';
      chomp $id;
    }
    if ($header) {
      if (/^$/) {
        # header end
        $header=0;
        if (! $xreffound) {
          $_ = $artfile;
          s@/@.@g;
          if ( ! /(^.*)\.(\d*$)/) {
            die "$artfile match error : $!";
          }
          $np = $1; $artname = $2;
          print "$artfile -> Xref: ${np}:${artname}\n";
          print NEWARTF "Xref: $pathname ${np}:${artname}\n\n";
        } else {
          print "Found Xref in $artfile : $xreffound\n";
          print NEWARTF $_;             
        }
      } else {
        print NEWARTF $_;               
      }
    } else {
      print NEWARTF $_;         
    }
  }
  close(NEWARTF);
  close(ARTFILE);
  if (! $justtest) {
    unlink $artfile;
    rename "${artfile}.new", $artfile;
  }
}

-------------------------------------------------------------------------

#!/usr/local/bin/perl5
# Createbatch, hand the existing article list to ao. innfeed.
# Crufted by Hans Lambermont newsmaster@philips.com

# cd /your_news_spool && find . -type f -print | createbatch.pl >
/tmp/list

&looparticles;

sub looparticles {
  while (<>) {
    chomp;
    if (/^.*\/\d*$/) {
      # only take number files
      $artfile = $_;
      &doarticle;
    } else {
      print STDERR "Ignore $_\n";
    }
  }
  exit 0;
}

sub doarticle {
  open(ARTFILE,"$artfile") || die "Cant open $artfile : $!";
  while (<ARTFILE>) {
    if (/^Message-ID:\s+(<.*>$)/) {
      $id=$1;
      last;
    }
  }
  close(ARTFILE);
  print "$artfile $id\n";
}

----------------------------------------------------------------------

regards,
   Hans

-- 
Ir. Hans Lambermont          intranet url:http://garg.mpn.cp.philips.com
TIS/INS, Intranet Service Development   Hans.Lambermont@nl.origin-it.com
Origin IT Systems Management/NL bv    phone/fax: (+31 40 27) 85376/88729
PO Box 218, 5600MD Eindhoven, Netherlands VN507    GSM: (+31) 6 53252172

Technical Details
Message-ID: <360A049B.5833D78B@nl.origin-it.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <3602C276.7B16CFDB@videotron.ab.ca> <36068D13.1AEE8F93@videotron.ab.ca> <3606CDF8.189BC687@videotron.ab.ca>

Show Full Headers
Complete Article Headers
Message-ID: <360A049B.5833D78B@nl.origin-it.com>
Subject: Re: How to synchronize two news servers
Date: Thu, 24 Sep 1998 00:00:00 +0000
From: Hans Lambermont <Hans.Lambermont@nl.origin-it.com>
References: <3602C276.7B16CFDB@videotron.ab.ca> <36068D13.1AEE8F93@videotron.ab.ca> <3606CDF8.189BC687@videotron.ab.ca>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 394310203
Cache-Post-Path: dibbs1.mpn.cp.philips.com!unknown@garg.mpn.cp.philips.com
Content-Transfer-Encoding: 7bit
To: Claire Harrison <claire@videotron.ab.ca>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Origin
X-Cache: nntpcache 2.3.2.1 (see http://www.nntpcache.org/)
Mime-Version: 1.0
Newsgroups: news.software.nntp