Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: indy10.1.5 - idnntp problems

www.cryer.info
Managed Newsgroup Archive

Re: indy10.1.5 - idnntp problems

Subject:Re: indy10.1.5 - idnntp problems
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Thu, 15 Jun 2006 12:01:40

"Jacques" <jacques.noah@btinternet.com> wrote in message
news:44912cd8@newsgroups.borland.com...

> is it possible to only download new messages?

Most servers support the XOVER command, which TIdNNTP wraps with the XOver()
and ParseXOver() methods.  You can use XOVER to download just the basic
headers in a range of messages.  Display those headers to the user, and then
when the user wants to view a particular message, you can download the
contents of that message, if you haven't already.

The first time you enter a newsgroup, use the MsgLow and MsgHigh properties
to download all of the available messages (or the last 100 message, or
whatever you want).  As you download headers, keep track of the last MsgNo
that you downloaded.  The next time you enter the same newsgroup again, you
can use XOVER to get the headers for just new messages that start at the
next highest MsgNo from the last time you visited.

In other words, if you enter a group that has MsgNo values of 1-100, and
then later on you enter the group again and it has 1-200, you can download
just 101-200 the second time.

> A message without a references header is a parent, so add it
> to the treeview as such...
> if idmessage1.References = '' then  begin
>  midx:=idmessage1.MsgId;

That is not a good assumption to make.  Yes, an empty References header does
indicate a top-level parent of a thread.  But that is not the only condition
that you should be looking at.  If a message has a non-empty References
header, but you have not downloaded the other messages in the thread, then
the new message should be displayed in your UI as a top-level item as well.

A better way to handle References is to start with the last MsgID in the
list and work backwards, looking for any previous messages with that MsgID
assigned.  If the message is found, then the new message is to be displayed
as an immediate child of it.  If not found, then display the new message as
a top-level item by itself.  This way, you can display threads properly,
even if the user clears out the downloaded messages in between sessions.

> How do i retrieve the body of a article?

GetBody() and GetArticle()

> i've used getarticle() to retrieve the entire article, but when i try
> to get the msg body using the idMessage component, the text
> comes up empty.

Where and how the body is stored depends on how the message is formatted to
begin with.  MIME-encoded messages do not use the TIdMessage.Body property
at all.  They use the TIdMessage.MessageParts property instead, storing the
text as TIdText objects in the collection.

Another thing you can do, if you don't want the message body to be parsed by
TIdMessage, is to set the TIdMessage.NoDecode property to True before
downloading the body.  Then the raw body data will be stored as-is in the
TIdMessage.Body property.


Gambit

Replies:

none

In response to:

www.cryer.info
Managed Newsgroup Archive