Indy 9
|
TIdNNTPServer = class(TIdTCPServer)
TIdNNTPServer is used for distributing messages publicly to central locations on a network. TIdNNTPServer is based on the formats, control messages, transmission methods, and propagtion algorithms defined in the Internet Standards document:
TIdNNTPServer also incorporates the syntax for text-based messages as defined in the Internet Standards document:
TIdNNTPServer provides a dual implementation capability, mirroring the options available in TIdTCPServer, using the TIdTCPServer.OnExecute event handler or through the use of the TIdCommandHandlers collection.
When using TIdCommandHandlers, TIdNNTPServer provides command event handlers to respond to the following NNTP commands and extensions:
TIdNNTPServer also provides event handlers that allow implementation- dependent access to NNTP GRoups, Articles, and Overview database storage.
property DefaultPort: integer;
DefaultPort is the value used when the server creates a new listener thread for accepting client connections.
property Help: TStrings;
The Help property is allocated the Create constructor, and freed in the Destroy method. The NNTP server implementation must assign the string contents representing the supported NNTP commands prior to becoming Active.
property OverviewFormat: TStrings;
OverviewFormat is used during execution of the procedure assigned to CommandHandlers for the NNTP LIST OVERVIEW.FMT.
OverviewFormat is freed in the Destroy method.
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property OnArticleByNo: TIdNNTPOnArticleByNo;
OnArticleByNo is signalled when the server implementation executes the command process for the CommandHandler assigned to the NNTP ARTICLE command. The server implementation must assign a procedure to the event handler to implement the platform and server specific algorithms required to respond to the NNTP command. The procedure for the event handler must send both the headers and the body for the NNTP article.
property OnAuth: TIdNNTPOnAuth;
property OnBodyByNo: TIdNNTPOnArticleByNo;
property OnCheckListGroup: TIdNNTPOnCheckListGroup;
property OnCheckMsgNo: TIdNNTPOnCheckMsgNo;
OnCheckMsgNo is signalled when the server implementation executes the command process for CommandHandlers assigned to the NNTP ARTICLE command. The server implementation must assign a procedure to the event handler to implement the platform and server specific algorithms required to respond to the NNTP command. The procedure for the event handler must insure that an NNTP article exists having the requested message number or unique message identifier.
property OnHeadByNo: TIdNNTPOnArticleByNo;
property OnIHaveCheck: TIdNNTPOnIHaveCheck;
property OnIHavePost: TIdNNTPOnPost;
property OnListGroups: TIdServerThreadEvent;
The server implementation must assign a procedure to the event handler to implement the platform and server specific algorithms required to generate the listing of newsgroups with first, and last message numbers, as well as newsgroup posting status. The procedure for the event handler must write the response to the threaded client connection.
property OnListNewGroups: TIdNNTPOnNewGroupsList;
property OnNewNews: TIdNNTPOnNewNews;
property OnNextArticle: TIdNNTPOnMovePointer;
property OnPost: TIdNNTPOnPost;
OnPost allows the server to implement the platform and server specific procedure and functions needed to receive and store an NNTP article. OnPost may also be used to set a status flag indicating posting is disallowed or failed for the article, as well as an error message associated with the abandoned post. OnPost must also perform receipt of the headers and body for the NNTP article using the threaded client connection, and storage in the format required for the server implementation.
property OnPrevArticle: TIdNNTPOnMovePointer;
property OnSelectGroup: TIdNNTPOnSelectGroup;
OnSelectGroup accepts arguments that identify the newsgroup to be detailed, and returns values in the arguments that indicate the estimated total, first and last message numbers for the specified newsgroup. OnSelectGroup must also set the value for the argument indicating that the requested newsgroup exists on the server.
The server implementation must assign a procedure to the event handler to allow responding to the event notification. NOTE: OnSelectGroup does not need to format and write the NNTP GROUP response message; it is written in the CommandGroup procedure.
property OnStatMsgNo: TIdNNTPOnMovePointer;
property OnXHdr: TIdNNTPOnXHdr;
property OnXOver: TIdNNTPOnXOver;
OnXOver uses values from TIdNNTPThread to determine the current newsgroup, and current article pointer for the threaded client connection. A newsgroup must be selected before OnXOver can be used to retrieve overview information. If no NNTP article number is specified in the NNTP XOVER commmand, OnXOver is signalled with the current article pointer as the requested message number. OnXOver should updated the last message number argument to indicate the most recently posted article in the newsgroup.
OnXOver must generate a listing that consists of overview information for each message in the range requested. OnXOver must not contain overview information for deleted or removed articles. Each line in the listing must contain tab delimited values including the article number followed by message headers as indicated in the OverviewFormat property. Note: TAB and EOL characters in header data must be converted to a CHAR32 (Space) character.
OnXOver must write the contents of the listing to the threaded client connection. The NNTP response code and the trailing '.' character are handled by the protected CommandXOver procedure.