Go to the latest version of this document.

# ``twisted`.`mail`.`imap4`.`IMAP4Server``

class documentation

`class IMAP4Server(basic.LineReceiver, policies.TimeoutMixin): (source)`

Constructor: `IMAP4Server(chal, contextFactory, scheduler)`

Implements interfaces: `twisted.mail.interfaces.IMailboxIMAPListener`

View In Hierarchy

Protocol implementation for an IMAP4rev1 server.

The server can be in any of four states:

- Non-authenticated
- Authenticated
- Selected
- Logout

Method | `__init__` | Undocumented
Method | `arg_astring` | Parse an astring from the line, return (arg, rest), possibly via a deferred (to handle literals)
Method | `arg_atom` | Parse an atom from the line
Method | `arg_fetchatt` | fetch-att
Method | `arg_finalastring` | Parse an astring from line that represents a command's final argument. This special case exists to enable parsing empty string literals.
Method | `arg_flaglist` | Flag part of store-att-flag
Method | `arg_line` | Command line of UID command
Method | `arg_literal` | Parse a literal from the line
Method | `arg_plist` | Parse a (non-nested) parenthesised list from the line
Method | `arg_searchkeys` | searchkeys
Method | `arg_seqset` | sequence-set
Method | `authenticate` | Undocumented
Method | `authenticateLogin` | Lookup the account associated with the given parameters
Method | `capabilities` | Undocumented
Method | `checkpoint` | Called when the client issues a CHECK command.
Method | `connectionLost` | Called when the connection is shut down.
Method | `connectionMade` | Called when a connection is made.
Method | `dispatchCommand` | Undocumented
Method | `do_APPEND` | Undocumented
Method | `do_AUTHENTICATE` | Undocumented
Method | `do_CAPABILITY` | Undocumented
Method | `do_CHECK` | Undocumented
Method | `do_CLOSE` | Undocumented
Method | `do_COPY` | Undocumented
Method | `do_CREATE` | Undocumented
Method | `do_DELETE` | Undocumented
Method | `do_EXPUNGE` | Undocumented
Method | `do_FETCH` | Undocumented
Method | `do_IDLE` | Undocumented
Method | `do_LOGIN` | Undocumented
Method | `do_LOGOUT` | Undocumented
Method | `do_NAMESPACE` | Undocumented
Method | `do_NOOP` | Undocumented
Method | `do_RENAME` | Undocumented
Method | `do_SEARCH` | Undocumented
Method | `do_STARTTLS` | Undocumented
Method | `do_STATUS` | Undocumented
Method | `do_STORE` | Undocumented
Method | `do_SUBSCRIBE` | Undocumented
Method | `do_UID` | Undocumented
Method | `do_UNSUBSCRIBE` | Undocumented
Method | `flagsChanged` | Indicates that the flags of one or more messages have changed.
Method | `lineReceived` | Override this for when each line is received.
Method | `listCapabilities` | Undocumented
Method | `lookupCommand` | Undocumented
Method | `modeChanged` | Indicates that the write status of a mailbox has changed.
Method | `newMessages` | Indicates that the number of messages in a mailbox has changed.
Method | `opt_charset` | Optional charset of SEARCH command
Method | `opt_datetime` | Optional date-time string
Method | `opt_plist` | Optional parenthesised list
Method | `parse_command` | Undocumented
Method | `parse_idle` | Undocumented
Method | `parse_pending` | Undocumented
Method | `rawDataReceived` | Override this for when raw data is received.
Method | `search_ALL` | Returns `True` if the message matches the ALL search key (always).
Method | `search_ANSWERED` | Returns `True` if the message has been answered.
Method | `search_BCC` | Returns `True` if the message has a BCC address matching the query.
Method | `search_BEFORE` | Undocumented
Method | `search_BODY` | Undocumented
Method | `search_CC` | Undocumented
Method | `search_DELETED` | Undocumented
Method | `search_DRAFT` | Undocumented
Method | `search_FLAGGED` | Undocumented
Method | `search_FROM` | Undocumented
Method | `search_HEADER` | Undocumented
Method | `search_KEYWORD` | Undocumented
Method | `search_LARGER` | Undocumented
Method | `search_NEW` | Undocumented
Method | `search_NOT` | Returns `True` if the message does not match the query.
Method | `search_OLD` | Undocumented
Method | `search_ON` | Undocumented
Method | `search_OR` | Returns `True` if the message matches any of the first two query items.
Method | `search_RECENT` | Undocumented
Method | `search_SEEN` | Undocumented
Method | `search_SENTBEFORE` | Returns `True` if the message date is earlier than the query date.
Method | `search_SENTON` | Returns `True` if the message date is the same as the query date.
Method | `search_SENTSINCE` | Returns `True` if the message date is later than the query date.
Method | `search_SINCE` | Undocumented
Method | `search_SMALLER` | Undocumented
Method | `search_SUBJECT` | Undocumented
Method | `search_TEXT` | Undocumented
Method | `search_TO` | Undocumented
Method | `search_UID` | Returns `True` if the message UID is in the range defined by the search query.
Method | `search_UNANSWERED` | Undocumented
Method | `search_UNDELETED` | Undocumented
Method | `search_UNDRAFT` | Undocumented
Method | `search_UNFLAGGED` | Undocumented
Method | `search_UNKEYWORD` | Undocumented
Method | `search_UNSEEN` | Undocumented
Method | `sendBadResponse` | Undocumented
Method | `sendContinuationRequest` | Undocumented
Method | `sendNegativeResponse` | Undocumented
Method | `sendPositiveResponse` | Undocumented
Method | `sendServerGreeting` | Undocumented
Method | `sendUntaggedResponse` | Undocumented
Method | `spew_body` | Undocumented
Method | `spew_bodystructure` | Undocumented
Method | `spew_envelope` | Undocumented
Method | `spew_flags` | Undocumented
Method | `spew_internaldate` | Undocumented
Method | `spew_rfc822` | Undocumented
Method | `spew_rfc822header` | Undocumented
Method | `spew_rfc822size` | Undocumented
Method | `spew_rfc822text` | Undocumented
Method | `spew_uid` | Undocumented
Method | `spewMessage` | Undocumented
Method | `timeoutConnection` | Called when the connection times out.
Constant | `IDENT` | Undocumented
Constant | `POSTAUTH_TIMEOUT` | Undocumented
Class Variable | `atomre` | Undocumented
Class Variable | `auth_APPEND` | Undocumented
Class Variable | `auth_CREATE` | Undocumented
Class Variable | `auth_DELETE` | Undocumented
Class Variable | `auth_EXAMINE` | Undocumented
Class Variable | `auth_LIST` | Undocumented
Class Variable | `auth_LSUB` | Undocumented
Class Variable | `auth_NAMESPACE` | Undocumented
Class Variable | `auth_RENAME` | Undocumented
Class Variable | `auth_SELECT` | Undocumented
Class Variable | `auth_STATUS` | Undocumented
Class Variable | `auth_SUBSCRIBE` | Undocumented
Class Variable | `auth_UNSUBSCRIBE` | Undocumented
Class Variable | `portal` | Undocumented
Class Variable | `select_CHECK` | Undocumented
Class Variable | `select_CLOSE` | Undocumented
Class Variable | `select_COPY` | Undocumented
Class Variable | `select_EXPUNGE` | Undocumented
Class Variable | `select_FETCH` | Undocumented
Class Variable | `select_IDLE` | Undocumented
Class Variable | `select_SEARCH` | Undocumented
Class Variable | `select_STORE` | Undocumented
Class Variable | `select_UID` | Undocumented
Class Variable | `startedTLS` | Undocumented
Class Variable | `unauth_AUTHENTICATE` | Undocumented
Class Variable | `unauth_CAPABILITY` | Undocumented
Class Variable | `unauth_LOGIN` | Undocumented
Class Variable | `unauth_LOGOUT` | Undocumented
Class Variable | `unauth_NOOP` | Undocumented
Class Variable | `unauth_STARTTLS` | Undocumented
Instance Variable | `account` | Undocumented
Instance Variable | `blocked` | Undocumented
Instance Variable | `canStartTLS` | Undocumented
Instance Variable | `challengers` | Undocumented
Instance Variable | `ctx` | Undocumented
Instance Variable | `lastState` | Undocumented
Instance Variable | `mbox` | Undocumented
Instance Variable | `parseState` | Undocumented
Instance Variable | `parseTag` | Undocumented
Instance Variable | `state` | Undocumented
Instance Variable | `tags` | Undocumented
Instance Variable | `timeOut` | Undocumented
Method | `__cbAppend` | Undocumented
Method | `__cbAuthChunk` | Undocumented
Method | `__cbAuthResp` | Undocumented
Method | `__cbCheck` | Undocumented
Method | `__cbClose` | Undocumented
Method | `__cbCopied` | Undocumented
Method | `__cbCopy` | Undocumented
Method | `__cbDispatch` | Undocumented
Method | `__cbExpunge` | Undocumented
Method | `__cbFetch` | Undocumented
Method | `__cbLogin` | Undocumented
Method | `__cbManualSearch` | Apply the search filter to a set of messages. Send the response to the client.
Method | `__cbSearch` | Undocumented
Method | `__cbStatus` | Undocumented
Method | `__cbStore` | Undocumented
Method | `__doCommand` | Undocumented
Method | `__ebAppend` | Undocumented
Method | `__ebAuthChunk` | Undocumented
Method | `__ebAuthResp` | Undocumented
Method | `__ebCheck` | Undocumented
Method | `__ebClose` | Undocumented
Method | `__ebCopy` | Undocumented
Method | `__ebDispatch` | Undocumented
Method | `__ebExpunge` | Undocumented
Method | `__ebFetch` | Undocumented
Method | `__ebLogin` | Undocumented
Method | `__ebSearch` | Undocumented
Method | `__ebSpewMessage` | Undocumented
Method | `__ebStatus` | Undocumented
Method | `__ebStore` | Undocumented
Method | `_cbAppendGotMailbox` | Undocumented
Method | `_cbCopySelectedMailbox` | Undocumented
Method | `_cbListWork` | Undocumented
Method | `_cbSelectWork` | Undocumented
Method | `_cbStatusGotMailbox` | Undocumented
Method | `_ebAppendGotMailbox` | Undocumented
Method | `_ebCopySelectedMailbox` | Undocumented
Method | `_ebListWork` | Undocumented
Method | `_ebSelectWork` | Undocumented
Method | `_ebStatusGotMailbox` | Undocumented
Method | `_fileLiteral` | Undocumented
Method | `_listWork` | Undocumented
Method | `_respond` | Undocumented
Method | `_searchFilter` | Pop search terms from the beginning of `query` until there are none left and apply them to the given message.
Method | `_selectWork` | Undocumented
Method | `_setupChallenge` | Undocumented
Method | `_singleSearchStep` | Pop one search term from the beginning of `query` (possibly more than one element) and return whether it matches the given message.
Method | `_stringLiteral` | Undocumented
Method | `_unblock` | Undocumented
Class Variable | `_literalStringLimit` | Undocumented
Class Variable | `_requiresLastMessageInfo` | Undocumented
Instance Variable | `_oldTimeout` | Undocumented
Instance Variable | `_onLogout` | Undocumented
Instance Variable | `_pendingLiteral` | Undocumented
Instance Variable | `_queuedAsync` | Undocumented
Instance Variable | `_scheduler` | 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 | `lineLengthExceeded` | Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
Method | `sendLine` | Sends a line to the other end of the connection.
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.
Constant | `MAX_LENGTH` | The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.
Class Variable | `delimiter` | The line-ending delimiter to use. By default this is `b'\r\n'`.
Instance Variable | `line_mode` | Undocumented
Instance Variable | `_buffer` | Undocumented
Instance Variable | `_busyReceiving` | Undocumented

