Package com.icegreen.greenmail.imap
Class ImapSessionImpl
java.lang.Object
com.icegreen.greenmail.imap.ImapSessionImpl
- All Implemented Interfaces:
ImapSession
- Author:
- Darrell DeBoer <darrell@apache.org>
-
Constructor Summary
ConstructorsConstructorDescriptionImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, String clientAddress) -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the connection for this session.voidcloseConnection(String byeMessage) Closes the connection for this session with a final good-bye message.voiddeselect()Moves the session out ofImapSessionState.SELECTEDstate and back intoImapSessionState.AUTHENTICATEDstate.getHost()Provides the Imap host for this server, which is used for all access to mail storage and subscriptions.Provides the selected mailbox for this session, ornullif this session is not inImapSessionState.SELECTEDstate.getState()getUser()Provides the authenticated user for this session, ornullif this session is not inImapSessionState.AUTHENTICATEDorImapSessionState.SELECTEDstate.Provides the UserManager for this session, to allow session to validate logins.voidMoves the session intoImapSessionState.AUTHENTICATEDstate with the supplied user.voidsetSelected(MailFolder folder, boolean readOnly) Moves this session intoImapSessionState.SELECTEDstate and sets the supplied mailbox to be the currently selected mailbox.voidunsolicitedResponses(ImapResponse request) Sends any unsolicited responses to the client, such as EXISTS and FLAGS responses when the selected mailbox is modified by another user.voidunsolicitedResponses(ImapResponse response, boolean omitExpunged)
-
Constructor Details
-
ImapSessionImpl
public ImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, String clientAddress)
-
-
Method Details
-
getHost
Description copied from interface:ImapSessionProvides the Imap host for this server, which is used for all access to mail storage and subscriptions.- Specified by:
getHostin interfaceImapSession- Returns:
- The ImapHost for this server.
-
unsolicitedResponses
Description copied from interface:ImapSessionSends any unsolicited responses to the client, such as EXISTS and FLAGS responses when the selected mailbox is modified by another user.- Specified by:
unsolicitedResponsesin interfaceImapSession- Parameters:
request- The response to write to- Throws:
FolderException
-
unsolicitedResponses
public void unsolicitedResponses(ImapResponse response, boolean omitExpunged) throws FolderException - Specified by:
unsolicitedResponsesin interfaceImapSession- Throws:
FolderException
-
closeConnection
Description copied from interface:ImapSessionCloses the connection for this session with a final good-bye message.- Specified by:
closeConnectionin interfaceImapSession- Parameters:
byeMessage- the good-bye message.
-
closeConnection
public void closeConnection()Description copied from interface:ImapSessionCloses the connection for this session.- Specified by:
closeConnectionin interfaceImapSession
-
getUserManager
Description copied from interface:ImapSessionProvides the UserManager for this session, to allow session to validate logins.- Specified by:
getUserManagerin interfaceImapSession- Returns:
- The UserManager for this session.
-
getClientIP
- Specified by:
getClientIPin interfaceImapSession- Returns:
- The IP address of the connected client.
-
setAuthenticated
Description copied from interface:ImapSessionMoves the session intoImapSessionState.AUTHENTICATEDstate with the supplied user.- Specified by:
setAuthenticatedin interfaceImapSession- Parameters:
user- The user who is authenticated for this session.
-
getUser
Description copied from interface:ImapSessionProvides the authenticated user for this session, ornullif this session is not inImapSessionState.AUTHENTICATEDorImapSessionState.SELECTEDstate.- Specified by:
getUserin interfaceImapSession- Returns:
- The user authenticated for this session
-
deselect
public void deselect()Description copied from interface:ImapSessionMoves the session out ofImapSessionState.SELECTEDstate and back intoImapSessionState.AUTHENTICATEDstate. The selected mailbox is cleared.- Specified by:
deselectin interfaceImapSession
-
setSelected
Description copied from interface:ImapSessionMoves this session intoImapSessionState.SELECTEDstate and sets the supplied mailbox to be the currently selected mailbox.- Specified by:
setSelectedin interfaceImapSession- Parameters:
folder- The selected mailbox.readOnly- Iftrue, the selection is set to be read only.
-
getSelected
Description copied from interface:ImapSessionProvides the selected mailbox for this session, ornullif this session is not inImapSessionState.SELECTEDstate.- Specified by:
getSelectedin interfaceImapSession- Returns:
- the currently selected mailbox.
-
getState
- Specified by:
getStatein interfaceImapSession- Returns:
- Returns the current state of this session.
-