Package com.icegreen.greenmail.imap
Class ImapSessionImpl
- java.lang.Object
-
- com.icegreen.greenmail.imap.ImapSessionImpl
-
- All Implemented Interfaces:
ImapSession
public final class ImapSessionImpl extends java.lang.Object implements ImapSession
- Version:
- $Revision: 109034 $
- Author:
- Darrell DeBoer
-
-
Constructor Summary
Constructors Constructor Description ImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, java.lang.String clientHostName, java.lang.String clientAddress)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeConnection()
Closes the connection for this session.void
closeConnection(java.lang.String byeMessage)
void
deselect()
Moves the session out ofImapSessionState.SELECTED
state and back intoImapSessionState.AUTHENTICATED
state.java.lang.String
getClientHostname()
java.lang.String
getClientIP()
ImapHostManager
getHost()
Provides the Imap host for this server, which is used for all access to mail storage and subscriptions.ImapSessionFolder
getSelected()
Provides the selected mailbox for this session, ornull
if this session is not inImapSessionState.SELECTED
state.java.lang.String
getSessionId()
ImapSessionState
getState()
GreenMailUser
getUser()
Provides the authenticated user for this session, ornull
if this session is not inImapSessionState.AUTHENTICATED
orImapSessionState.SELECTED
state.UserManager
getUserManager()
Provides the UserManager for this session, to allow session to validate logins.boolean
selectedIsReadOnly()
void
setAuthenticated(GreenMailUser user)
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 Detail
-
ImapSessionImpl
public ImapSessionImpl(ImapHostManager imapHost, UserManager users, ImapHandler handler, java.lang.String clientHostName, java.lang.String clientAddress)
-
-
Method Detail
-
getHost
public ImapHostManager 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
public void unsolicitedResponses(ImapResponse request) throws FolderException
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
public void closeConnection(java.lang.String byeMessage)
- 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
public UserManager 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
public java.lang.String getClientHostname()
- Specified by:
getClientHostname
in interfaceImapSession
- Returns:
- The hostname of the connected client.
-
getClientIP
public java.lang.String getClientIP()
- Specified by:
getClientIP
in interfaceImapSession
- Returns:
- The IP address of the connected client.
-
setAuthenticated
public void setAuthenticated(GreenMailUser user)
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
public GreenMailUser 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
public void setSelected(MailFolder folder, boolean readOnly)
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
public ImapSessionFolder 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
public ImapSessionState getState()
- Specified by:
getState
in interfaceImapSession
- Returns:
- Returns the current state of this session.
-
getSessionId
public java.lang.String getSessionId()
- Specified by:
getSessionId
in interfaceImapSession
-
-