Inherited from `Protocol` (via `LineReceiver`):

Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable | `factory` | Undocumented

Inherited from `BaseProtocol` (via `LineReceiver`, `Protocol`):

Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `connected` | Undocumented
Instance Variable | `transport` | Undocumented

Inherited from `_PauseableMixin` (via `LineReceiver`, `Protocol`, `BaseProtocol`):

Method | `pauseProducing` | Undocumented
Method | `resumeProducing` | Undocumented
Method | `stopProducing` | Undocumented
Instance Variable | `paused` | Undocumented

Inherited from `TimeoutMixin` (via `LineReceiver`, `Protocol`, `BaseProtocol`, `_PauseableMixin`):

Method | `callLater` | Wrapper around `reactor.callLater` for test purpose.
Method | `resetTimeout` | Reset the timeout count down.
Method | `setTimeout` | Change the timeout period
Method | `__timedOut` | Undocumented
Instance Variable | `__timeoutCall` | Undocumented

def __init__(self, chal=None, contextFactory=None, scheduler=None): (source)

Undocumented

def arg_astring(self, line, final=False): (source)

Parse an astring from the line, return (arg, rest), possibly via a deferred (to handle literals)

Parameters
line:`bytes` | A line that contains a string literal.
final | Is this the final argument? @type final `bool`

