Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

Dreams are free, but there's a small charge for alterations.


rocksolid / Linux / simple newsspool creator

SubjectAuthor
* simple newsspool creatorRetro Guy
`* Re: simple newsspool creatortrw
 +* Re: simple newsspool creatorRetro Guy
 |+- Re: simple newsspool creatorRetro Guy
 |`* Re: simple newsspool creatortrw
 | `* Re: simple newsspool creatorRetro Guy
 |  `* Re: simple newsspool creatorRetro Guy
 |   `* Re: simple newsspool creatorRetro Guy
 |    `* Re: simple newsspool creatorRetro Guy
 |     `- Re: simple newsspool creatorRetro Guy
 `* Re: simple newsspool creatorRetro Guy
  `- Re: simple newsspool creatorRetro Guy

1
Subject: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: Rocksolid Light
Date: Wed, 18 Sep 2019 09:28 UTC
Path: i2pn2.org!rocksolid2!.POSTED.localhost!not-for-mail
From: Retro ...@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: simple newsspool creator
Date: Wed, 18 Sep 2019 09:28:05 -0000 (UTC)
Organization: Rocksolid Light
Message-ID: <f19516753ca3699bd8ddf6b691f77916$1@news.novabbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 18 Sep 2019 09:28:05 -0000 (UTC)
Injection-Info: novabbs.com; posting-account="retrobbs1"; posting-host="localhost:127.0.0.1";
logging-data="31152"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com
X-Rslight-Site: $2y$10$IiOr7HA726ffONyXWFhJaO6uSXPrrW8JJNC3w/YmeoZpgoTHqE.HS
View all headers
I've written a small script that will connect to a remote news server as a reader, and create a local spool from the articles. This spool matches an inn spool exactly, and will clone the remote server's spool for whatever groups you want, and however may days you configure. It is meant to be run as a cron job.

It's not done, so not releasing it yet (no error checking or tracking last article number yet).

This will allow rocksolid overboard to work on a site with no news server, and I think this may also allow bbs to run on a server without a news server. It may have uses besides these also.

Retro Guy

--
Posted on Rocksolid Light



Subject: Re: simple newsspool creator
From: trw
Newsgroups: rocksolid.shared.linux
Organization: Dancing elephants
Date: Wed, 18 Sep 2019 17:20 UTC
References: 1
Path: i2pn2.org!rocksolid2!def2!.POSTED.rocksolid2!not-for-mail
From: trw...@i2pmail.org (trw)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Wed, 18 Sep 2019 13:20:20 -0400
Organization: Dancing elephants
Lines: 13
Message-ID: <qltp0d$j87$1@def2.org>
References: <f19516753ca3699bd8ddf6b691f77916$1@news.novabbs.com>
Reply-To: trw <trw@i2pmail.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 18 Sep 2019 17:20:13 -0000 (UTC)
Injection-Info: def2.org; posting-host="rocksolid2:192.168.1.189";
logging-data="19719"; mail-complaints-to="usenet@def2.org"
User-Agent: FUDforum 3.0.7
X-FUDforum: 0374ec857381230fa83049643ce3cdee <10151>
View all headers
This will allow rocksolid overboard to work on a site with no news server,
that's great. it will lower the effort to install a new node.

and I think this may also allow bbs to run on a server without a news server.
unfortunately not (or at least not if you want to do posts on the node). posting works only locally.


It may have uses besides these also.
is it a shellscript ? if nothing else, i would love to look at the code ans learn.

cheers

trw

Posted on: def3.i2p


Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: Rocksolid Light
Date: Thu, 19 Sep 2019 08:42 UTC
References: 1 2
Path: i2pn2.org!rocksolid2!.POSTED.localhost!not-for-mail
From: Retro ...@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Thu, 19 Sep 2019 08:42:41 -0000 (UTC)
Organization: Rocksolid Light
Message-ID: <189d08617cacad09feeb944c61ede0ca$1@news.novabbs.com>
References: <f19516753ca3699bd8ddf6b691f77916$1@news.novabbs.com> <qltp0d$j87$1@def2.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 19 Sep 2019 08:42:41 -0000 (UTC)
Injection-Info: novabbs.com; posting-account="retrobbs1"; posting-host="localhost:127.0.0.1";
logging-data="14271"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com
X-Rslight-Site: $2y$10$r54iYqthgXGKrvyCmXuEte3eJcPXo.VW6FpROVkjGRJi7MVOSZSqG
View all headers
trw wrote:

and I think this may also allow bbs to run on a server without a news
server.
unfortunately not (or at least not if you want to do posts on the node).
posting works only locally.

Does bbs use rpost? If so, I have a bash script I wrote that posts to a remote server using rpost. Seems to work fine:

rpost $newsserver -U $username -P $password <<%end
$(<message.including.headers.txt)
%end

If your outgoing message is just header and body lines of plain text, that should work. You can also send headers one by one, or whatever you want before %end.

It may have uses besides these also.
is it a shellscript ? if nothing else, i would love to look at the code ans
learn.

My spool script is written in php.

Retro Guy

--
Posted on Rocksolid Light



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: Rocksolid Light
Date: Thu, 19 Sep 2019 11:25 UTC
References: 1 2 3
Path: i2pn2.org!rocksolid2!.POSTED.localhost!not-for-mail
From: Retro ...@rslight.i2p (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Thu, 19 Sep 2019 11:25:44 -0000 (UTC)
Organization: Rocksolid Light
Message-ID: <daaddaad320f6b7c943b9113684a82ca$1@news.novabbs.com>
References: <f19516753ca3699bd8ddf6b691f77916$1@news.novabbs.com> <qltp0d$j87$1@def2.org> <189d08617cacad09feeb944c61ede0ca$1@news.novabbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 19 Sep 2019 11:25:44 -0000 (UTC)
Injection-Info: novabbs.com; posting-account="retrobbs1"; posting-host="localhost:127.0.0.1";
logging-data="5229"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com
X-Rslight-Site: $2y$10$2ajAJFKwSByGNroccu7iAeFtk41vJBn.SJb4cVn07K7VjaYI28wda
View all headers
Currently running this script via cron to see how well it works (or doesn't :)

So far it's going well, I have a cloned rocksolid/* spool now and we'll see if it stays properly in sync.

Retro Guy

--
Posted on Rocksolid Light



Subject: Re: simple newsspool creator
From: trw
Newsgroups: rocksolid.shared.linux
Organization: Dancing elephants
Date: Thu, 19 Sep 2019 21:45 UTC
References: 1
Path: i2pn2.org!rocksolid2!def2!.POSTED.rocksolid2!not-for-mail
From: trw...@i2pmail.org (trw)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Thu, 19 Sep 2019 17:45:15 -0400
Organization: Dancing elephants
Lines: 2
Message-ID: <qm0ssn$1qu$1@def2.org>
References: <189d08617cacad09feeb944c61ede0ca$1@news.novabbs.com>
Reply-To: trw <trw@i2pmail.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 19 Sep 2019 21:44:55 -0000 (UTC)
Injection-Info: def2.org; posting-host="rocksolid2:192.168.1.189";
logging-data="1886"; mail-complaints-to="usenet@def2.org"
User-Agent: FUDforum 3.0.7
X-FUDforum: 0374ec857381230fa83049643ce3cdee <10158>
View all headers
Does bbs use rpost? If so, I have a bash script I wrote that posts to a remote server using rpost. Seems to work fine:

No, I have tried that before. bbs uses rnews, and the vm does not have a rpost binary.
Posted on: def3.i2p


Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Fri, 20 Sep 2019 00:38 UTC
References: 1
Path: i2pn2.org!i2pn.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-54k-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Fri, 20 Sep 2019 00:38:56 +0000
Organization: RetroBBS
Message-ID: <12cc75309566900ef9e0a6551c7d4946$1@www.rocksolidbbs.com>
References: <qm0ssn$1qu$1@def2.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="27427"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: trw
X-Comment-To: trw
In-Reply-To: <qm0ssn$1qu$1@def2.org>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$Q0/r4ucRaBOjkmv1Vr5OOOXrvWrcewvlWBhLMRraqK5hjvjREJtl.
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: trw
trw wrote:

Does bbs use rpost? If so, I have a bash script I wrote that posts to a
remote server using rpost. Seems to work fine:

No, I have tried that before. bbs uses rnews, and the vm does not have a
rpost binary.

Ah, ok. I was thinking your were using rpost.

One thing about my script 'spoolnews.php', is that it can be modified to read articles from the server, then reformat them for injecting elsewhere. I'll try to keep the code as non-inn specific as possible.

Retro Guy


--
Posted on RetroBBS



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Fri, 20 Sep 2019 00:40 UTC
References: 1
Path: i2pn2.org!i2pn.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-54k-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Fri, 20 Sep 2019 00:40:04 +0000
Organization: RetroBBS
Message-ID: <b47d92683cacf88e3bd0c914f63ec987$1@www.rocksolidbbs.com>
References: <12cc75309566900ef9e0a6551c7d4946$1@www.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="27427"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: Retro Guy
X-Comment-To: Retro Guy
In-Reply-To: <12cc75309566900ef9e0a6551c7d4946$1@www.rocksolidbbs.com>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$.33k.TB8N0MmPD7lzB.VK.k9BecAASTmvcv3XoKolDqHjpT9EBMRK
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: Retro Guy
Also, I just realized (why didn't I before?) that I can make a perfectly good news spool from a Synchronet installation. I'm doing that now to see how well overboard may work if the news server is other than inn.

Retro Guy

--
Posted on RetroBBS



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Fri, 20 Sep 2019 01:58 UTC
References: 1
Path: i2pn2.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-om4-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Fri, 20 Sep 2019 01:58:21 +0000
Organization: RetroBBS
Message-ID: <94d5fa29fce943d8301b87658f3c8f48$1@www.rocksolidbbs.com>
References: <b47d92683cacf88e3bd0c914f63ec987$1@www.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="23008"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: Retro Guy
X-Comment-To: Retro Guy
In-Reply-To: <b47d92683cacf88e3bd0c914f63ec987$1@www.rocksolidbbs.com>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$rPPJjkXwowiTQcL9ud.Uz.1vUXFGqMEtlX6yQVxJjfD5ZZ6Rrgi5O
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: Retro Guy
Retro Guy wrote:

Also, I just realized (why didn't I before?) that I can make a perfectly good news spool from a Synchronet installation. I'm doing that now to see how well overboard may work if the news server is other than inn.

This seems to be working.

I've created and added a cron job to keep a news spool up to date on retrobbs, which has Synchronet as a news server, not inn.

The overboard for rocksolid.* and DOVE-Net.* is working, but it will take a few days to sort properly, as it uses the file timestamps to predict the article date (the date displayed is from the article).

Since the spool was created all at once, every article looks like it is new. I want to monitor over the next few days to see how it sorts out.

Retro Guy


--
Posted on RetroBBS



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Fri, 20 Sep 2019 02:41 UTC
References: 1
Path: i2pn2.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-2yp-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Fri, 20 Sep 2019 02:41:19 +0000
Organization: RetroBBS
Message-ID: <9a4b75ece03eabf34a535eb6090beed6$1@www.rocksolidbbs.com>
References: <94d5fa29fce943d8301b87658f3c8f48$1@www.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="4905"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: Retro Guy
X-Comment-To: Retro Guy
In-Reply-To: <94d5fa29fce943d8301b87658f3c8f48$1@www.rocksolidbbs.com>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$zTVMT7WpFwEwTVq40i52xe4NNQCr7wGw4xsWp.VAhcShqZU8Qvzey
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: Retro Guy
Retro Guy wrote:

The overboard for rocksolid.* and DOVE-Net.* is working, but it will take a few days to sort properly, as it uses the file timestamps to predict the article date (the date displayed is from the article).

Found a bug that saved the last article number retrieved plus one (so one article skipped each run). That's been fixed. I'll tackle bugs as they show up, which I expect plenty of at the start.

The overboard(s) on retrobbs now are running using the spoolnews script, so it doesn't matter where the news server is (Synchronet or inn, or ???).

Retro Guy
--
Posted on RetroBBS



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Fri, 20 Sep 2019 08:36 UTC
References: 1
Path: i2pn2.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-kqi-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Fri, 20 Sep 2019 08:36:27 +0000
Organization: RetroBBS
Message-ID: <85e189fa43401095d42de921524f46cd$1@www.rocksolidbbs.com>
References: <9a4b75ece03eabf34a535eb6090beed6$1@www.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="29302"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: Retro Guy
X-Comment-To: Retro Guy
In-Reply-To: <9a4b75ece03eabf34a535eb6090beed6$1@www.rocksolidbbs.com>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$ozeJbvkvL7ZTAPNxhSVCcOOvRHb0nwmtT/n5T74Rn/mtVv6.0ZJhG
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: Retro Guy
Retro Guy wrote:

Found a bug that saved the last article number retrieved plus one (so one article skipped each run). That's been fixed. I'll tackle bugs as they show up, which I expect plenty of at the start.

Another bug found: Was creating zero length files for articles that don't exist on the server. Fixed.

Retro Guy

--
Posted on RetroBBS



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Sun, 22 Sep 2019 02:34 UTC
References: 1
Path: i2pn2.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-9v2-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Sun, 22 Sep 2019 02:34:41 +0000
Organization: RetroBBS
Message-ID: <ec52c0c8c304330c4cf219466d6e49c3$1@www.rocksolidbbs.com>
References: <qltp0d$j87$1@def2.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="22541"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: trw
X-Comment-To: trw
In-Reply-To: <qltp0d$j87$1@def2.org>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$tR2LGXqEINYcAY9V8M1wA.fLKiELIxVA8mma6bpRlqhvY23Zaopty
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: trw
Here is the 'spoolnews' php script. I'm still working on it, but this is working well so far.

You need to configure a few lines near the top (server, username etc.) and create 'groups.txt' containing just the list of newsgroups you want to spool. This fill will be modified by the script to track last saved article numbers.

Put this file, and groups.txt in the same dir, and make sure the user can write to that directory so it can create the 'articles' directory tree there. This is meant to be run as a cron job.

There are some known (to me) bugs, but it is working well.

Retro Guy

-----------------------
#!/usr/bin/php
<?php
/*  spoolnews NNTP news spool creator
 *  Version: 0.2.0
 *  Download: https://news.novabbs.com/getrslight
 *
 *  E-Mail: retroguy@novabbs.com
 *  Web: https://news.novabbs.com
 *
 *  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
 */
 $server_auth_user = "<username>";
$server_auth_pass = "<password>";
$server = "news.example.com";
$port = "119";

$maxarticles = 10;
$workpath="/etc/rslight/spoolnews/";
$path=$workpath."articles/";
$groupfile="groups.txt";

# Iterate through groups $groupconfig = $workpath.$groupfile;
$grouplist = file($groupconfig, FILE_IGNORE_NEW_LINES);
foreach($grouplist as &$findgroup) {
  $name = explode(':', $findgroup);
  echo "nRetrieving articles for: ".$name[0]."...  rn";
  get_articles($name[0]);
}
echo "nDonern";

function get_articles($group) {
  global $server_auth_user, $server_auth_pass, $server, $port, $maxarticles, $workpath, $path, $groupfile;
  $grouppath = $path.preg_replace('/./', '/', $group);
    # Check if group exists. Open it if it does
  $ns=nntp_open($server, $port);
  fputs($ns, "group ".$group."rn");
  $response = line_read($ns);
  if (strcmp(substr($response,0,3),"411") == 0) {
    echo "n".$response."n";
    fclose($ns);
    return(1);
  }
    # Get config
  $groupconfig = $workpath.$groupfile;
  $grouplist = file($groupconfig, FILE_IGNORE_NEW_LINES);
  foreach($grouplist as &$findgroup) {
    $name = explode(':', $findgroup);
    if (strcmp($name[0], $group) == 0) {
      if (isset($name[1]))
        $article = $name[1] + 1;
      break;
    }
  }
    # Split group config line to get last article number
  $detail = explode(" ", $response);
  if (!isset($article)) {
    $article = $detail[2];
  }
  if($article < $detail[2]) {
    $article = $detail[2];
  }
    # Pull articles and save them in our spool
  @mkdir($grouppath,0755,'recursive');
  $i=0;
  while ($article <= $detail[3]) {
    if (file_exists($grouppath."/".$article)) {
      echo "nAlready Exists: ".$group." ".$article."n";
      $article++;
    } else {
      fputs($ns, "article ".$article."rn");
      $response = line_read($ns);
      if (strcmp(substr($response,0,3),"220") != 0) {
echo "n".$response."n";
$article++;
continue;
      }
      $response = line_read($ns);
      $articleHandle = fopen($grouppath."/".$article, 'w+');
      while(strcmp($response,".") != 0)       {
fputs($articleHandle, $response."n");
$response = line_read($ns);
      }
      @fclose($articleHandle);
      echo "nRetrieved: ".$group." ".$article."n";
      $i++;
      if($i > $maxarticles)
break;
      $article++;
    }
  }
  nntp_close($ns);
  # Save config
  $saveconfig = fopen($groupconfig, 'w+');
  foreach($grouplist as &$savegroup) {
    $name = explode(':', $savegroup);
    if (strcmp($name[0], $group) == 0) {
      fputs($saveconfig, $group.":".$article."n");
    } else {
      fputs($saveconfig, $savegroup."n");
    }
  }
  fclose($saveconfig);
}

function nntp_open($nserver=0,$nport=0) {
  global $text_error,$server_auth_user,$server_auth_pass,$readonly;
  global $server,$port;
  // echo "<br>NNTP OPEN<br>";
  $authorize=((isset($server_auth_user)) && (isset($server_auth_pass)) &&
  ($server_auth_user != ""));
  if ($nserver==0) $nserver=$server;
  if ($nport==0) $nport=$port;
  $ns=@fsockopen($nserver,$nport);
  $weg=line_read($ns);  // kill the first line
  if (substr($weg,0,2) != "20") {
    echo "<p>".$text_error["error:"].$weg."</p>";
    fclose($ns);
    $ns=false;
  } else {
    if ($ns != false) {
      fputs($ns,"MODE readerrn");
      $weg=line_read($ns);  // and once more
      if ((substr($weg,0,2) != "20") &&
((!$authorize) || ((substr($weg,0,3) != "480") && ($authorize)))) {
echo "<p>".$text_error["error:"].$weg."</p>";
      fclose($ns);
      $ns=false;
}
    }
    if ((isset($server_auth_user)) && (isset($server_auth_pass)) &&
      ($server_auth_user != "")) {
      fputs($ns,"AUTHINFO USER $server_auth_userrn");
    $weg=line_read($ns);
    fputs($ns,"AUTHINFO PASS $server_auth_passrn");
    $weg=line_read($ns);
    /* Only check auth if reading and posting same server */
    if (substr($weg,0,3) != "281" && !(isset($post_server)) && ($post_server!="")) {
      echo "<p>".$text_error["error:"]."</p>";
      echo "<p>".$text_error["auth_error"]."</p>";
    }
      }
  }
  if ($ns==false) echo "<p>".$text_error["connection_failed"]."</p>";
  return $ns;
}

/*
* Close a NNTP connection
*
* $ns: the handle of the connection
*/
function nntp_close(&$ns) {
  if ($ns != false) {
    fputs($ns,"QUITrn");
    fclose($ns);
  }
}

function line_read(&$ns) {
  if ($ns != false) {
    $t=str_replace("n","",str_replace("r","",fgets($ns,1200)));
    echo ".";
    return $t;
  }
}
?>

--
Posted on RetroBBS



Subject: Re: simple newsspool creator
From: Retro Guy
Newsgroups: rocksolid.shared.linux
Organization: RetroBBS
Date: Sun, 22 Sep 2019 02:42 UTC
References: 1
Path: i2pn2.org!rocksolid2!.POSTED.rocksolid3!not-for-mail
From: retro....@retrobbs.rocksolidbbs.com.remove-r5e-this (Retro Guy)
Newsgroups: rocksolid.shared.linux
Subject: Re: simple newsspool creator
Date: Sun, 22 Sep 2019 02:42:41 +0000
Organization: RetroBBS
Message-ID: <e3a8da6e5153d2434636317238627d67$1@www.rocksolidbbs.com>
References: <ec52c0c8c304330c4cf219466d6e49c3$1@www.rocksolidbbs.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: novabbs.com; posting-account="rslight.i2p"; posting-host="rocksolid3:192.241.178.238";
logging-data="25631"; mail-complaints-to="usenet@novabbs.com"
User-Agent: rslight (http://news.novabbs.com)
To: Retro Guy
X-Comment-To: Retro Guy
In-Reply-To: <ec52c0c8c304330c4cf219466d6e49c3$1@www.rocksolidbbs.com>
X-FTN-PID: Synchronet 3.17a-Linux Dec 29 2018 GCC 6.3.0
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on rocksolidbbs.com
X-Rslight-Site: $2y$10$0T19WXzFuZmLD75KHgnvnesFE2cN7E84XqLF6TYm.l0IA0Cxqk3uy
X-Gateway: retrobbs.rocksolidbbs.com [Synchronet 3.17a-Linux NewsLink 1.110]
View all headers
  To: Retro Guy
Posting messed up the linefeeds a bit, but you can grab a copy from the 'getrslight' link on rslight.

Just rename from spoolnews.php.txt to spoolnews.php

Retro Guy

--
Posted on RetroBBS



1
rocksolid light 0.7.2
clearneti2ptor