🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rocksolid.nodes
Article #256

Re: hey, what do you know: vichan supports nntp

#256
From: Retro Guy
Date: Fri, 15 May 2020 22:48
69 lines
3581 bytes
anon wrote:

> 
> fputs($s,"AUTHINFO USER $server_auth_user
> ");
>       $weg=line_read($s);
>       fputs($s,"AUTHINFO PASS $server_auth_pass
> ");
>       $weg=line_read($s);
>       if (substr($weg,0,3) != "281" {
>         AUTH FAILED
>         can't do stuff...
>       } else {
>         IT DIDN"T FAIL, YAY!
>         do stuff...
>       }
> 
> And I guess the "do stuff" would be some variant of message_post and
> message_post_with_attachment from /lib/post.inc.php. not sure it is better
> to just put that code into the vichan function, or to call some function
> in the rslight framework. i guess the latter, this way we can do minimal
> changes on the vichan code. actually, the way this is done in vi might be
> superior, because the whole message is already composed and then sent in
> one go (instead of composing and sending the individual pieces). now it
> gets a bit tricky, i have to read up a bit on nntp before i can continue.

Yes, rslight builds the message. I wouldn't use message_post with vichan, 
it's not necessary. If the message is already built, it's easy to post 
straight to the nntp server. See the 'post_articles' function in send.php. 
It just sends messages sitting in a folder but as long as it has a message 
it's a simple matter to send it:

if(!is_file($outgoing_dir.$message)) {
      continue;
    }
    echo "Sending: ".$outgoing_dir.$message."\r\n";
    fputs($ns, "MODE READER\r\n");
    $response = line_read($ns);
    if (strcmp(substr($response,0,3),"200") != 0) {
        file_put_contents($logfile, "\n".format_log_date()." ".
$config_name." Unexpected response to MODE command: ".$respon
se, FILE_APPEND);
      return $response;
    }
    fputs($ns, "POST\r\n");
    $response = line_read($ns);
    if (strcmp(substr($response,0,3),"340") != 0) {
      file_put_contents($logfile, "\n".format_log_date()." ".$config_name." 
Unexpected response to POST command: ".$response
, FILE_APPEND);
      return $response;
    }
    $message_fp = fopen($outgoing_dir.$message, "rb");
    while (($msgline = fgets($message_fp, 4096)) !== false) {
      fputs($ns, $msgline);
    }
    fputs($ns, ".\r\n");
    fclose($message_fp);
    $response = line_read($ns);
    if (strcmp(substr($response,0,3),"240") == 0) {
      unlink($outgoing_dir.$message);
      file_put_contents($logfile, "\n".format_log_date()." ".$config_name." 
Posted: ".$message.": ".$response, FILE_APPEND);
    } else {
      file_put_contents($logfile, "\n".format_log_date()." ".$config_name." 
Failed to POST: ".$message.": ".$response, FILE_
APPEND);
      continue;
    }
Technical Details
Message-ID: <1df84088c53e8cd94c39faee678d0046$1@rslight.i2p>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!i2pn2.org!.POSTED!not-for-mail
References: <4d8c8c1eecefe59c0b27e5a09370a4b1@def4> <e1cece3cd885d6d6e2fae84d9cf1d639@def4>

Show Full Headers
Complete Article Headers
Message-ID: <1df84088c53e8cd94c39faee678d0046$1@rslight.i2p>
Subject: Re: hey, what do you know: vichan supports nntp
Date: Fri, 15 May 2020 15:48:59 -0700
From: Retro Guy <retroguy@retrobbs.rocksolidbbs.com>
References: <4d8c8c1eecefe59c0b27e5a09370a4b1@def4> <e1cece3cd885d6d6e2fae84d9cf1d639@def4>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!i2pn2.org!.POSTED!not-for-mail
Newsgroups: rocksolid.nodes
Organization: Rocksolid
Lines: 69
Mime-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7Bit
Injection-Info: i2pn2.org; posting-account="retrobbs1";
 logging-data="29482"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: KNode/4.14.1
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.com