Lars Kellogg-Stedman wrote:
Hey folks,
I'm writing an application in which I'd like to be able to retrieve the
last <n> messages from a newsgroup hosted on a Cyrus nntp server. I
figured I could use the ARTICLE command to select the last article in
the group and then use the LAST command to step backwards an appropriate
number of articles. Unfortunately, this results in an error:
C: GROUP my.group
S: 211 5 6 22 my.group
C: ARTICLE 22
S: 220 22 <...message id...>
S: ...article contents...
S: .
C: LAST
S: 422 No previous article in this group
The RFC implies this ought to work -- the ARTICLE command is supposed to
update the "current article pointer", and the description of the LAST
command says:
The internally maintained "current article pointer" is set
to the previous article in the current newsgroup. If already
positioned at the first article of the newsgroup, an error
message is returned and the current article remains selected.
So, is this a bug? Or just a poorly specified RFC (it doesn't
*explicitly* state that you have to use NEXT before you use LAST, but
neither does it state the opposite).
Its a bug which I just fixed in CVS:
https://bugzilla.andrew.cmu.edu/cgi-bin/cvsweb.cgi/src/cyrus/imap/nntpd.c.diff?r1=1.49&r2=1.50&f=u
When I refactored the msgno/msgid/range code, I forgot to have the
article selection commands set the current article pointer.
--
Kenneth Murchison
Systems Programmer
Carnegie Mellon University
----
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html