t.m.i.IMAP4Client(basic.LineReceiver, policies.TimeoutMixin) : class documentation

Part of twisted.mail.imap4 View Source View In Hierarchy

Implements interfaces: twisted.mail.imap4.IMailboxListener

IMAP4 client protocol implementation
Instance VariablesstateA string representing the state the connection is currently in.
Method __init__ Undocumented
Method registerAuthenticator Register a new form of authentication
Method rawDataReceived Override this for when raw data is received.
Method connectionMade Called when a connection is made.
Method connectionLost We are no longer connected
Method lineReceived Attempt to parse a single line from the server.
Method timeoutConnection Called when the connection times out. Override to define behavior other than dropping the connection.
Method messageFile Create a file to which an incoming message may be written.
Method makeTag Undocumented
Method dispatchCommand Undocumented
Method response_UNAUTH Undocumented
Method response_AUTH Undocumented
Method sendCommand Undocumented
Method getCapabilities Request the capabilities available on this server.
Method logout Inform the server that we are done with the connection.
Method noop Perform no operation.
Method startTLS Initiates a 'STARTTLS' request and negotiates the TLS / SSL Handshake.
Method authenticate Attempt to enter the authenticated state with the server
Method login Authenticate with the server using a username and password
Method serverGreeting Called when the server has sent us a greeting.
Method namespace Retrieve information about the namespaces available to this account
Method select Select a mailbox
Method examine Select a mailbox in read-only mode
Method create Create a new mailbox on the server
Method delete Delete a mailbox
Method rename Rename a mailbox
Method subscribe Add a mailbox to the subscription list
Method unsubscribe Remove a mailbox from the subscription list
Method list List a subset of the available mailboxes
Method lsub List a subset of the subscribed available mailboxes
Method status Retrieve the status of the given mailbox
Method append Add the given message to the given mailbox.
Method check Tell the server to perform a checkpoint
Method close Return the connection to the Authenticated state.
Method expunge Return the connection to the Authenticate state.
Method search Search messages in the currently selected mailbox
Method fetchUID Retrieve the unique identifier for one or more messages
Method fetchFlags Retrieve the flags for one or more messages
Method fetchInternalDate Retrieve the internal date associated with one or more messages
Method fetchEnvelope Retrieve the envelope data for one or more messages
Method fetchBodyStructure Retrieve the structure of the body of one or more messages
Method fetchSimplifiedBody Retrieve the simplified body structure of one or more messages
Method fetchMessage Retrieve one or more entire messages
Method fetchHeaders Retrieve headers of one or more messages
Method fetchBody Retrieve body text of one or more messages
Method fetchSize Retrieve the size, in octets, of one or more messages
Method fetchFull Retrieve several different fields of one or more messages
Method fetchAll Retrieve several different fields of one or more messages
Method fetchFast Retrieve several different fields of one or more messages
Method fetchSpecific Retrieve a specific section of one or more messages
Method setFlags Set the flags for one or more messages.
Method addFlags Add to the set flags for one or more messages.
Method removeFlags Remove from the set flags for one or more messages.
Method copy Copy the specified messages to the specified mailbox.
Method modeChanged Override me
Method flagsChanged Override me
Method newMessages Override me
Method _setupForLiteral Undocumented
Method _regularDispatch Undocumented
Method _defaultHandler Undocumented
Method _flushQueue Undocumented
Method _extraInfo Undocumented
Method __cbCapabilities Undocumented
Method __cbLogout Undocumented
Method __cbNoop Undocumented
Method __cbAuthenticate Undocumented
Method __cbContinueAuth Undocumented
Method __cbAuthTLS Undocumented
Method _getContextFactory Undocumented
Method __cbLoginCaps Undocumented
Method _startedTLS Undocumented
Method __cbLoginTLS Undocumented
Method __ebLoginTLS Undocumented
Method __cbNamespace Undocumented
Method _intOrRaise Parse value as an integer and return the result or raise IllegalServerResponse with phrase as an argument if value cannot be parsed as an integer.
Method __cbSelect Handle lines received in response to a SELECT or EXAMINE command.
Method __cbList Undocumented
Method __cbStatus Undocumented
Method __cbContinueAppend Undocumented
Method __cbFinishAppend Undocumented
Method __cbExpunge Undocumented
Method __cbSearch Undocumented
Method _parseFetchPairs Given the result of parsing a single FETCH response, construct a dict mapping response keys to response values.
Method _cbFetch Undocumented
Method _fetch Undocumented
Method _store Undocumented