Returns
`tuple` of (`bytes`, `bytes`) or a `Deferred` | A 2-tuple containing the parsed argument and any trailing data, or a `Deferred` that fires with that 2-tuple

def arg_atom(self, line): (source)

Parse an atom from the line

def arg_fetchatt(self, line): (source)

fetch-att

def arg_finalastring(self, line): (source)

Parse an astring from line that represents a command's final argument. This special case exists to enable parsing empty string literals.

Parameters
line:`bytes` | A line that contains a string literal.

Returns
`tuple` of (`bytes`, `bytes`) or a `Deferred` | A 2-tuple containing the parsed argument and any trailing data, or a `Deferred` that fires with that 2-tuple

See Also
https://twistedmatrix.com/trac/ticket/9207

def arg_flaglist(self, line): (source)

Flag part of store-att-flag

def arg_line(self, line): (source)

Command line of UID command

def arg_literal(self, line): (source)

Parse a literal from the line

def arg_plist(self, line): (source)

Parse a (non-nested) parenthesised list from the line

def arg_searchkeys(self, line): (source)

searchkeys

def arg_seqset(self, line): (source)

sequence-set

def authenticate(self, chal, tag): (source)

Undocumented

def authenticateLogin(self, user, passwd): (source)

Lookup the account associated with the given parameters

