• [slrn] post article from command line?

    From Grant Edwards@21:1/5 to All on Tue May 16 02:20:21 2023
    Is there a way to use slrn to post an article to an nntp server from
    the command line?

    If not, is there some other command-line utilty to do that?

    Python is removing NNTP support from the standard library, so my
    simple "inews" workalike is gong to stop working unless I start
    maintaining a Python NNTP implementation.

    :/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ted Heise@21:1/5 to Grant Edwards on Tue May 16 12:09:17 2023
    On Tue, 16 May 2023 02:20:21 -0000 (UTC),
    Grant Edwards <invalid@invalid.invalid> wrote:
    Is there a way to use slrn to post an article to an nntp server from
    the command line?

    If not, is there some other command-line utilty to do that?

    Python is removing NNTP support from the standard library, so my
    simple "inews" workalike is gong to stop working unless I start
    maintaining a Python NNTP implementation.

    :/


    This is the script I use on panix to periodically post an FAQ,
    perhaps it could be helpful.


    ------- begin quote -----------------------

    #!/usr/local/bin/perl5.22

    use warnings;
    use strict;
    use Net::NNTP;

    my $server_name="news.panix.com";

    my @post=`cat FAQ/araa-FAQ-v1.16`;

    my $Server = Net::NNTP->new($server_name, Reader => 1, Debug =>
    0);
    if (!$Server)
    {
    print " Can't connect to news! Not posted\n";
    }
    else
    {
    $Server->post();
    my $ServerCod = $Server->code();
    if ($ServerCod == 340)
    {
    $Server->datasend(@post);
    $Server->dataend;
    if (!$Server->ok())
    {
    my $ServerMsg = $Server->message();
    $Server->quit();
    print " Posting failed! Response from news server:\n" .
    $Server->code() . " $ServerMsg\n";
    }
    else
    {
    print " Posted OK\n";
    }
    }
    else
    {
    print " Post command not accept\n";
    }
    $Server->quit();
    }


    ------- end quote -------------------------


    I invoke it by a crontab entry. Can't recall where I got the
    script in the first place, but I'm *sure* it wasn't written by me.
    I probably just STFWd for it.

    --
    Ted Heise <theise@panix.com> West Lafayette, IN, USA

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Urs =?UTF-8?Q?Jan=C3=9Fen?=@21:1/5 to All on Tue May 16 12:32:59 2023
    If not, is there some other command-line utilty to do that?

    tinews uses perl Net::NNTP, <http://www.tin.org/bin/man.cgi?section=1&topic=tinews>

    <http://bzr.tin.org/tools/tinews.pl> <ftp://ftp.tin.org/pub/news/clients/tin/tools/tinews.pl>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam@21:1/5 to invalid@invalid.invalid on Tue May 16 14:55:00 2023
    On Tue, 16 May 2023 02:20:21 -0000 (UTC), Grant Edwards <invalid@invalid.invalid> wrote:

    Is there a way to use slrn to post an article to an nntp server from
    the command line?

    If not, is there some other command-line utilty to do that?

    Python is removing NNTP support from the standard library, so my
    simple "inews" workalike is gong to stop working unless I start
    maintaining a Python NNTP implementation.

    :/


    You can create the message and use the slrnpull program to post it to
    a newsgroup.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ivan Shmakov@21:1/5 to All on Fri May 19 21:40:43 2023
    On 2023-05-16, Grant Edwards wrote:

    Is there a way to use slrn to post an article to an nntp server
    from the command line?

    Aside of using the already suggested slrnpull(1)? None that
    I'd know of.

    If not, is there some other command-line utilty to do that?

    Python is removing NNTP support from the standard library, so my
    simple "inews" workalike is gong to stop working unless I start
    maintaining a Python NNTP implementation.

    Is there a particular reason you can't use inews(1) proper?

    NNTP isn't /that/ sophisticated (or quickly evolving, FTM)
    a protocol, so maintaining the library would probably only
    take a modest effort. But aside of that, as other posters
    have already pointed, there's Net::NNTP for Perl, and AFAIK,
    it isn't going to be removed anytime soon.

    --
    FSF associate member #7257 http://am-1.org/~ivan/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adam W.@21:1/5 to Grant Edwards on Sat May 20 04:26:27 2023
    Grant Edwards <invalid@invalid.invalid> wrote:

    Python is removing NNTP support from the standard library, so my
    simple "inews" workalike is gong to stop working unless I start
    maintaining a Python NNTP implementation.

    Is there any reason to not use rpost?

    Here's one of my quick and dirty scripts:

    #!/usr/bin/env python3

    import os
    import subprocess

    dir = "/usr/local/news/spool/news-stat"
    list = os.listdir(dir)

    for entry in list:
    if not entry.endswith(".to-be-posted"):
    continue
    pathname = dir + "/" + entry
    basename = pathname.replace(".to-be-posted", "")
    tmpname = basename + ".posting"
    os.rename(pathname, tmpname)
    p = subprocess.run("/usr/bin/rpost localhost -u -U (redacted) -P (redacted) -M < " + tmpname, shell=True)
    if p.returncode != 0:
    print("Command failed")
    os.rename(tmpname, pathname)
    else:
    print("Command succeeded")
    os.remove(tmpname)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)