Inherited from LineReceiver:

Method clearLineBuffer Clear buffered data.
Method dataReceived Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
Method setLineMode Sets the line-mode of this receiver.
Method setRawMode Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Method sendLine Sends a line to the other end of the connection.
Method lineLengthExceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.

Inherited from BaseProtocol (via LineReceiver, Protocol):

Method makeConnection Make a connection to a transport and a server.

Inherited from _PauseableMixin (via LineReceiver):

Method pauseProducing Undocumented
Method resumeProducing Undocumented
Method stopProducing Undocumented

Inherited from TimeoutMixin:

Method callLater Undocumented
Method resetTimeout Reset the timeout count down
Method setTimeout Change the timeout period
Method __timedOut Undocumented
def __init__(self, contextFactory=None): (source)
Undocumented
def registerAuthenticator(self, auth): (source)

Register a new form of authentication

When invoking the authenticate() method of IMAP4Client, the first matching authentication scheme found will be used. The ordering is that in which the server lists support authentication schemes.
ParametersauthThe object to use to perform the client side of this authentication scheme. (type: Implementor of IClientAuthentication )
def rawDataReceived(self, data): (source)
Override this for when raw data is received.
def _setupForLiteral(self, rest, octets): (source)
Undocumented
def connectionMade(self): (source)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
def connectionLost(self, reason): (source)
We are no longer connected
def lineReceived(self, line): (source)
Attempt to parse a single line from the server.
ParameterslineThe line from the server, without the line delimiter. (type: str )
RaisesIllegalServerResponseIf the line or some part of the line does not represent an allowed message from the server at this time.
def timeoutConnection(self): (source)
Called when the connection times out. Override to define behavior other than dropping the connection.
def _regularDispatch(self, line): (source)
Undocumented
def messageFile(self, octets): (source)
Create a file to which an incoming message may be written.
ParametersoctetsThe number of octets which will be written to the file (type: int )
ReturnsA file-like object (type: Any object which implements write(string) and seek(int, int) )
def makeTag(self): (source)
Undocumented
def dispatchCommand(self, tag, rest): (source)
Undocumented
def response_UNAUTH(self, tag, rest): (source)
Undocumented
def response_AUTH(self, tag, rest): (source)
Undocumented
def _defaultHandler(self, tag, rest): (source)
Undocumented
def _flushQueue(self): (source)
Undocumented
def _extraInfo(self, lines): (source)
Undocumented
def sendCommand(self, cmd): (source)
Undocumented
def getCapabilities(self, useCache=1): (source)

Request the capabilities available on this server.

This command is allowed in any state of connection.
ParametersuseCacheSpecify whether to use the capability-cache or to re-retrieve the capabilities from the server. Server capabilities should never change, so for normal use, this flag should never be false. (type: bool )
ReturnsA deferred whose callback will be invoked with a dictionary mapping capability types to lists of supported mechanisms, or to None if a support list is not applicable. (type: Deferred )
def __cbCapabilities(self, (lines, tagline)): (source)
Undocumented
def logout(self): (source)

Inform the server that we are done with the connection.

This command is allowed in any state of connection.
ReturnsA deferred whose callback will be invoked with None when the proper server acknowledgement has been received. (type: Deferred )
def __cbLogout(self, (lines, tagline)): (source)
Undocumented
def noop(self): (source)

Perform no operation.