Override this method to define the desired authentication behavior.

The default behavior is to defer authentication to `self.portal` if it is not None, or to deny the login otherwise.

Parameters
user:`str` | The username to lookup
passwd:`str` | The password to login with

def capabilities(self): (source)

Undocumented

def checkpoint(self): (source)

Called when the client issues a CHECK command.

This should perform any checkpoint operations required by the server. It may be a long running operation, but may not block. If it returns a deferred, the client will only be informed of success (or failure) when the deferred's callback (or errback) is invoked.

def connectionLost(self, reason): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.connectionLost`

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Parameters
reason:`twisted.python.failure.Failure` | Undocumented

def connectionMade(self): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.BaseProtocol.connectionMade`

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 dispatchCommand(self, tag, cmd, rest, uid=None): (source)

Undocumented

def do_APPEND(self, tag, mailbox, flags, date, message): (source)

Undocumented

def do_AUTHENTICATE(self, tag, args): (source)

Undocumented

def do_CAPABILITY(self, tag): (source)

Undocumented

def do_CHECK(self, tag): (source)

Undocumented

def do_CLOSE(self, tag): (source)

Undocumented

def do_COPY(self, tag, messages, mailbox, uid=0): (source)

Undocumented

def do_CREATE(self, tag, name): (source)

Undocumented

def do_DELETE(self, tag, name): (source)

Undocumented

def do_EXPUNGE(self, tag): (source)

Undocumented

def do_FETCH(self, tag, messages, query, uid=0): (source)

Undocumented

def do_IDLE(self, tag): (source)

Undocumented

