🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #85440

NNTP API (Java)

#85440
From: Thufir Hawat
Date: Sat, 16 Feb 2013 09:28
67 lines
3680 bytes
I'm not quite understanding the NNTP protocol as it relates to article 
numbers upstream and downstream.  I'm using Java at the moment.

Using the GNU NNTP API:

http://www.gnu.org/software/classpathx/javamail/

it seems that there's no method for getting new articles for a given 
group.  While there's a method for seeing whether there are new messages:

http://www.gnu.org/software/classpathx/javamail/javadoc/gnu/mail/
providers/nntp/NNTPFolder.html#hasNewMessages%28%29

it returns only a boolean.  Java snippet:


NNTPStore ns = (NNTPStore) store;
          boolean hasNew = false;
          synchronized (ns.connection)
            {
              GroupResponse response = ns.connection.group(name);
              if (response.last > last)
                {
                  hasNew = true;
                }
              count = response.count;
              first = response.first;
              last = response.last;
            }
          return hasNew;

http://cvs.savannah.gnu.org/viewvc/*checkout*/mail/source/gnu/mail/
providers/nntp/NNTPFolder.java?root=classpathx&content-type=text%2Fplain

So, it seems like what's really needed is the value of response.last, and 
then anything, err, ?greater? than response.last (for the message ID int) 
should be what's fetched.

I'm confused.

When leafnode gets NNTP articles, it does something like:

news.software.nntp: skipping articles 1-27275 inclusive (initial limit)
news.software.nntp: considering articles 27276 - 27284

so it's using some logic to determine the article number to request, and 
then requests a range.  Can someone explain a bit the mechanics of how a 
downstream "client" knows what range of articles to ask for from the 
upstream "server"?  I'm running leafnode, which *is* a server (I think), 
so the nomenclature throws me a bit there.

My concern is that the "id" isn't reliable:

"Note that the message number for a particular Message can change during 
a session if other messages in the Folder are deleted and expunged."

http://docs.oracle.com/javaee/6/api/javax/mail/
Message.html#getMessageNumber%28%29

which is what the GNU is basing their NNTP client upon.  I suppose it's 
not the message number for a message which has been downloaded already, 
it's the message number on the "server" upstream which matters!?


thanks,

Thufir
Technical Details
Message-ID: <j204v9-5j2.ln1@dur.bounceme.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsfeed101.telia.com!starscream.dk.telia.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!thufir.eternal-september.org!.POSTED!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <j204v9-5j2.ln1@dur.bounceme.net>
Subject: NNTP API (Java)
Date: Sat, 16 Feb 2013 01:28:19 -0800
From: Thufir Hawat <hawat.thufir@gmail.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.20141118.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!newsfeed101.telia.com!starscream.dk.telia.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!thufir.eternal-september.org!.POSTED!not-for-mail
Newsgroups: news.software.nntp
Organization: A noiseless patient Spider
Lines: 67
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: thufir.eternal-september.org;
 posting-host="a6b6f25e9fc8f470090c619c4a0b5a51";
 logging-data="27061"; mail-complaints-to="abuse@eternal-september.org";
 posting-account="U2FsdGVkX19z/PtTBPXATkhT4bpMtdP6"
User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Cancel-Lock: sha1:ONwIgKPkrafqOTnXJsCo4TuYk9A=
X-Original-Bytes: 3310