This command is allowed in any state of connection.
ReturnsA deferred whose callback will be invoked with a list of untagged status updates the server responds with. (type: Deferred )
def __cbNoop(self, (lines, tagline)): (source)
Undocumented
def startTLS(self, contextFactory=None): (source)
Initiates a 'STARTTLS' request and negotiates the TLS / SSL Handshake.
ParameterscontextFactoryThe TLS / SSL Context Factory to leverage. If the contextFactory is None the IMAP4Client will either use the current TLS / SSL Context Factory or attempt to create a new one. (type: ssl.ClientContextFactory )
ReturnsA Deferred which fires when the transport has been secured according to the given contextFactory, or which fails if the transport cannot be secured.
def authenticate(self, secret): (source)

Attempt to enter the authenticated state with the server

This command is allowed in the Non-Authenticated state.
ReturnsA deferred whose callback is invoked if the authentication succeeds and whose errback will be invoked otherwise. (type: Deferred )
def __cbAuthenticate(self, caps, secret): (source)
Undocumented
def __cbContinueAuth(self, rest, scheme, secret): (source)
Undocumented
def __cbAuthTLS(self, caps, secret): (source)
Undocumented
def login(self, username, password): (source)

Authenticate with the server using a username and password

This command is allowed in the Non-Authenticated state. If the server supports the STARTTLS capability and our transport supports TLS, TLS is negotiated before the login command is issued.

A more secure way to log in is to use startTLS or authenticate or both.
ParametersusernameThe username to log in with (type: str )
passwordThe password to log in with (type: str )
ReturnsA deferred whose callback is invoked if login is successful and whose errback is invoked otherwise. (type: Deferred )
def serverGreeting(self, caps): (source)
Called when the server has sent us a greeting.
ParameterscapsCapabilities the server advertised in its greeting. (type: dict )
def _getContextFactory(self): (source)
Undocumented
def __cbLoginCaps(self, capabilities, username, password): (source)
Undocumented
def _startedTLS(self, result, context): (source)
Undocumented
def __cbLoginTLS(self, result, username, password): (source)
Undocumented
def __ebLoginTLS(self, failure): (source)
Undocumented
def namespace(self): (source)

Retrieve information about the namespaces available to this account

This command is allowed in the Authenticated and Selected states.
ReturnsA deferred whose callback is invoked with namespace information. An example of this information is:
   [[['', '/']], [], []]
which indicates a single personal namespace called '' with '/' as its hierarchical delimiter, and no shared or user namespaces. (type: Deferred )
def __cbNamespace(self, (lines, last)): (source)
Undocumented
def select(self, mailbox): (source)

Select a mailbox

This command is allowed in the Authenticated and Selected states.
ParametersmailboxThe name of the mailbox to select (type: str )
ReturnsA deferred whose callback is invoked with mailbox information if the select is successful and whose errback is invoked otherwise. Mailbox information consists of a dictionary with the following keys and values:
       FLAGS: A list of strings containing the flags settable on
               messages in this mailbox.

       EXISTS: An integer indicating the number of messages in this
               mailbox.

       RECENT: An integer indicating the number of "recent"
               messages in this mailbox.

       UNSEEN: The message sequence number (an integer) of the
               first unseen message in the mailbox.

       PERMANENTFLAGS: A list of strings containing the flags that
               can be permanently set on messages in this mailbox.

       UIDVALIDITY: An integer uniquely identifying this mailbox.
(type: Deferred )
def examine(self, mailbox): (source)

Select a mailbox in read-only mode

This command is allowed in the Authenticated and Selected states.
ParametersmailboxThe name of the mailbox to examine (type: str )
ReturnsA deferred whose callback is invoked with mailbox information if the examine is successful and whose errback is invoked otherwise. Mailbox information consists of a dictionary with the following keys and values:
   'FLAGS': A list of strings containing the flags settable on
               messages in this mailbox.

   'EXISTS': An integer indicating the number of messages in this
               mailbox.

   'RECENT': An integer indicating the number of "recent"
               messages in this mailbox.

   'UNSEEN': An integer indicating the number of messages not
               flagged \Seen in this mailbox.

   'PERMANENTFLAGS': A list of strings containing the flags that
               can be permanently set on messages in this mailbox.

   'UIDVALIDITY': An integer uniquely identifying this mailbox.