def do_LOGIN(self, tag, user, passwd): (source)

Undocumented

def do_LOGOUT(self, tag): (source)

Undocumented

def do_NAMESPACE(self, tag): (source)

Undocumented

def do_NOOP(self, tag): (source)

Undocumented

def do_RENAME(self, tag, oldname, newname): (source)

Undocumented

def do_SEARCH(self, tag, charset, query, uid=0): (source)

Undocumented

def do_STARTTLS(self, tag): (source)

Undocumented

def do_STATUS(self, tag, mailbox, names): (source)

Undocumented

def do_STORE(self, tag, messages, mode, flags, uid=0): (source)

Undocumented

def do_SUBSCRIBE(self, tag, name): (source)

Undocumented

def do_UID(self, tag, command, line): (source)

Undocumented

def do_UNSUBSCRIBE(self, tag, name): (source)

Undocumented

def flagsChanged(self, newFlags): (source)
from `twisted.mail.interfaces.IMailboxIMAPListener`

Indicates that the flags of one or more messages have changed.

Parameters
newFlags:`dict` | A mapping of message identifiers to tuples of flags now set on that message.

def lineReceived(self, line): (source)
overrides `twisted.protocols.basic.LineReceiver.lineReceived`

Override this for when each line is received.

Parameters
line:`bytes` | The line which was received with the delimiter removed.

def listCapabilities(self): (source)

Undocumented

def lookupCommand(self, cmd): (source)

Undocumented

def modeChanged(self, writeable): (source)
from `twisted.mail.interfaces.IMailboxIMAPListener`

Indicates that the write status of a mailbox has changed.

Parameters
writeable:`bool` | A true value if write is now allowed, false otherwise.

def newMessages(self, exists, recent): (source)
from `twisted.mail.interfaces.IMailboxIMAPListener`

Indicates that the number of messages in a mailbox has changed.

Parameters
exists:`int` or `None` | The total number of messages now in this mailbox. If the total number of messages has not changed, this should be `None`.
recent:`int` | The number of messages now flagged `\Recent`. If the number of recent messages has not changed, this should be `None`.

def opt_charset(self, line): (source)

Optional charset of SEARCH command

def opt_datetime(self, line): (source)

Optional date-time string

def opt_plist(self, line): (source)

Optional parenthesised list

def parse_command(self, line): (source)

Undocumented

def parse_idle(self, *args): (source)

Undocumented

def parse_pending(self, line): (source)

Undocumented

def rawDataReceived(self, data): (source)
overrides `twisted.protocols.basic.LineReceiver.rawDataReceived`

Override this for when raw data is received.

def search_ALL(self, query, id, msg): (source)

Returns `True` if the message matches the ALL search key (always).

Parameters
query:A `list` of `str` | A list representing the parsed query string.
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | Undocumented

def search_ANSWERED(self, query, id, msg): (source)

Returns `True` if the message has been answered.

Parameters
query:A `list` of `str` | A list representing the parsed query string.
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | Undocumented

def search_BCC(self, query, id, msg): (source)

Returns `True` if the message has a BCC address matching the query.

Parameters
query:A `list` of `str` | A list whose first element is a BCC `str`
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | Undocumented

def search_BEFORE(self, query, id, msg): (source)

Undocumented

def search_BODY(self, query, id, msg): (source)

Undocumented

def search_CC(self, query, id, msg): (source)

Undocumented

def search_DELETED(self, query, id, msg): (source)

Undocumented

def search_DRAFT(self, query, id, msg): (source)

Undocumented

def search_FLAGGED(self, query, id, msg): (source)

Undocumented

def search_FROM(self, query, id, msg): (source)

Undocumented

def search_HEADER(self, query, id, msg): (source)

Undocumented

def search_KEYWORD(self, query, id, msg): (source)

Undocumented

def search_LARGER(self, query, id, msg): (source)

Undocumented

def search_NEW(self, query, id, msg): (source)

Undocumented

def search_NOT(self, query, id, msg, lastIDs): (source)

Returns `True` if the message does not match the query.

