net.kano.joscar.snaccmd.auth
Class AuthResponse

java.lang.Object
  extended bySnacCommand
      extended byAuthCommand
          extended byAuthResponse

public class AuthResponse
extends AuthCommand

A SNAC command sent in response to an AuthRequest. This is the last step of the authorization process.

See Also:
AuthRequest
Source of this SNAC:
AIM server
SNAC command type:
Family 0x17, command 0x03

Field Summary
static int ERROR_ACCOUNT_SUSPENDED
          An error code indicating that the user's account has been suspended.
static int ERROR_CLIENT_TOO_OLD
          An error code indicating that the client software is too old to connect to AIM anymore.
static int ERROR_CONNECTING_TOO_MUCH
          An error code indicating that the user has been connecting too frequently.
static int ERROR_INVALID_SN_OR_PASS
          An error code indicating that the screenname and/or password provided is not valid.
static int ERROR_TEMP_UNAVAILABLE
          An error code indicating that AIM is currently unavailable.
 
Fields inherited from class AuthCommand
CMD_AUTH_REQ, CMD_AUTH_RESP, CMD_KEY_REQ, CMD_KEY_RESP, FAMILY_AUTH, FAMILY_INFO
 
Fields inherited from class SnacCommand
SNACFLAG_DEFAULT
 
Constructor Summary
  AuthResponse(int errorCode, java.lang.String errorUrl)
          Creates an outgoing authorization response command with the given error code and URL and no other properties.
protected AuthResponse(SnacPacket packet)
          Generates an authorization response command from the given incoming SNAC packet.
  AuthResponse(java.lang.String sn, java.lang.String server, int port, ByteBlock cookie, int regStatus, java.lang.String email)
          Creates an outgoing authorization response command with the given properties and no error code or error URL.
  AuthResponse(java.lang.String sn, java.lang.String server, int port, ByteBlock cookie, int regStatus, java.lang.String email, int errorCode, java.lang.String errorUrl)
          Creates an outgoing authorization response command with the given properties.
 
Method Summary
 ByteBlock getCookie()
          Returns the login cookie that should be provided to the given BOS server upon connecting.
 java.lang.String getEmail()
          Returns the user's registered email address, or null if none was sent.
 int getErrorCode()
          Returns the error code sent in this command, or -1 if none was sent.
 java.lang.String getErrorUrl()
          Returns the "error URL" associated with the given error code, or null if none was sent.
 int getPort()
          Returns the port on which the user should connect to the given BOS server, or -1 if none was sent.
 int getRegstatus()
          Returns the user's "registration status visibility code," or -1 if none was sent.
 java.lang.String getScreenname()
          Returns the screenname contained in this authorization response, or null if none was sent.
 java.lang.String getServer()
          Returns the server to which the user should connect next for "basic online service," or null if none was sent.
 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

ERROR_INVALID_SN_OR_PASS

public static final int ERROR_INVALID_SN_OR_PASS
An error code indicating that the screenname and/or password provided is not valid.

See Also:
Constant Field Values

ERROR_ACCOUNT_SUSPENDED

public static final int ERROR_ACCOUNT_SUSPENDED
An error code indicating that the user's account has been suspended.

See Also:
Constant Field Values

ERROR_TEMP_UNAVAILABLE

public static final int ERROR_TEMP_UNAVAILABLE
An error code indicating that AIM is currently unavailable.

See Also:
Constant Field Values

ERROR_CONNECTING_TOO_MUCH

public static final int ERROR_CONNECTING_TOO_MUCH
An error code indicating that the user has been connecting too frequently. When this happens WinAIM suggests that the user wait ten minutes to reconnect, but you really don't have to wait all that long in my experience.

See Also:
Constant Field Values

ERROR_CLIENT_TOO_OLD

public static final int ERROR_CLIENT_TOO_OLD
An error code indicating that the client software is too old to connect to AIM anymore.

See Also:
Constant Field Values
Constructor Detail

AuthResponse

protected AuthResponse(SnacPacket packet)
Generates an authorization response command from the given incoming SNAC packet.

Parameters:
packet - the authorization response SNAC packet

AuthResponse

public AuthResponse(java.lang.String sn,
                    java.lang.String server,
                    int port,
                    ByteBlock cookie,
                    int regStatus,
                    java.lang.String email)
Creates an outgoing authorization response command with the given properties and no error code or error URL.

Parameters:
sn - the user's screen name
server - the BOS server to which the user should connect
port - the port on which the user should connect
cookie - a login cookie that the user should provide to the BOS server upon connecting
regStatus - the user's registration status code
email - the user's registered email address

AuthResponse

public AuthResponse(int errorCode,
                    java.lang.String errorUrl)
Creates an outgoing authorization response command with the given error code and URL and no other properties.

Parameters:
errorCode - an error code, like ERROR_ACCOUNT_SUSPENDED
errorUrl - a URL explaining the given error code, or null for none

AuthResponse

public AuthResponse(java.lang.String sn,
                    java.lang.String server,
                    int port,
                    ByteBlock cookie,
                    int regStatus,
                    java.lang.String email,
                    int errorCode,
                    java.lang.String errorUrl)
Creates an outgoing authorization response command with the given properties.

Parameters:
sn - the user's screen name, or null for none
server - the BOS server to which the user should connect, or null for none
port - the port on which the user should connect, or -1 for none
cookie - a login cookie that the user should provide to the BOS server upon connecting, or null for none
regStatus - the user's registration status code, or -1 for none
email - the user's registered email address, or null for none
errorCode - an error code, or -1 for none
errorUrl - a URL explaining the given error code, or null for none
Method Detail

getScreenname

public final java.lang.String getScreenname()
Returns the screenname contained in this authorization response, or null if none was sent.

Returns:
the user's screenname

getServer

public final java.lang.String getServer()
Returns the server to which the user should connect next for "basic online service," or null if none was sent.

Returns:
the BOS server to connect to

getPort

public final int getPort()
Returns the port on which the user should connect to the given BOS server, or -1 if none was sent.

Returns:
the port of the BOS server to connect to

getCookie

public final ByteBlock getCookie()
Returns the login cookie that should be provided to the given BOS server upon connecting.

Returns:
the login cookie to send to the given BOS server

getRegstatus

public final int getRegstatus()
Returns the user's "registration status visibility code," or -1 if none was sent. This will normally be one of the REGSTATUS_* constants defined in AcctModCmd.

Returns:
the user's registration status visibility code

getEmail

public final java.lang.String getEmail()
Returns the user's registered email address, or null if none was sent.

Returns:
the user's registered email address

getErrorCode

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

Returns:
this command's error code

getErrorUrl

public final java.lang.String getErrorUrl()
Returns the "error URL" associated with the given error code, or null if none was sent. Often this URL will be http://www.aol.com, but other times it's a URL that explains an error code in detail.

Returns:
this command's "error URL"

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()