(type: Deferred )
def _intOrRaise(self, value, phrase): (source)
Parse value as an integer and return the result or raise IllegalServerResponse with phrase as an argument if value cannot be parsed as an integer.
def __cbSelect(self, (lines, tagline), rw): (source)

Handle lines received in response to a SELECT or EXAMINE command.

See RFC 3501, section 6.3.1.
def create(self, name): (source)

Create a new mailbox on the server

This command is allowed in the Authenticated and Selected states.
ParametersnameThe name of the mailbox to create. (type: str )
ReturnsA deferred whose callback is invoked if the mailbox creation is successful and whose errback is invoked otherwise. (type: Deferred )
def delete(self, name): (source)

Delete a mailbox

This command is allowed in the Authenticated and Selected states.
ParametersnameThe name of the mailbox to delete. (type: str )
ReturnsA deferred whose calblack is invoked if the mailbox is deleted successfully and whose errback is invoked otherwise. (type: Deferred )
def rename(self, oldname, newname): (source)

Rename a mailbox

This command is allowed in the Authenticated and Selected states.
ParametersoldnameThe current name of the mailbox to rename. (type: str )
newnameThe new name to give the mailbox. (type: str )
ReturnsA deferred whose callback is invoked if the rename is successful and whose errback is invoked otherwise. (type: Deferred )
def subscribe(self, name): (source)

Add a mailbox to the subscription list

This command is allowed in the Authenticated and Selected states.
ParametersnameThe mailbox to mark as 'active' or 'subscribed' (type: str )
ReturnsA deferred whose callback is invoked if the subscription is successful and whose errback is invoked otherwise. (type: Deferred )
def unsubscribe(self, name): (source)

Remove a mailbox from the subscription list

This command is allowed in the Authenticated and Selected states.
ParametersnameThe mailbox to unsubscribe (type: str )
ReturnsA deferred whose callback is invoked if the unsubscription is successful and whose errback is invoked otherwise. (type: Deferred )
def list(self, reference, wildcard): (source)

List a subset of the available mailboxes

This command is allowed in the Authenticated and Selected states.
ParametersreferenceThe context in which to interpret wildcard (type: str )
wildcardThe pattern of mailbox names to match, optionally including either or both of the '*' and '%' wildcards. '*' will match zero or more characters and cross hierarchical boundaries. '%' will also match zero or more characters, but is limited to a single hierarchical level. (type: str )
ReturnsA deferred whose callback is invoked with a list of tuples, the first element of which is a tuple of mailbox flags, the second element of which is the hierarchy delimiter for this mailbox, and the third of which is the mailbox name; if the command is unsuccessful, the deferred's errback is invoked instead. (type: Deferred )
def lsub(self, reference, wildcard): (source)

List a subset of the subscribed available mailboxes

This command is allowed in the Authenticated and Selected states.

The parameters and returned object are the same as for the list method, with one slight difference: Only mailboxes which have been subscribed can be included in the resulting list.
def __cbList(self, (lines, last), command): (source)
Undocumented
def status(self, mailbox, *names): (source)

Retrieve the status of the given mailbox

This command is allowed in the Authenticated and Selected states.
ParametersmailboxThe name of the mailbox to query (type: str )
*namesThe status names to query. These may be any number of: 'MESSAGES', 'RECENT', 'UIDNEXT', 'UIDVALIDITY', and 'UNSEEN'. (type: str )
ReturnsA deferred which fires with with the status information if the command is successful and whose errback is invoked otherwise. The status information is in the form of a dict. Each element of names is a key in the dictionary. The value for each key is the corresponding response from the server. (type: Deferred )
def __cbStatus(self, (lines, last)): (source)
Undocumented
def append(self, mailbox, message, flags=(), date=None): (source)

