Article View: news.software.nntp
Article #92404Re: Retro Guy's Scripts for importing old articles into INN
From: Julien ÉLIE
Date: Wed, 03 Sep 2025 19:56
Date: Wed, 03 Sep 2025 19:56
82 lines
4229 bytes
4229 bytes
Hi Jesse,
> Since there has been some discussion about archiving very old articles
> with INN, I found this e-mail thread I forgot about from Retro Guy (RIP)
> and wanted to share the knowledge in case it helps others.
Thanks for sharing!
> I haven't used
> the script yet, and he was using rpost to post as a client and stripping a
> lot of headers. Personally, I would leave the headers besides Date intact
> and use rnews to inject them.
The removed header fields should be OK to keep, indeed, as you intend to
inject articles through a relaying agent like innd with rnews. I think
Retro Guy removed them because they should not appear when injecting an
article (rpost may not like them, nor an injecting agent like nnrpd).
> foreach($articleline as $line) {
> if(trim($line) == "" && $lines > 0) {
> $is_header=0;
> $lines++;
> }
> if(stripos($line, "Injection-Info") === 0 && $is_header == 1) {
> continue;
> }
> if(stripos($line, "Newsgroups: ") === 0 && $is_header == 1) {
> $groups = explode(': ', $line);
> file_put_contents($newsgroupslist, $groups[1], FILE_APPEND);
> }
The loop does not seem to implement continuation lines.
So only the first line of the Newsgroups header field will be parsed
(though I bet continuation lines in that header field are very rare),
and as the script only removes the first line of the Injection-Info
header field (as far as I see), the remaining lines will be appended to
the previous header field...
> if(stripos($line, "Date: ") === 0 && $is_header == 1) {
> $finddate=explode(': ', $line);
> $newarticle[] = "Date: ".date("D, j M Y H:i
> T",strtotime($finddate[1]))."\n";
> continue;
> }
You'll be happy with the strtotime() function which magically decodes
all kinds of dates :)
There's an online tester for this function:
https://strtotime.co.uk/
Sun, 28-Jul-85 00:57:37 EDT
=> Sun, 28 Jul 1985 05:57:37 +0100
> if(trim($line) == ".") {
> $newarticle[] = "..\n";
> continue;
> }
In fact, the script should add ".$line\n" to $newarticle[] when $line
starts with a dot. This is what is called dot-stuffing.
The current code will unfortunately alter article bodies when there is a
leading dot. For instance, if I write ".test" in a mere line, it will
become "test" if I do not add a second "." when injecting the article.
You may also want to remove duplicated header fields (at least the ones
that should not appear twice), and maybe add a space after the colon
following a header field name if it is not present.
You'll soon have a working article rewriter system and achieve your
dream :-)
--
Julien ÉLIE
« C'est la goutte d'eau qui fait déborder le vase et qui met le feu aux
poudres. »
Technical Details
Message-ID:
<109a6h6$19rav$2@news.trigofacile.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.pugleaf.net!ygg-srl.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.trigofacile.com!.POSTED.2001:861:3f81:7990:2515:7129:5a91:16b3!not-for-mailReferences:
<109a4a2$ig7$2@nnrp.usenet.blueworldhosting.com>Show Full Headers
Complete Article Headers
Message-ID: <109a6h6$19rav$2@news.trigofacile.com> Subject: Re: Retro Guy's Scripts for importing old articles into INN Date: Wed, 3 Sep 2025 21:56:22 +0200 From: Julien ÉLIE <iulius@nom-de-mon-site.com.invalid> References: <109a4a2$ig7$2@nnrp.usenet.blueworldhosting.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.pugleaf.net!ygg-srl.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.trigofacile.com!.POSTED.2001:861:3f81:7990:2515:7129:5a91:16b3!not-for-mail Newsgroups: news.software.nntp Organization: Groupes francophones par TrigoFACILE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 3 Sep 2025 19:56:22 -0000 (UTC) Injection-Info: news.trigofacile.com; posting-account="julien"; posting-host="2001:861:3f81:7990:2515:7129:5a91:16b3"; logging-data="1371487"; mail-complaints-to="abuse@trigofacile.com" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:b0qkHnYS48sXIYao/0hjFjqOzM0= sha256:9nPJk8iFeak5RJM8gJm07UbR44YUnuDcfUvznc8/Iz4= In-Reply-To: <109a4a2$ig7$2@nnrp.usenet.blueworldhosting.com>