Unit NntpCli

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Author: François PIETTE Description: TNntpCli is a client for the NNTP protocol (RFC-977) EMail: francois.piette@ping.be http://www.rtfm.be/fpiette francois.piette@rtfm.be Creation: December 19, 1997 Version: 1.01 WebSite: http://www.rtfm.be/fpiette/indexuk.htm Support: Use the mailing list twsocket@rtfm.be See website for details. Legal issues: Copyright (C) 1997 by François PIETTE This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented, you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Updates: Dec 30, 1997 V0.91 Bug: StatusCode was not updated for Connect Added PostingPermited property and ParseListLine procedure as suggested by J. Peter Mugaas Dec 31, 1997 V0.92 Added XOVER, LIST OVERVIEW.FMT and DATE commands Jan 10, 1998 V0.93 Added OnStateChange event as suggested by J. Peter Mugaas Jan 13, 1998 V0.94 Added readonly property State Feb 02, 1998 V0.95 Corrected a message in the Quit method. Added the NntpCliVersion constant. Feb 03, 1998 V0.96 Added Authenticate method, UserName and PassWord properties. Apr 13, 1998 V1.00 Added an intermediate message for OnRequestDone event Created the Handle property and related WndProc stuff Apr 21, 1998 V1.01 Corrected buffer overflow in the OnDataAvailable event. Thanks to Tim Skinner tim@palacecs.demon.co.uk who found that bug. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Classes

TNntpCli -

Functions

ParseListLine - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Register - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Types

TNntpDisplay
TNntpRequest
TNntpState
TRequestDone

Constants

NntpCliVersion
NNTP_RCV_BUF_SIZE
WM_NNTP_REQUEST_DONE

Variables


Functions


procedure ParseListLine(const Line : String; var NewsGroupName : String; var LastArticle : Integer; var FirstArticle : Integer; var PostingFlag : Char);

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

procedure Register;

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Types


TNntpDisplay = procedure(Sender: TObject; Msg : PChar; Len : Integer) of object

TNntpRequest = (nntpGroup,           nntpList,
                    nntpPost,            nntpHelp,
                    nntpNewGroups,       nntpNewNews,
                    nntpArticleByNumber, nntpArticleByID,
                    nntpBodyByID,        nntpBodyByNumber,
                    nntpHeadByID,        nntpHeadByNumber,
                    nntpStatByID,        nntpStatByNumber,
                    nntpNext,            nntpLast,
                    nntpQuit,            nntpAbort,
                    nntpXOver,           nntpListOverViewFmt,
                    nntpDate,            nntpAuthenticate);

TNntpState = (nntpNotConnected, nntpDnsLookup, nntpWaitingBanner,
                  nntpReady, nntpWaitingResponse);

TRequestDone = procedure(Sender: TObject; RqType: TNntpRequest; Error: Word) of object

Constants

NntpCliVersion = 101

Controls, Graphics,

NNTP_RCV_BUF_SIZE = 4096

WM_NNTP_REQUEST_DONE = WM_USER + 1


Variables