Add the given message to the given mailbox.

This command is allowed in the Authenticated and Selected states.
ParametersmailboxThe mailbox to which to add this message. (type: str )
messageThe message to add, in RFC822 format. Newlines in this file should be \r\n-style. (type: Any file-like object )
flagsThe flags to associated with this message. (type: Any iterable of str )
dateThe date to associate with this message. This should be of the format DD-MM-YYYY HH:MM:SS +/-HHMM. For example, in Eastern Standard Time, on July 1st 2004 at half past 1 PM, "01-07-2004 13:30:00 -0500". (type: str )
ReturnsA deferred whose callback is invoked when this command succeeds or whose errback is invoked if it fails. (type: Deferred )
def __cbContinueAppend(self, lines, message): (source)
Undocumented
def __cbFinishAppend(self, foo): (source)
Undocumented
def check(self): (source)

Tell the server to perform a checkpoint

This command is allowed in the Selected state.
ReturnsA deferred whose callback is invoked when this command succeeds or whose errback is invoked if it fails. (type: Deferred )
def close(self): (source)

Return the connection to the Authenticated state.

This command is allowed in the Selected state.

Issuing this command will also remove all messages flagged \Deleted from the selected mailbox if it is opened in read-write mode, otherwise it indicates success by no messages are removed.
ReturnsA deferred whose callback is invoked when the command completes successfully or whose errback is invoked if it fails. (type: Deferred )
def expunge(self): (source)

Return the connection to the Authenticate state.

This command is allowed in the Selected state.

Issuing this command will perform the same actions as issuing the close command, but will also generate an 'expunge' response for every message deleted.
ReturnsA deferred whose callback is invoked with a list of the 'expunge' responses when this command is successful or whose errback is invoked otherwise. (type: Deferred )
def __cbExpunge(self, (lines, last)): (source)
Undocumented
def search(self, *queries, **kwarg): (source)

Search messages in the currently selected mailbox

This command is allowed in the Selected state.

Any non-zero number of queries are accepted by this method, as returned by the Query, Or, and Not functions.

One keyword argument is accepted: if uid is passed in with a non-zero value, the server is asked to return message UIDs instead of message sequence numbers.
ReturnsA deferred whose callback will be invoked with a list of all the message sequence numbers return by the search, or whose errback will be invoked if there is an error. (type: Deferred )
def __cbSearch(self, (lines, end)): (source)
Undocumented
def fetchUID(self, messages, uid=0): (source)

Retrieve the unique identifier for one or more messages

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message sequence numbers to unique message identifiers, or whose errback is invoked if there is an error. (type: Deferred )
def fetchFlags(self, messages, uid=0): (source)

Retrieve the flags for one or more messages

