This class implements the IMAP server as seen by clients.
This class is responsible for interacting with IMAP clients, and for overseeing the operation of individual command handlers. It looks at client input to decide which Command to defer the real work to, and ensures that the handler is called at the appropriate times.
The IMAP class parses incoming commands as soon as possible and may keep several commands executing at a time, if the client issues that. It depends on Command::group() to decide whether each parsed Command can be executed concurrently with the already running Command objects.
Creates an IMAP server on file descriptor s, and sends an initial OK[CAPABILITY...] response to the client.
This function parses enough of the command line to create a Command, and then uses it to parse the rest of the input.
Records that m is a (possibly) active mailbox group.
Switches to Selected state and operates on the mailbox session s. If the object already had a session, ends the previous session.
Returns true if the client has shown that it supports a given capability, and false if this is still unknown.
Returns a list of all Command objects currently known by this IMAP server. First received command first. Commands in all states may be in the list, except Retired.
Called regularly to ensure that we send an untagged OK every minute or so, in order to ensure a steady stream of packets. Some NAT gateways will kill the connection after as little as two minutes if no traffic is seen.
Emits those responses which can be emitted at this time.
Returns a pointer to the event map currently in force. This is never a null pointer; IMAP sets up a suitable map when it starts.
If there are no commands, a connection is idle(). If the command currently being executed is Idle, the connection is also idle.
Returns the MailboxGroup most likely to be the one the client is working on, assuming that the client performs an operation on m.
Returns a null pointer if the client doesn't seem to be working on any easily defined group, or if it is working on one, but MailboxGroup::hits() returns a value less than l.
Reads input from the client, and feeds it to the appropriate Command handlers.
Returns whatever setPrefersAbsoluteMailboxes() set.
Handles the incoming event e as appropriate for its type.
Reimplemented in order to record the time, so we can rate-limit bad IMAP commands in runCommands();
Records that m is no longer active. MailboxGroup calls this, noone else needs to.
Reserves input from the connection for command.
Records that response needs to be sent at the earliest possible date. When is the earliest possible date? Well, it depends on response, on the commands active and so on.
Restarts the timing logic we use to send little OK response in order to defeat too-quick NAT timeouts.
Executes c once, provided it's in the right state, and emits its responses.
Returns a pointer to the ImapSession object associated with this IMAP server, or 0 if there is none (which can happen only if the server is not in the Selected state).
Records that the client supports capability. The initial value is valse for all capabilities, and there is no way to disable a capability once enabled.
Records that IMAP should base its notification decisions on map henceforth. map must not be null.
Records that the IMAP client likes to see its mailbox names in absolute form (ie. /users/kiki/lists/mja instead of lists/mja) if b is true, and that it prefers relative names otherwise. The initial value is false.
Sets this IMAP connection to be in state s. The initial value is NotAuthenticated.
Notifies the IMAP object that user was successfully authenticated by way of mechanism. This changes the state() of the IMAP object to Authenticated.
This setup function expects to be called from ::main().
It reads and validates any relevant configuration variables, and logs a disaster if it encounters an error.
Returns the current state of this IMAP session, which is one of NotAuthenticated, Authenticated, Selected and Logout.
Causes any blocked commands to be executed if possible.
This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.