Package com.icegreen.greenmail.imap
Interface ImapSession
-
- All Known Implementing Classes:
ImapSessionImpl
public interface ImapSessionEncapsulates all state held for an ongoing Imap session, which commences when a client first establishes a connection to the Imap server, and continues until that connection is closed.- Version:
- $Revision: 109034 $
- Author:
- Darrell DeBoer
-
-
Method Summary
All Methods Instance Methods Abstract 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 response)Sends any unsolicited responses to the client, such as EXISTS and FLAGS responses when the selected mailbox is modified by another user.voidunsolicitedResponses(ImapResponse request, boolean omitExpunged)
-
-
-
Method Detail
-
unsolicitedResponses
void unsolicitedResponses(ImapResponse response) throws FolderException
Sends any unsolicited responses to the client, such as EXISTS and FLAGS responses when the selected mailbox is modified by another user.- Parameters:
response- The response to write to- Throws:
FolderException
-
closeConnection
void closeConnection()
Closes the connection for this session.
-
closeConnection
void closeConnection(String byeMessage)
Closes the connection for this session with a final good-bye message.- Parameters:
byeMessage- the good-bye message.
-
getHost
ImapHostManager getHost()
Provides the Imap host for this server, which is used for all access to mail storage and subscriptions.- Returns:
- The ImapHost for this server.
-
getUserManager
UserManager getUserManager()
Provides the UserManager for this session, to allow session to validate logins.- Returns:
- The UserManager for this session.
-
getClientIP
String getClientIP()
- Returns:
- The IP address of the connected client.
-
getState
ImapSessionState getState()
- Returns:
- Returns the current state of this session.
-
setAuthenticated
void setAuthenticated(GreenMailUser user)
Moves the session intoImapSessionState.AUTHENTICATEDstate with the supplied user.- Parameters:
user- The user who is authenticated for this session.
-
getUser
GreenMailUser getUser()
Provides the authenticated user for this session, ornullif this session is not inImapSessionState.AUTHENTICATEDorImapSessionState.SELECTEDstate.- Returns:
- The user authenticated for this session
-
setSelected
void setSelected(MailFolder folder, boolean readOnly)
Moves this session intoImapSessionState.SELECTEDstate and sets the supplied mailbox to be the currently selected mailbox.- Parameters:
folder- The selected mailbox.readOnly- Iftrue, the selection is set to be read only.
-
deselect
void deselect()
Moves the session out ofImapSessionState.SELECTEDstate and back intoImapSessionState.AUTHENTICATEDstate. The selected mailbox is cleared.
-
getSelected
ImapSessionFolder getSelected()
Provides the selected mailbox for this session, ornullif this session is not inImapSessionState.SELECTEDstate.- Returns:
- the currently selected mailbox.
-
unsolicitedResponses
void unsolicitedResponses(ImapResponse request, boolean omitExpunged) throws FolderException
- Throws:
FolderException
-
-