Re: NNTP Server

Giganews Newsgroups
Subject: Re: NNTP Server
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Tue, 30 Dec 2003

"Clément Doss" <cdoss@nospam.dhs.com.br> wrote in message
news:F961AB262C8CE240cdoss@nospam.dhs.com.br...

> BeforeCommandHandler fired. POST

When the server receives the POST command, it will trigger the OnPost event.
You are supposed to read the message data from the connection at that point.
The simpliest way to do that is to call the connection's Capture() method,
ie:

    procedure TForm1.IdNNTPServer1Post(AThread: TIdNNTPThread; var VPostOk:
Boolean; var VErrorText: string);
    var
        Data: TStrings;
    begin
        Data := TStringList.Create;
        try
            AThread.Connection.Capture(Data);
            // use Data as needed
        finally
            Data.Free;
        end;
    end;

> Is there any particular event that fires when all the message
> is received and ready for storage?

No, because TIdNNTPServer does not read the actual message data for you, you
are supposed to handle that yourself.  That is because TIdNNTPServer has no
concept of how the server will decide how it wants to store the data.  It
allow allows the server to decide whether posting is even allowed or not, on
a per-message basis, before the actual reading occurs.

Gambit

Replies

In response to

NNTP Server posted by Clément Doss on Tue, 30 Dec 2003