Net::IMAP::Server::Connection - Connection to a client
Maintains all of the state for a client connection to the IMAP server.
Creates a new connection; the server will take care of this step.
Returns the Net::IMAP::Server that this connection is on.
Returns the Coro process associated with this connection. For things interacting with this connection, it will probably be the current coroutine, except for interactions coming from event loops.
Returns the IO handle that can be used to read from or write to the client.
Gets or sets the Net::IMAP::Server::DefaultModel or descendant associated with this connection. Note that connections which have not authenticated yet do not have a model.
Gets or sets the Net::IMAP::Server::DefaultAuth or descendant associated with this connection. Note that connections which have not authenticated yet do not have an auth object.
When called with no arguments, returns a hashref of identifying information provided by the client. When key-value pairs are provided, sets the client properties. See RFC 2971.
Gets or sets the currently selected mailbox for this connection. Changing mailboxes triggers the sending of untagged notifications to the client, as well as calling "close" in Net::IMAP::Server::Mailbox and "select" in Net::IMAP::Server::Mailbox.
Returns true of the currently selected mailbox has been forced into read-only mode. Note that the mailbox may be read-only for other reasons, so checking "read_only" in Net::IMAP::Server::Mailbox is suggested instead.
Sends out a one-line untagged greeting to the client.
The main line handling loop. Since we are using Coro, this cedes to other coroutines whenever we block, given them a chance to run. We additionally cede after handling every command.
Updates the inactivity timer.
Returns the AnyEvent watcher in charge of the inactivity timer.
Returns the number of client commands the connection has processed.
Handles a single line from the client. This is not quite the same as handling a command, because of client literals and continuation commands. This also handles dispatch of client commands to Net::IMAP::Server::Command subclasses (see "class_for").
Any errors generated while running commands will cause a NO Server error to be sent to the client -- unless the error message starts with NO or c<BAD>, in which case it will be relayed to the client.
NO Server error
NO
Returns the Net::IMAP::Server::Command instance that was run, or undef if it was a continuation line or pending interactive command.
undef
Returns the package name that implements the given COMMAND. See "add_command" in Net::IMAP::Server.
COMMAND
If a connection has pending state, contains the callback that will receive the next line of input.
Shuts down this connection, also closing the model and mailboxes.
Parses the line into the tag, command, and options. Returns undef if parsing fails for some reason.
tag
command
options
Returns true if the connection is unauthenticated.
Returns true if the connection is authenticated.
Returns true if the connection has selected a mailbox.
Returns true if the connection is protected by SSL or TLS.
Polls the currently selected mailbox, and resets the poll timer.
Forces a poll of the selected mailbox the next chance we get.
Gets or sets the last time the selected mailbox was polled, in seconds since the epoch.
The high-water mark of how many messages the client has been told are in the mailbox.
Sends any untagged updates about the current mailbox to the client.
Parses and returns messages fitting the given sequence range. This is on the connection and not the mailbox because messages have connection-dependent sequence numbers.
Returns the sequence number for the given message.
Returns the current capability list for this connection, as a string. Connections not under TLS or SSL always have the LOGINDISABLED capability, and no authentication capabilities. The "auth_class" in Net::IMAP::Server's "sasl_provides" in Net::IMAP::Server::DefaultAuth method is used to list known AUTH= types.
LOGINDISABLED
AUTH=
Defers to "log" in Net::IMAP::Server.
Sends an untagged response to the client; a newline ia automatically appended.
Sends the message to the client. If the client's connection has dropped, or the send fails for whatever reason, "close" the connection and then die, which is caught by "handle_lines".
To install Net::IMAP::Server, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::IMAP::Server
CPAN shell
perl -MCPAN -e shell install Net::IMAP::Server
For more information on module installation, please visit the detailed CPAN module installation guide.