Package com.icegreen.greenmail.imap
Class ImapSessionImpl
java.lang.Object
com.icegreen.greenmail.imap.ImapSessionImpl
- All Implemented Interfaces:
ImapSession
- Version:
- $Revision: 109034 $
- Author:
- Darrell DeBoer <darrell@apache.org>
-
Constructor Summary
ConstructorsConstructorDescriptionImapSessionImpl
(ImapHostManager imapHost, UserManager users, ImapHandler handler, String clientHostName, String clientAddress) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes the connection for this session.void
closeConnection
(String byeMessage) void
deselect()
Moves the session out ofImapSessionState.SELECTED
state and back intoImapSessionState.AUTHENTICATED
state.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, ornull
if this session is not inImapSessionState.SELECTED
state.getState()
getUser()
Provides the authenticated user for this session, ornull
if this session is not inImapSessionState.AUTHENTICATED
orImapSessionState.SELECTED
state.Provides the UserManager for this session, to allow session to validate logins.boolean
void
Moves the session intoImapSessionState.AUTHENTICATED
state with the supplied user.void
setSelected
(MailFolder folder, boolean readOnly) Moves this session intoImapSessionState.SELECTED
state and sets the supplied mailbox to be the currently selected mailbox.void
unsolicitedResponses
(ImapResponse request) Sends any unsolicited responses to the client, such as EXISTS and FLAGS responses when the selected mailbox is modified by another user.void
unsolicitedResponses
(ImapResponse response, boolean omitExpunged)
-
Constructor Details
-
ImapSessionImpl
public ImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, String clientHostName, String clientAddress)
-
-
Method Details
-
getHost
Description copied from interface:ImapSession
Provides the Imap host for this server, which is used for all access to mail storage and subscriptions.- Specified by:
getHost
in interfaceImapSession
- Returns:
- The ImapHost for this server.
-
unsolicitedResponses
Description copied from interface:ImapSession
Sends any unsolicited responses to the client, such as EXISTS and FLAGS responses when the selected mailbox is modified by another user.- Specified by:
unsolicitedResponses
in interfaceImapSession
- Parameters:
request
- The response to write to- Throws:
FolderException
-
unsolicitedResponses
public void unsolicitedResponses(ImapResponse response, boolean omitExpunged) throws FolderException - Specified by:
unsolicitedResponses
in interfaceImapSession
- Throws:
FolderException
-
closeConnection
- Specified by:
closeConnection
in interfaceImapSession
-
closeConnection
public void closeConnection()Description copied from interface:ImapSession
Closes the connection for this session.- Specified by:
closeConnection
in interfaceImapSession
-
getUserManager
Description copied from interface:ImapSession
Provides the UserManager for this session, to allow session to validate logins.- Specified by:
getUserManager
in interfaceImapSession
- Returns:
- The UserManager for this session.
-
getClientHostname
- Specified by:
getClientHostname
in interfaceImapSession
- Returns:
- The hostname of the connected client.
-
getClientIP
- Specified by:
getClientIP
in interfaceImapSession
- Returns:
- The IP address of the connected client.
-
setAuthenticated
Description copied from interface:ImapSession
Moves the session intoImapSessionState.AUTHENTICATED
state with the supplied user.- Specified by:
setAuthenticated
in interfaceImapSession
- Parameters:
user
- The user who is authenticated for this session.
-
getUser
Description copied from interface:ImapSession
Provides the authenticated user for this session, ornull
if this session is not inImapSessionState.AUTHENTICATED
orImapSessionState.SELECTED
state.- Specified by:
getUser
in interfaceImapSession
- Returns:
- The user authenticated for this session
-
deselect
public void deselect()Description copied from interface:ImapSession
Moves the session out ofImapSessionState.SELECTED
state and back intoImapSessionState.AUTHENTICATED
state. The selected mailbox is cleared.- Specified by:
deselect
in interfaceImapSession
-
setSelected
Description copied from interface:ImapSession
Moves this session intoImapSessionState.SELECTED
state and sets the supplied mailbox to be the currently selected mailbox.- Specified by:
setSelected
in interfaceImapSession
- Parameters:
folder
- The selected mailbox.readOnly
- Iftrue
, the selection is set to be read only.
-
getSelected
Description copied from interface:ImapSession
Provides the selected mailbox for this session, ornull
if this session is not inImapSessionState.SELECTED
state.- Specified by:
getSelected
in interfaceImapSession
- Returns:
- the currently selected mailbox.
-
selectedIsReadOnly
public boolean selectedIsReadOnly() -
getState
- Specified by:
getState
in interfaceImapSession
- Returns:
- Returns the current state of this session.
-
getSessionId
- Specified by:
getSessionId
in interfaceImapSession
-