Class Fetch.

Inherits Command

Returns message data (RFC 3501, section 6.4.5, extended by RFC 4551 and RFC 5257).

Our parser used to be slightly more permissive than the RFC. This is a bug (is it? why?), and many of the problems have been corrected (but not tested).

Fetch::Fetch( bool u )

Creates a new handler for FETCH if u is false, or for UID FETCH if u is true.

Fetch::Fetch( bool f, bool a, const IntegerSet & set, int64 limit, IMAP * i, Transaction * t )

Constructs a handler for the implicit fetch which is executed by ImapSession for flag updates, etc. If f is true the updates will include FLAGS sections and if a is true, ANNOTATION. The handler starts fetching those messagges in set that have a modseq greater than limit. The responses are sent via i.

If t is non-zero, the fetch operates within a subtransaction of t.

EString Fetch::annotation( User * u, uint uid, const EStringList & entrySpecs, const EStringList & attributes )

Returns the IMAP ANNOTATION production for the message with uid, from the point of view of u (0 for no user, only public annotations). entrySpecs is a list of the entries to be matched, each of which can contain the * and % wildcards. attributes is a list of attributes to be returned (each including the .priv or .shared suffix).

EString Fetch::bodyStructure( Multipart * m, bool extended )

Returns either the IMAP BODY or BODYSTRUCTURE production for m. If extended is true, BODYSTRUCTURE is returned. If it's false, BODY.

EString Fetch::dotLetters( uint min, uint max )

This utility function fetches at least min, at most max characters, all of which must be a letter, a digit or a dot. Consecutive dots ARE allowed.

void Fetch::enqueue( Query * q )

This helper enqueues q for execution, either directly of via a transaction.

EString Fetch::envelope( Message * m )

Returns the IMAP envelope for m.

EString Fetch::flagList( uint uid )

Returns a string containing all the flags that are set for the message with uid.

void Fetch::forget( uint uid )

This dangerous function makes the Fetch handler forget (part of) what it knows about uid. If Fetch has processed uid to completion, then forget() frees up memory for other use. To be used only by ImapFetchResponse::setSent().

EString Fetch::internalDate( Message * m )

Returns the internaldate of m in IMAP format.

EString Fetch::makeFetchResponse( Message * m, uint uid, uint msn )

Emits a single FETCH response for the message m, which is trusted to have UID uid and MSN msn.

The message must have all necessary content.

Message * Fetch::message( uint uid ) const

Returns a pointer to the message with uid that this command has fetched or will fetch.

void Fetch::parseAnnotation()

Parses the entries and attributes from an ANNOTATION fetch-att. Expects the cursor to be on the first parenthesis, and advances it to past the last one.

void Fetch::parseAttribute( bool alsoMacro )

This helper is responsible for parsing a single attribute from the fetch arguments. If alsoMacro is true, this function parses a macro as well as a single attribute.

void Fetch::parseBody( bool binary )

Parses a bodypart description - the bit following "body[" in an attribute. The cursor must be after '[' on entry, and is left after the trailing ']'.

If binary is true, the parsed section will be sent using the BINARY extension (RFC 3516). If not, it'll be sent using a normal BODY.

void Fetch::parseFetchModifier()

Parses a single RFC 4466 fetch-modifier. At the moment only RFC 4551 is supported.

static Section * Fetch::parseSection( ImapParser * ip, bool binary )

Uses the ImapParser ip to parse a section-text production, and returns a pointer to a suitably constructed Section object. Upon return, the ImapParser's cursor is advanced to point past the end of the section-text. ip must not be 0; and the return value of this function is also guaranteed to be non-zero.

If binary is false (the default), then the BINARY extensions of RFC 3516 are summarily ignored.

If there were any parsing errors, Section::error will be non-empty.

void Fetch::pickup()

Retrieves completed messages and builds ImapFetchResponse objects.

static EString Fetch::sectionData( Section * s, Message * m )

This function returns the text of that portion of the Message m that is described by the Section s. It is publicly available so that Append may use it for CATENATE.

void Fetch::sendAnnotationsQuery()

Sends a query to retrieve all annotations.

void Fetch::sendFetchQueries()

Issues queries to resolve any questions this FETCH needs to answer.

void Fetch::sendFlagQuery()

Sends a query to retrieve all flags.

void Fetch::sendModSeqQuery()

Sends a query to retrieve the modseq.

EString Fetch::singlePartStructure( Multipart * mp, bool extended )

Returns the structure of the single-part bodypart mp.

If extended is true, extended BODYSTRUCTURE attributes are included.

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