![]() |
![]()
| ![]() |
![]()
NAMENet::IMAP::Server::Connection - Connection to a client DESCRIPTIONMaintains all of the state for a client connection to the IMAP server. METHODSnewCreates a new connection; the server will take care of this step. serverReturns the Net::IMAP::Server that this connection is on. coroReturns 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. io_handleReturns the IO handle that can be used to read from or write to the client. modelGets 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. authGets 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. client_idWhen 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. selected [MAILBOX], [READ_ONLY]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. selected_read_onlyReturns 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. greetingSends out a one-line untagged greeting to the client. handle_linesThe 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. update_timerUpdates the inactivity timer. timer [AnyEvent watcher]Returns the AnyEvent watcher in charge of the inactivity timer. commandsReturns the number of client commands the connection has processed. handle_commandHandles 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. Returns the Net::IMAP::Server::Command instance that was run, or "undef" if it was a continuation line or pending interactive command. class_for COMMANDReturns the package name that implements the given "COMMAND". See "add_command" in Net::IMAP::Server. pendingIf a connection has pending state, contains the callback that will receive the next line of input. closeShuts down this connection, also closing the model and mailboxes. parse_command LINEParses the line into the "tag", "command", and "options". Returns undef if parsing fails for some reason. is_unauthReturns true if the connection is unauthenticated. is_authReturns true if the connection is authenticated. is_selectedReturns true if the connection has selected a mailbox. is_encryptedReturns true if the connection is protected by SSL or TLS. pollPolls the currently selected mailbox, and resets the poll timer. force_pollForces a poll of the selected mailbox the next chance we get. last_pollGets or sets the last time the selected mailbox was polled, in seconds since the epoch. previous_existsThe high-water mark of how many messages the client has been told are in the mailbox. send_untaggedSends any untagged updates about the current mailbox to the client. get_messages STRParses and returns messages fitting the given sequence range. This is on the connection and not the mailbox because messages have connection-dependent sequence numbers. sequence MESSAGEReturns the sequence number for the given message. capabilityReturns 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. log SEVERITY, MESSAGEDefers to "log" in Net::IMAP::Server. untagged_response STRINGSends an untagged response to the client; a newline ia automatically appended. out STRINGSends 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".
|