com.icegreen.greenmail.imap
Class ImapResponse

java.lang.Object
  extended by com.icegreen.greenmail.imap.ImapResponse
All Implemented Interfaces:
ImapConstants

public class ImapResponse
extends Object
implements ImapConstants

Class providing methods to send response messages from the server to the client.


Field Summary
 
Fields inherited from interface com.icegreen.greenmail.imap.ImapConstants
BAD, BYE, CAPABILITIES, HIERARCHY_DELIMITER, HIERARCHY_DELIMITER_CHAR, INBOX_NAME, NAMESPACE_PREFIX, NAMESPACE_PREFIX_CHAR, NO, OK, SP, UNTAGGED, USER_NAMESPACE, VERSION
 
Constructor Summary
ImapResponse(OutputStream output)
           
 
Method Summary
 void badResponse(String message)
          Writes a standard untagged BAD response, together with a descriptive message.
 void byeResponse(String message)
           
 void commandComplete(ImapCommand command)
          Writes a standard tagged OK response on completion of a command.
 void commandComplete(ImapCommand command, String responseCode)
          Writes a standard tagged OK response on completion of a command, with a response code (eg READ-WRITE) Response is writen as:
 void commandError(String message)
          Writes a standard BAD response on command error, together with a descriptive message.
 void commandFailed(ImapCommand command, String reason)
          Writes a standard NO response on command failure, together with a descriptive message.
 void commandFailed(ImapCommand command, String responseCode, String reason)
          Writes a standard NO response on command failure, together with a descriptive message.
 void commandResponse(ImapCommand command, String message)
           
 void existsResponse(int count)
           
 void expungeResponse(int msn)
           
 void fetchResponse(int msn, String msgData)
           
 void flagsResponse(Flags flags)
           
 void okResponse(String responseCode, String message)
          Writes an untagged OK response, with the supplied response code, and an optional message.
 void permanentFlagsResponse(Flags flags)
           
 void recentResponse(int count)
           
 void setTag(String tag)
           
 void taggedResponse(String message)
          Writes the message provided to the client, prepended with the request tag.
 void untaggedResponse(String message)
          Writes the message provided to the client, prepended with the untagged marker "*".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImapResponse

public ImapResponse(OutputStream output)
Method Detail

setTag

public void setTag(String tag)

commandComplete

public void commandComplete(ImapCommand command)
Writes a standard tagged OK response on completion of a command. Response is writen as:
     a01 OK COMMAND_NAME completed.

Parameters:
command - The ImapCommand which was completed.

commandComplete

public void commandComplete(ImapCommand command,
                            String responseCode)
Writes a standard tagged OK response on completion of a command, with a response code (eg READ-WRITE) Response is writen as:
     a01 OK [responseCode] COMMAND_NAME completed.

Parameters:
command - The ImapCommand which was completed.
responseCode - A string response code to send to the client.

commandFailed

public void commandFailed(ImapCommand command,
                          String reason)
Writes a standard NO response on command failure, together with a descriptive message. Response is writen as:
     a01 NO COMMAND_NAME failed. 

Parameters:
command - The ImapCommand which failed.
reason - A message describing why the command failed.

commandFailed

public void commandFailed(ImapCommand command,
                          String responseCode,
                          String reason)
Writes a standard NO response on command failure, together with a descriptive message. Response is writen as:
     a01 NO [responseCode] COMMAND_NAME failed. 

Parameters:
command - The ImapCommand which failed.
responseCode - The Imap response code to send.
reason - A message describing why the command failed.

commandError

public void commandError(String message)
Writes a standard BAD response on command error, together with a descriptive message. Response is writen as:
     a01 BAD 

Parameters:
message - The descriptive error message.

badResponse

public void badResponse(String message)
Writes a standard untagged BAD response, together with a descriptive message.


okResponse

public void okResponse(String responseCode,
                       String message)
Writes an untagged OK response, with the supplied response code, and an optional message.

Parameters:
responseCode - The response code, included in [].
message - The message to follow the []

flagsResponse

public void flagsResponse(Flags flags)

existsResponse

public void existsResponse(int count)

recentResponse

public void recentResponse(int count)

expungeResponse

public void expungeResponse(int msn)

fetchResponse

public void fetchResponse(int msn,
                          String msgData)

commandResponse

public void commandResponse(ImapCommand command,
                            String message)

taggedResponse

public void taggedResponse(String message)
Writes the message provided to the client, prepended with the request tag.

Parameters:
message - The message to write to the client.

untaggedResponse

public void untaggedResponse(String message)
Writes the message provided to the client, prepended with the untagged marker "*".

Parameters:
message - The message to write to the client.

byeResponse

public void byeResponse(String message)

permanentFlagsResponse

public void permanentFlagsResponse(Flags flags)