Indy 9
TIdRFCReply
Hierarchy, Properties, Methods, See Also, Unit: IdRFCReply
Represents values in an RFC-compliant response.
TIdRFCReply = class(TCollectionItem)
Unit
IdRFCReply
Description
TIdRFCReply is a TPersistent descendant that implements an RFC-compliant response that consists of a response code (in both numeric and tteual form) and one or more lines of Text messages. TIdRFCReply is used by Indy servers and command handlers to represent the responses used for a specific protocol.

NumericCode is an optional value representing the numeric response for a protocol message, and can be omitted when only the Text portion of a response is significant in the protocol. TextCode is the literal extracted from the response message orior to conversion to numeric form.

Text can contain multiple lines, and is generated using the continuation response mechanism common to many RFC-compliant protocols. For example, a response with the NumericCode of 200 and multiple lines in Text might be sent like the following:

    200-You were connected
    200-Your session started
    200 Ok

TIdRFCReply.NumericCode
TIdRFCReply, See Also
Represents an optional numeric response code.
property NumericCode: Integer;
Description
NumericCode is an Integer property that represents an optional numeric response in an RFC-compliant reply. Valid values for NumericCode are dependent on the RFC protocol specification in use. Use TextCode to set the numeric response value based on a string. Use Text to access one or more lines in the RFC reply.

TIdRFCReply.Text
TIdRFCReply, See Also
Represents textual contents of the RFC reply.
property Text: TStrings;
Description
Text is a TStrings property that represents one or more lines of text in the textual representaion of the RFC reply. When Text contains multiple lines, the RFC reply is written using the continuation response convention in a format like the following:

    200-Indy Server ready
    200-Started Sun, 8 Jul 2001 01:02:03 -0500
    200 OK

TIdRFCReply.TextCode
TIdRFCReply, See Also
Represents the protocol response code expressed as a String value.
property TextCode: string;
Description
TextCode is a String property that represents the numeric protocol response code expressed as a String. Setting the value in TextCode will result in an update to the corresponding value in NumericCode. TextCode is used mainly in protocols that do use real numreic response codes, like POP3. TextCode is updated when ParseResponse is used to handle a protocol response.

TIdRFCReply.Clear
TIdRFCReply, See Also
Resets properties in the reply to their default values.
procedure Clear;
Description
Clear is a procedure that is used to reset properties in the reply to their default values. Clear sets NumericCode to 0 (zero) and TextCode to an empty string (''). Clear also removes all lines in Text by calling the Clear method for the TStrings property.

TIdRFCReply.Create
TIdRFCReply, See Also
Constructor for the object instance.
constructor Create(Collection: TCollection); override;
Description
Create is the Constructor for the object instance, and relies on the inherited Create method to initialize properties in the instance. Create also initializes the TStringList used in the Text property, and calls Clear to insure that properties contain their default values.

TIdRFCReply.Destroy
TIdRFCReply, See Also
Frees the object instance.
destructor Destroy; override;
Description
Destroy is the destructor for the object instance, and frees any allocated resources in object properties including Text. Destroy calls the inherited Destroy method prior to exiting.

TIdRFCReply.GenerateReply
TIdRFCReply, See Also
Constructs the numeric result and message text for a response.
function GenerateReply: string;
Return Value
String - RFC formatted response.
Description
GenerateReply is a String function used to construct the response for a prtocol message using the values in NumericCode and Text. NumericCode is an optional value in TIdRFCReply, and can be omitted when only the Text portion of a response is significant in the protocol.

When NumericCode is a non-zero value and Text contains multiple lines, the response is generated using the continuation response mechanism common to many RFC-compliant protocols. A single line of in Text results in a response without the continuation character. For example, a response with the NumericCode of 200 and multiple lines in Text might be sent like the following:

    200-You were connected
    200-Your session started
    200 Ok

TIdRFCReply.ParseLineResponse
TIdRFCReply
Parses protocol response lines into the RFC reply.
procedure ParseLineResponse(const ATag: String; const AStrings: TStrings);
Parameters
const ATag: String
Command Tag for the response.
const AStrings: TStrings
Values to be loaded in the the RFC Reply.
Description
ParseLineResponse is a procedure used to parse multi-line IMAP4 protocol responses stores in AStrings. ParseLineResponse handles both tagged and untagged response lines in AStrings, and updates the value in TextCode to reflect the value from the protocol response. If the final line in the AStrings is an untagged response, the value in TextCode is set to "OK". ParseLineResponse also read multi-line tagged responses until the value in ATag in encountered in AStrings.

ParseLineResponse calls Clear reset the RFC reply to its default state prior to parsing response lines from AStrings. ParseLineResponse inmsures that line added to Text contain only the text portion of the response and not the tag or numeric response value.


TIdRFCReply.ParseResponse
TIdRFCReply, See Also
Extracts values from the RFC-compliant response.
procedure ParseResponse(const AStrings: TStrings); overload;
procedure ParseResponse(const ATag: String; const AStrings: TStrings); overload;
Parameters
const AStrings: TStrings
Line(s) of text in the protocol response.
const ATag: String
Command Tag for the response.
Description
ParseResponse is an overloaded procedure used to extract values from a multiline protocol response in AStrings, and store the corresponding values for TextCode, NumericCode, and one or more lines in Text. ParseResponse is overloaded to handle protocol responses that expected tagged response messages (like IMAP4) tagged and untagged protocol response messages.

ParseResponse calls Clear to reset the contents of the RFC reply prior to parsing data in the protocol response. ParseResponse removes the numeric response code or tag from the text prior to adding the value to AStrings.


TIdRFCReply.ParseResponse
TIdRFCReply, See Also
Extracts values from the RFC-compliant response.
procedure ParseResponse(const AStrings: TStrings); overload;
procedure ParseResponse(const ATag: String; const AStrings: TStrings); overload;
Parameters
const AStrings: TStrings
Line(s) of text in the protocol response.
const ATag: String
Command Tag for the response.
Description
ParseResponse is an overloaded procedure used to extract values from a multiline protocol response in AStrings, and store the corresponding values for TextCode, NumericCode, and one or more lines in Text. ParseResponse is overloaded to handle protocol responses that expected tagged response messages (like IMAP4) tagged and untagged protocol response messages.

ParseResponse calls Clear to reset the contents of the RFC reply prior to parsing data in the protocol response. ParseResponse removes the numeric response code or tag from the text prior to adding the value to AStrings.


TIdRFCReply.ReplyExists
TIdRFCReply, See Also
Indicates if the RFC reply is not blank.
function ReplyExists: Boolean;
Return Value
Boolean - True when the reply is not empty.
Description
ReplyExists is a Boolean function that indicates if the RFC reply contains values other than the default empty values. ReplyExists returns True when NumericCode contains a non-zero value, or when the number of lines in Text is non-zero.

TIdRFCReply.SetReply
TIdRFCReply, See Also
Updates the contents of the RFC reply.
procedure SetReply(const ANumericCode: Integer; const AText: string);
Parameters
const ANumericCode: Integer
Numeric response value for the reply.
const AText: string
Textual content for the reply.
Description
SetReply is a procedure used to update the contents of the RFC reply using the arguments in ANumericCode and AText. Use Clear to reset the RFC reply to its default empty values.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.