Parameters
query:A `list` of `str` | A list representing the parsed form of the search query.
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | The message being checked.
lastIDs:`tuple` | A tuple of (last sequence id, last message id). The last sequence id is an `int` containing the highest sequence number of a message in the mailbox. The last message id is an `int` containing the highest UID of a message in the mailbox.

def search_OLD(self, query, id, msg): (source)

Undocumented

def search_ON(self, query, id, msg): (source)

Undocumented

def search_OR(self, query, id, msg, lastIDs): (source)

Returns `True` if the message matches any of the first two query items.

Parameters
query:A `list` of `str` | A list representing the parsed form of the search query.
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | The message being checked.
lastIDs:`tuple` | A tuple of (last sequence id, last message id). The last sequence id is an `int` containing the highest sequence number of a message in the mailbox. The last message id is an `int` containing the highest UID of a message in the mailbox.

def search_RECENT(self, query, id, msg): (source)

Undocumented

def search_SEEN(self, query, id, msg): (source)

Undocumented

def search_SENTBEFORE(self, query, id, msg): (source)

Returns `True` if the message date is earlier than the query date.

Parameters
query:A `list` of `str` | A list whose first element starts with a stringified date that is a fragment of an `imap4.Query()`. The date must be in the format 'DD-Mon-YYYY', for example '03-March-2003' or '03-Mar-2003'.
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | Undocumented

def search_SENTON(self, query, id, msg): (source)

Returns `True` if the message date is the same as the query date.

Parameters
query:A `list` of `str` | A list whose first element starts with a stringified date that is a fragment of an `imap4.Query()`. The date must be in the format 'DD-Mon-YYYY', for example '03-March-2003' or '03-Mar-2003'.
id | Undocumented
msg:Provider of `imap4.IMessage` | Undocumented

def search_SENTSINCE(self, query, id, msg): (source)

Returns `True` if the message date is later than the query date.

Parameters
query:A `list` of `str` | A list whose first element starts with a stringified date that is a fragment of an `imap4.Query()`. The date must be in the format 'DD-Mon-YYYY', for example '03-March-2003' or '03-Mar-2003'.
id | Undocumented
msg:Provider of `imap4.IMessage` | Undocumented

def search_SINCE(self, query, id, msg): (source)

Undocumented

def search_SMALLER(self, query, id, msg): (source)

Undocumented

def search_SUBJECT(self, query, id, msg): (source)

Undocumented

def search_TEXT(self, query, id, msg): (source)

Undocumented

def search_TO(self, query, id, msg): (source)

Undocumented

def search_UID(self, query, id, msg, lastIDs): (source)

Returns `True` if the message UID is in the range defined by the search query.

Parameters
query:A `list` of `bytes` | A list representing the parsed form of the search query. Its first element should be a `str` that can be interpreted as a sequence range, for example '2:4,5:*'.
id:`int` | The sequence number of the message being checked.
msg:Provider of `imap4.IMessage` | The message being checked.
lastIDs:`tuple` | A tuple of (last sequence id, last message id). The last sequence id is an `int` containing the highest sequence number of a message in the mailbox. The last message id is an `int` containing the highest UID of a message in the mailbox.

def search_UNANSWERED(self, query, id, msg): (source)

Undocumented

def search_UNDELETED(self, query, id, msg): (source)

Undocumented

def search_UNDRAFT(self, query, id, msg): (source)

Undocumented

def search_UNFLAGGED(self, query, id, msg): (source)

Undocumented

def search_UNKEYWORD(self, query, id, msg): (source)

Undocumented

def search_UNSEEN(self, query, id, msg): (source)

Undocumented

def sendBadResponse(self, tag=None, message=b''): (source)

Undocumented

def sendContinuationRequest(self, msg=b'Ready for additional command text'): (source)

Undocumented

def sendNegativeResponse(self, tag=None, message=b''): (source)

Undocumented

def sendPositiveResponse(self, tag=None, message=b''): (source)

Undocumented

def sendServerGreeting(self): (source)

Undocumented

def sendUntaggedResponse(self, message, isAsync=None): (source)

