Package com.icegreen.greenmail.imap
Class ImapSessionImpl
- java.lang.Object
-
- com.icegreen.greenmail.imap.ImapSessionImpl
-
- All Implemented Interfaces:
ImapSession
public final class ImapSessionImpl extends Object implements ImapSession
- Author:
- Darrell DeBoer
-
-
Constructor Summary
Constructors Constructor Description ImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, String clientAddress)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection()Closes 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.StringgetClientIP()ImapHostManagergetHost()Provides the Imap host for this server, which is used for all access to mail storage and subscriptions.ImapSessionFoldergetSelected()Provides the selected mailbox for this session, ornullif this session is not inImapSessionState.SELECTEDstate.ImapSessionStategetState()GreenMailUsergetUser()Provides the authenticated user for this session, ornullif this session is not inImapSessionState.AUTHENTICATEDorImapSessionState.SELECTEDstate.UserManagergetUserManager()Provides the UserManager for this session, to allow session to validate logins.voidsetAuthenticated(GreenMailUser user)Moves 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 Detail
-
ImapSessionImpl
public ImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, String clientAddress)
-
-
Method Detail
-
getHost
public ImapHostManager 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
public void unsolicitedResponses(ImapResponse request) throws FolderException
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
public void closeConnection(String byeMessage)
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
public UserManager 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
public String getClientIP()
- Specified by:
getClientIPin interfaceImapSession- Returns:
- The IP address of the connected client.
-
setAuthenticated
public void setAuthenticated(GreenMailUser user)
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
public GreenMailUser 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
public void setSelected(MailFolder folder, boolean readOnly)
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
public ImapSessionFolder 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
public ImapSessionState getState()
- Specified by:
getStatein interfaceImapSession- Returns:
- Returns the current state of this session.
-
-