pan-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pan-users] GNU javamail and article number


From: Thufir Hawat
Subject: [Pan-users] GNU javamail and article number
Date: Mon, 18 Feb 2013 01:38:03 +0000 (UTC)
User-agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)

I see topics on Android, so this is kinda along those lines.

more of a question for the developer(s).  I'm interested in doing some 
Java development and am having trouble with reading RFC's.  I'm looking 
at the source for:


  62:   /*
  63:    * The last article number in the group.
  64:    */
  65:   public int last;

http://developer.classpath.org/inet/doc/gnu/inet/nntp/GroupResponse-
source.html


which looks like last should be the number for the last article for a 
group.  Now, when checking for new articles, what is that number compared 
to?

              GroupResponse response = ns.connection.group(name);
              if (response.last > last)
                {
                  hasNew = true;
                }

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

I'm just try to figure out how, when connecting to a new server, do you 
know what was the article number for the latest article?  Is that kept, 
generally, in the .newsrc perhaps?

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

Because, when javax mail (which is utilized in this context) loads a 
folder, it simply *counts* the number of messages in a given folder.

How does pan handle this?  For simplicity, let's assume just one server 
is being accessed.  Pan keeps the latest article number in a .newsrc file 
and then iterates up?

What I'm after is not just a method, as above, to check for new articles 
but to return a range of articles which are new -- something along those 
lines.

Or, maybe, another approach is to just keep the latest article number 
increment it, and request the article until errors are caught.  However, 
that assumes there are no gaps in the article numbers.  And, still, the 
article number *must* be stored somewhere.

It all starts with *getting* the article number.  Apparently 
NNTPFolder.java is using GroupResponse to handle the article number, so I 
should be also using GroupResponse and see what article numbers it gets?

I know that when I run leafnode in verbose mode it will report things 
like:

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

and so, through telnet, it's getting those article numbers.  However, the 
GNU javamail NNTP API seems to have no provision for directly seeing 
those article numbers:

http://www.gnu.org/software/classpathx/javamail/javadoc/gnu/mail/
providers/nntp/NNTPFolder.html

There' just no method listed for dealing with article numbers, they're 
encapsulated, which I guess is good.  But they're encapsulated so well I 
don't see how to get *new* articles without re-fetching everything.

As suggested here:

I've been reading RFC's, but that doesn't help with determining what GNU 
javamail is actually doing, versus what it's supposed to do.  (I really 
don't like the Apache API at all -- but if there's a Java API someone 
knows works for this, that would be interesting.  The GNU API is very 
clean, just maybe **too** clean.)



thanks,

Thufir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]