net.kano.joscar.snaccmd.acct
Class AcctResponse

java.lang.Object
  extended bySnacCommand
      extended byAcctCommand
          extended byAcctResponse
Direct Known Subclasses:
AcctInfoCmd, AcctModAck

public abstract class AcctResponse
extends AcctCommand

A base class for the several types of account information responses.


Field Summary
static int ERRORCODE_CANNOT_DISPLAY_INFO
          An error code indicating that, for some reason, account information cannot be displayed.
static int ERRORCODE_NO_EMAIL
          An error code indicating that this account has no associated email address.
static int RESULT_ERROR
          A result code indicating that an account information change failed.
static int RESULT_SUCCESS
          A result code indicating that an account information change was successfully made.
static int TYPE_DEFAULT
          The only response type seen as of this writing.
 
Fields inherited from class AcctCommand
CMD_ACCT_MOD, CMD_CONFIRM, CMD_CONFIRM_ACK, CMD_INFO_REQ, CMD_INFO_RESP, CMD_MOD_ACK, FAMILY_ACCT, FAMILY_INFO
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
protected AcctResponse(int command, int result)
          Creates an outgoing account response command of the given SNAC subtype and with the given result code.
protected AcctResponse(int command, int type, int result, java.lang.String sn, java.lang.String email, int errorCode, java.lang.String errorUrl)
          Creates an outgoing account response command with the given properties.
protected AcctResponse(int command, int errorCode, java.lang.String errorURL)
          Creates an outgoing account response command of the given SNAC subtype and with the given error code and URL.
protected AcctResponse(int command, SnacPacket packet)
          Generates an account response command of the given command subtype and read from the given incoming SNAC packet.
 
Method Summary
 java.lang.String getEmail()
          Returns the email address under which this screenname is registered, as sent in this command, or null if none was sent.
 int getErrorCode()
          Returns the error code sent in this response, or -1 if none was sent.
 java.lang.String getErrorUrl()
          Returns the URL explaining the error code sent in this response.
 int getResult()
          Returns the result code of this response.
 java.lang.String getScreenname()
          Returns the screen name sent in this command, or null if none was sent.
 int getType()
          Returns the response type of this response.
 java.lang.String toString()
           
 void writeData(java.io.OutputStream out)
          Writes this command's SNAC data block to the given stream.
 
Methods inherited from class SnacCommand
getCommand, getFamily, getFlag1, getFlag2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ERRORCODE_CANNOT_DISPLAY_INFO

public static final int ERRORCODE_CANNOT_DISPLAY_INFO
An error code indicating that, for some reason, account information cannot be displayed.

See Also:
Constant Field Values

ERRORCODE_NO_EMAIL

public static final int ERRORCODE_NO_EMAIL
An error code indicating that this account has no associated email address.

See Also:
Constant Field Values

TYPE_DEFAULT

public static final int TYPE_DEFAULT
The only response type seen as of this writing.

See Also:
Constant Field Values

RESULT_SUCCESS

public static final int RESULT_SUCCESS
A result code indicating that an account information change was successfully made.

See Also:
Constant Field Values

RESULT_ERROR

public static final int RESULT_ERROR
A result code indicating that an account information change failed. Normally accompanied by an error code.

See Also:
Constant Field Values
Constructor Detail

AcctResponse

protected AcctResponse(int command,
                       SnacPacket packet)
Generates an account response command of the given command subtype and read from the given incoming SNAC packet.

Parameters:
command - the SNAC command subtype of this command
packet - an account response packet

AcctResponse

protected AcctResponse(int command,
                       int result)
Creates an outgoing account response command of the given SNAC subtype and with the given result code. The response's response type will be TYPE_DEFAULT.

Parameters:
command - the SNAC command subtype of this command
result - the result code, like RESULT_SUCCESS

AcctResponse

protected AcctResponse(int command,
                       int errorCode,
                       java.lang.String errorURL)
Creates an outgoing account response command of the given SNAC subtype and with the given error code and URL. The response type will be TYPE_DEFAULT and the result code will be RESULT_ERROR.

Parameters:
command - the SNAC command subtype of this command
errorCode - this command's error code, like ERRORCODE_NO_EMAIL
errorURL - a URL describing this error, or null for none

AcctResponse

protected AcctResponse(int command,
                       int type,
                       int result,
                       java.lang.String sn,
                       java.lang.String email,
                       int errorCode,
                       java.lang.String errorUrl)
Creates an outgoing account response command with the given properties.

Parameters:
command - the SNAC command subtype of this command
type - the response type, normally TYPE_DEFAULT
result - a result code, like RESULT_ERROR
sn - a screen name, or null for none
email - an email address, or null for none
errorCode - an error code, like ERRORCODE_NO_EMAIL, or -1 for none
errorUrl - an error URL, or null for none
Method Detail

getType

public final int getType()
Returns the response type of this response. Normally TYPE_DEFAULT.

Returns:
this response's response type

getResult

public final int getResult()
Returns the result code of this response. Normally one of RESULT_SUCCESS or RESULT_ERROR.

Returns:
this response's result code

getScreenname

public final java.lang.String getScreenname()
Returns the screen name sent in this command, or null if none was sent.

Returns:
this command's screen name field, or null if none was sent

getEmail

public final java.lang.String getEmail()
Returns the email address under which this screenname is registered, as sent in this command, or null if none was sent.

Returns:
this command's registered email address field, or null if none was sent

getErrorCode

public final int getErrorCode()
Returns the error code sent in this response, or -1 if none was sent.

Returns:
this response's error code, or -1 if none was sent

getErrorUrl

public final java.lang.String getErrorUrl()
Returns the URL explaining the error code sent in this response.

Returns:
the error URL sent in this command, or null if none was sent

writeData

public void writeData(java.io.OutputStream out)
               throws java.io.IOException
Description copied from class: SnacCommand
Writes this command's SNAC data block to the given stream. The SNAC data block is the data after the first ten bytes of a SNAC packet.

Specified by:
writeData in class SnacCommand
Parameters:
out - the stream to which to write the SNAC data
Throws:
java.io.IOException - if an I/O error occurs

toString

public java.lang.String toString()