Undocumented

def spew_body(self, part, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_bodystructure(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_envelope(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_flags(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_internaldate(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_rfc822(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_rfc822header(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_rfc822size(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_rfc822text(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spew_uid(self, id, msg, _w=None, _f=None): (source)

Undocumented

def spewMessage(self, id, msg, query, uid): (source)

Undocumented

def timeoutConnection(self): (source)
overrides `twisted.protocols.policies.TimeoutMixin.timeoutConnection`

Called when the connection times out.

Override to define behavior other than dropping the connection.

IDENT: `bytes` = (source)

Undocumented

Value

    b'Twisted IMAP4rev1 Ready'

POSTAUTH_TIMEOUT = (source)

Undocumented

Value

    60 * 30

atomre = (source)

Undocumented

auth_APPEND = (source)

Undocumented

auth_CREATE = (source)

Undocumented

auth_DELETE = (source)

Undocumented

auth_EXAMINE = (source)

Undocumented

auth_LIST = (source)

Undocumented

auth_LSUB = (source)

Undocumented

auth_NAMESPACE = (source)

Undocumented

auth_RENAME = (source)

Undocumented

auth_SELECT = (source)

Undocumented

auth_STATUS = (source)

Undocumented

auth_SUBSCRIBE = (source)

Undocumented

auth_UNSUBSCRIBE = (source)

Undocumented

portal = (source)

Undocumented

select_CHECK = (source)

Undocumented

select_CLOSE = (source)

Undocumented

select_COPY = (source)

Undocumented

select_EXPUNGE = (source)

Undocumented

select_FETCH = (source)

Undocumented

select_IDLE = (source)

Undocumented

select_SEARCH = (source)

Undocumented

select_STORE = (source)

Undocumented

select_UID = (source)

Undocumented

startedTLS: `bool` = (source)

Undocumented

unauth_AUTHENTICATE = (source)

Undocumented

unauth_CAPABILITY = (source)

Undocumented

unauth_LOGIN = (source)

Undocumented

unauth_LOGOUT = (source)

Undocumented

unauth_NOOP = (source)

Undocumented

unauth_STARTTLS = (source)

Undocumented

account = (source)

Undocumented

blocked: `list` = (source)

Undocumented

canStartTLS = (source)

Undocumented

challengers = (source)

Undocumented

ctx = (source)

Undocumented

lastState = (source)

Undocumented

mbox = (source)

Undocumented

parseState = (source)

Undocumented

parseTag = (source)

Undocumented

state: `str` = (source)

Undocumented

tags: `dict` = (source)

Undocumented

timeOut: `int` = (source)
overrides `twisted.protocols.policies.TimeoutMixin.timeOut`

Undocumented

def __cbAppend(self, result, tag, mbox): (source)

Undocumented

def __cbAuthChunk(self, result, chal, tag): (source)

Undocumented

def __cbAuthResp(self, result, tag): (source)

Undocumented

def __cbCheck(self, result, tag): (source)

Undocumented

def __cbClose(self, result, tag): (source)

Undocumented

def __cbCopied(self, deferredIds, tag, mbox): (source)

Undocumented

def __cbCopy(self, messages, tag, mbox): (source)

Undocumented

def __cbDispatch(self, result, tag, fn, args, parseargs, uid): (source)

Undocumented

def __cbExpunge(self, result, tag): (source)

Undocumented

def __cbFetch(self, results, tag, query, uid): (source)

Undocumented

def __cbLogin(self, result, tag): (source)

Undocumented

def __cbManualSearch(self, result, tag, mbox, query, uid, searchResults=None): (source)

Apply the search filter to a set of messages. Send the response to the client.

Parameters
result:`list` of `tuple` of (`int`, provider of `imap4.IMessage`) | A list two tuples of messages with their sequence ids, sorted by the ids in descending order.
tag:`str` | A command tag.
mbox:Provider of `imap4.IMailbox` | The searched mailbox.
query:`list` | A list representing the parsed form of the search query.
uid | A flag indicating whether the search is over message sequence numbers or UIDs.
searchResults:`list` | The search results so far or `None` if no results yet.

def __cbSearch(self, result, tag, mbox, uid): (source)

Undocumented

def __cbStatus(self, status, tag, box): (source)

Undocumented

def __cbStore(self, result, tag, mbox, uid, silent): (source)

Undocumented

def __doCommand(self, tag, handler, args, parseargs, line, uid): (source)

Undocumented

def __ebAppend(self, failure, tag): (source)

Undocumented

def __ebAuthChunk(self, failure, tag): (source)

Undocumented

def __ebAuthResp(self, failure, tag): (source)

Undocumented

def __ebCheck(self, failure, tag): (source)

Undocumented

def __ebClose(self, failure, tag): (source)

Undocumented

def __ebCopy(self, failure, tag): (source)

Undocumented

def __ebDispatch(self, failure, tag): (source)

Undocumented

def __ebExpunge(self, failure, tag): (source)

Undocumented

def __ebFetch(self, failure, tag): (source)

Undocumented

def __ebLogin(self, failure, tag): (source)

Undocumented

def __ebSearch(self, failure, tag): (source)

Undocumented

def __ebSpewMessage(self, failure): (source)

Undocumented

def __ebStatus(self, failure, tag, box): (source)

Undocumented

def __ebStore(self, failure, tag): (source)

Undocumented

def _cbAppendGotMailbox(self, mbox, tag, flags, date, message): (source)

Undocumented

def _cbCopySelectedMailbox(self, mbox, tag, messages, mailbox, uid): (source)

Undocumented

def _cbListWork(self, mailboxes, tag, sub, cmdName): (source)

Undocumented

def _cbSelectWork(self, mbox, cmdName, tag): (source)

Undocumented

def _cbStatusGotMailbox(self, mbox, tag, mailbox, names): (source)

Undocumented

def _ebAppendGotMailbox(self, failure, tag): (source)

Undocumented

def _ebCopySelectedMailbox(self, failure, tag): (source)

Undocumented

def _ebListWork(self, failure, tag): (source)

Undocumented

def _ebSelectWork(self, failure, cmdName, tag): (source)

Undocumented

def _ebStatusGotMailbox(self, failure, tag): (source)

Undocumented

def _fileLiteral(self, size): (source)

Undocumented

def _listWork(self, tag, ref, mbox, sub, cmdName): (source)

Undocumented

def _respond(self, state, tag, message): (source)

Undocumented

def _searchFilter(self, query, id, msg, lastSequenceId, lastMessageId): (source)

Pop search terms from the beginning of `query` until there are none left and apply them to the given message.

Parameters
query | A list representing the parsed form of the search query.
id | The sequence number of the message being checked.
msg | The message being checked.
lastSequenceId:`int` | The highest sequence number of any message in the mailbox being searched.
lastMessageId:`int` | The highest UID of any message in the mailbox being searched.

Returns
Boolean indicating whether all of the query terms match the message.

def _selectWork(self, tag, name, rw, cmdName): (source)

Undocumented

def _setupChallenge(self, chal, tag): (source)

Undocumented

def _singleSearchStep(self, query, msgId, msg, lastSequenceId, lastMessageId): (source)

Pop one search term from the beginning of `query` (possibly more than one element) and return whether it matches the given message.

Parameters
query | A list representing the parsed form of the search query.
msgId | The sequence number of the message being checked.
msg | The message being checked.
lastSequenceId | The highest sequence number of any message in the mailbox being searched.
lastMessageId | The highest UID of any message in the mailbox being searched.

Returns
Boolean indicating whether the query term matched the message.

def _stringLiteral(self, size): (source)

Undocumented

def _unblock(self): (source)

Undocumented

_literalStringLimit: `int` = (source)

Undocumented

_requiresLastMessageInfo: `set[bytes]` = (source)

Undocumented

_oldTimeout = (source)

Undocumented

_onLogout = (source)

Undocumented

_pendingLiteral = (source)

Undocumented

_queuedAsync: `list` = (source)

Undocumented

_scheduler = (source)

Undocumented