Class SmtpCommand.

Inherits EventHandler. Inherited by SmtpAuth, SmtpData, SmtpHelo, SmtpHelp, SmtpMailFrom, SmtpNoop, SmtpQuit, SmtpRcptTo, SmtpRset and SmtpStarttls.

The SmtpCommand models a single SMTP command (including "unknown command"). Some of them are subclasses.

An SmtpCommand must be able to parse its arguments and execute itself.

SmtpCommand::SmtpCommand( SMTP * s )

Constructs an empty command for the server s.

static SmtpCommand * SmtpCommand::create( SMTP * server, const EString & command )

Creates an SmtpCommand object to handle command within the context of server. server cannot be null.

This function rejects commands issued while the server is shutting down. If a command passes this hurdle, it will be executed to completion, even if the server starts shutting down. This implies that if we're receiving a message body when the shutdown command is given, we will receive and inject the message, as RFC 1047 suggests.

bool SmtpCommand::done() const

Returns true if this command has finished its work, and false otherwise.

void SmtpCommand::emitResponses()

Outputs the response for this command, including the number and trailing CRLF.

void SmtpCommand::finish()

Records that this command is finished and tells the SMTP server to emit responses and generally get on with life. The response may be sent, and SMTP::execute() should not call execute() again.

bool SmtpCommand::ok() const

Returns true if this command has completed with a non-error response code, true if it hasn't completed, and false if it has completed with an error code. Toggles to true again after emitResponses().

void SmtpCommand::respond( uint r, const EString & s, const char * enh )

Records that the (three-digit) response code for this command is r, that enh is either null (the default) or an enhanced status code as defined in RFC 2034, and that s is to be one of the text lines sent. s should not have a trailing CRLF.

If r is 0, the existing response code is not changed. Similarly, if enh is null, the existing enhanced respons code is not changed.

SMTP * SmtpCommand::server() const

Returns a pointer to the SMTP server for this command.

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.