This command is allowed in the Selected state.
ParametersmessagesThe messages for which to retrieve flags. (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to lists of flags, or whose errback is invoked if there is an error. (type: Deferred )
def fetchInternalDate(self, messages, uid=0): (source)

Retrieve the internal date associated with one or more messages

This command is allowed in the Selected state.
ParametersmessagesThe messages for which to retrieve the internal date. (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to date strings, or whose errback is invoked if there is an error. Date strings take the format of "day-month-year time timezone". (type: Deferred )
def fetchEnvelope(self, messages, uid=0): (source)

Retrieve the envelope data for one or more messages

This command is allowed in the Selected state.
ParametersmessagesThe messages for which to retrieve envelope data. (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to envelope data, or whose errback is invoked if there is an error. Envelope data consists of a sequence of the date, subject, from, sender, reply-to, to, cc, bcc, in-reply-to, and message-id header fields. The date, subject, in-reply-to, and message-id fields are strings, while the from, sender, reply-to, to, cc, and bcc fields contain address data. Address data consists of a sequence of name, source route, mailbox name, and hostname. Fields which are not present for a particular address may be None. (type: Deferred )
def fetchBodyStructure(self, messages, uid=0): (source)

Retrieve the structure of the body of one or more messages

This command is allowed in the Selected state.
ParametersmessagesThe messages for which to retrieve body structure data. (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to body structure data, or whose errback is invoked if there is an error. Body structure data describes the MIME-IMB format of a message and consists of a sequence of mime type, mime subtype, parameters, content id, description, encoding, and size. The fields following the size field are variable: if the mime type/subtype is message/rfc822, the contained message's envelope information, body structure data, and number of lines of text; if the mime type is text, the number of lines of text. Extension fields may also be included; if present, they are: the MD5 hash of the body, body disposition, body language. (type: Deferred )
def fetchSimplifiedBody(self, messages, uid=0): (source)

Retrieve the simplified body structure of one or more messages

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to body data, or whose errback is invoked if there is an error. The simplified body structure is the same as the body structure, except that extension fields will never be present. (type: Deferred )
def fetchMessage(self, messages, uid=0): (source)

Retrieve one or more entire messages

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA Deferred which will fire with a dict mapping message sequence numbers to dicts giving message data for the corresponding message. If uid is true, the inner dictionaries have a 'UID' key mapped to a str giving the UID for the message. The text of the message is a str associated with the 'RFC822' key in each dictionary. (type: Deferred )
def fetchHeaders(self, messages, uid=0): (source)

Retrieve headers of one or more messages

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to dicts of message headers, or whose errback is invoked if there is an error. (type: Deferred )
def fetchBody(self, messages, uid=0): (source)

Retrieve body text of one or more messages

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to file-like objects containing body text, or whose errback is invoked if there is an error. (type: Deferred )
def fetchSize(self, messages, uid=0): (source)

Retrieve the size, in octets, of one or more messages

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to sizes, or whose errback is invoked if there is an error. (type: Deferred )
def fetchFull(self, messages, uid=0): (source)

Retrieve several different fields of one or more messages

This command is allowed in the Selected state. This is equivalent to issuing all of the fetchFlags, fetchInternalDate, fetchSize, fetchEnvelope, and fetchSimplifiedBody functions.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to dict of the retrieved data values, or whose errback is invoked if there is an error. They dictionary keys are "flags", "date", "size", "envelope", and "body". (type: Deferred )
def fetchAll(self, messages, uid=0): (source)

Retrieve several different fields of one or more messages

This command is allowed in the Selected state. This is equivalent to issuing all of the fetchFlags, fetchInternalDate, fetchSize, and fetchEnvelope functions.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to dict of the retrieved data values, or whose errback is invoked if there is an error. They dictionary keys are "flags", "date", "size", and "envelope". (type: Deferred )
def fetchFast(self, messages, uid=0): (source)

Retrieve several different fields of one or more messages

This command is allowed in the Selected state. This is equivalent to issuing all of the fetchFlags, fetchInternalDate, and fetchSize functions.
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a dict mapping message numbers to dict of the retrieved data values, or whose errback is invoked if there is an error. They dictionary keys are "flags", "date", and "size". (type: Deferred )
def _parseFetchPairs(self, fetchResponseList): (source)
Given the result of parsing a single FETCH response, construct a dict mapping response keys to response values.
ParametersfetchResponseListThe result of parsing a FETCH response with parseNestedParens and extracting just the response data (that is, just the part that comes after "FETCH"). The form of this input (and therefore the output of this method) is very disagreable. A valuable improvement would be to enumerate the possible keys (representing them as structured objects of some sort) rather than using strings and tuples of tuples of strings and so forth. This would allow the keys to be documented more easily and would allow for a much simpler application-facing API (one not based on looking up somewhat hard to predict keys in a dict). Since fetchResponseList notionally represents a flattened sequence of pairs (identifying keys followed by their associated values), collapsing such complex elements of this list as ["BODY", ["HEADER.FIELDS", ["SUBJECT"]]] into a single object would also greatly simplify the implementation of this method.
ReturnsA dict of the response data represented by pairs. Keys in this dictionary are things like "RFC822.TEXT", "FLAGS", or ("BODY", ("HEADER.FIELDS", ("SUBJECT",))). Values are entirely dependent on the key with which they are associated, but retain the same structured as produced by parseNestedParens.
def _cbFetch(self, (lines, last), requestedParts, structured): (source)
Undocumented
def fetchSpecific(self, messages, uid=0, headerType=None, headerNumber=None, headerArgs=None, peek=None, offset=None, length=None): (source)
Retrieve a specific section of one or more messages
ParametersmessagesA message sequence set (type: MessageSet or str )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
headerTypeIf specified, must be one of HEADER, HEADER.FIELDS, HEADER.FIELDS.NOT, MIME, or TEXT, and will determine which part of the message is retrieved. For HEADER.FIELDS and HEADER.FIELDS.NOT, headerArgs must be a sequence of header names. For MIME, headerNumber must be specified. (type: str )
headerNumberThe nested rfc822 index specifying the entity to retrieve. For example, 1 retrieves the first entity of the message, and (2, 1, 3) retrieves the 3rd entity inside the first entity inside the second entity of the message. (type: int or int sequence )
headerArgsIf headerType is HEADER.FIELDS, these are the headers to retrieve. If it is HEADER.FIELDS.NOT, these are the headers to exclude from retrieval. (type: A sequence of str )
peekIf true, cause the server to not set the \Seen flag on this message as a result of this command. (type: bool )
offsetThe number of octets at the beginning of the result to skip. (type: int )
lengthThe number of octets to retrieve. (type: int )
ReturnsA deferred whose callback is invoked with a mapping of message numbers to retrieved data, or whose errback is invoked if there is an error. (type: Deferred )
def _fetch(self, messages, useUID=0, **terms): (source)
Undocumented
def setFlags(self, messages, flags, silent=1, uid=0): (source)

Set the flags for one or more messages.

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
flagsThe flags to set (type: Any iterable of str )
silentIf true, cause the server to supress its verbose response. (type: bool )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a list of the the server's responses ([] if silent is true) or whose errback is invoked if there is an error. (type: Deferred )
def addFlags(self, messages, flags, silent=1, uid=0): (source)

Add to the set flags for one or more messages.

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
flagsThe flags to set (type: Any iterable of str )
silentIf true, cause the server to supress its verbose response. (type: bool )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a list of the the server's responses ([] if silent is true) or whose errback is invoked if there is an error. (type: Deferred )
def removeFlags(self, messages, flags, silent=1, uid=0): (source)

Remove from the set flags for one or more messages.

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: MessageSet or str )
flagsThe flags to set (type: Any iterable of str )
silentIf true, cause the server to supress its verbose response. (type: bool )
uidIndicates whether the message sequence set is of message numbers or of unique message IDs. (type: bool )
ReturnsA deferred whose callback is invoked with a list of the the server's responses ([] if silent is true) or whose errback is invoked if there is an error. (type: Deferred )
def _store(self, messages, cmd, silent, flags, uid): (source)
Undocumented
def copy(self, messages, mailbox, uid): (source)

Copy the specified messages to the specified mailbox.

This command is allowed in the Selected state.
ParametersmessagesA message sequence set (type: str )
mailboxThe mailbox to which to copy the messages (type: str )
uidIf true, the messages refers to message UIDs, rather than message sequence numbers. (type: bool )
ReturnsA deferred whose callback is invoked with a true value when the copy is successful, or whose errback is invoked if there is an error. (type: Deferred )
def modeChanged(self, writeable): (source)
Override me
def flagsChanged(self, newFlags): (source)
Override me
def newMessages(self, exists, recent): (source)
Override me
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:17:34.