Class ImapResponse.

Inherits Garbage. Inherited by ImapByeResponse, ImapExpungeResponse, ImapFetchResponse, ImapSearchResponse, ImapSortResponse and ThreadResponse.

The ImapResponse class models a single IMAP response. It has the knowledge necessary to decide whether a particular response can be sent, has been sent, and formulates the exact textual form of the response.

ImapResponse::ImapResponse( IMAP * server )

Constructs a response which is bound to server but not to any Session. The text() must be computed by a subclass.

The response is always meaningful(). changesMsn() returns false.

ImapResponse::ImapResponse( IMAP * server, const EString & response )

Constructs a response which is bound to server but not to any Session, and sends the constant string response. response should not contain the leading "* " or trailing CRLF.

The response is always meaningful(). changesMsn() returns false.

ImapResponse::ImapResponse( ImapSession * session )

Constructs a response which is bound to session. A subclass is responsible for text().

The response is meaningful() only if session is active.

ImapResponse::ImapResponse( ImapSession * session, const EString & response )

Constructs a response which is bound to session and sends the constant string response. response should not contain the leading "* " or trailing CRLF.

The response is meaningful() only if session is active, and changesMsn() returns false.

bool ImapResponse::changesMsn() const

Returns true if sending this response will change the session() MSN map, and false if not.

IMAP * ImapResponse::imap() const

Returns the IMAP server to which this response pertains.

bool ImapResponse::meaningful() const

Returns true if this response has meaning, and false if it may be discarded.

One reason to discard a response is that it's related to a session, but the session has ended.

bool ImapResponse::sent() const

Returns true if setSent() has been called.

Session * ImapResponse::session() const

Returns the session passed to the constructor, or 0 if none.

void ImapResponse::setChangesMsn()

Records that when the text() is sent, the client's idea of MSN->UID mapping will change.

Meant to be called by subclass constructors.

void ImapResponse::setSent()

Notifies this ImapResponse that it has been sent to the client.

This function is virtual and not const. Subclasses may perform state changes in this function, e.g. calling IMAP::endSession(), so that the server's state matches what the IMAP client will have after parsing this response.

EString ImapResponse::text() const

Returns the text of the response.

Subclasses may need to compute this, so if possible it should be called only once. The function is const, so subclasses should not perform any state changes here (but rather in setSent()).

If text() returns an empty string, the caller should discard the response and not send it.

ImapResponse::~ImapResponse()

Virtual destructor to please gcc.

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