org.walluck.oscar.handlers
Class LoginHandler

java.lang.Object
  extended byorg.walluck.oscar.handlers.SNACHandler
      extended byorg.walluck.oscar.handlers.LoginHandler

public class LoginHandler
extends SNACHandler

Family 0x0017 - Authentication.

Deals with the authorizer for SNAC-based login, and also old-style non-SNAC login.

Since:
1.0
Version:
1.0
Author:
David Walluck
See Also:
SNACHandler

Field Summary
static int REG_X1
          ICQ registration X1.
static int REG_X2
          ICQ registration X2.
static int REG_X3
          ICQ registration X3.
 
Constructor Summary
LoginHandler()
          Family 0x0017
 
Method Summary
 void handleSNAC(AIMSession sess, SNACHandler handler, AIMFrame frame, SNAC snac, AIMInputStream buffer)
          Handles incoming SNAC's.
 void registerUIN(AIMSession sess, AIMConnection conn, java.lang.String password)
          Registers a new UIN with the ICQ network.
 void requestLogin(AIMSession sess, AIMConnection conn, java.lang.String sn)
          In the AIM 3.5 protocol, the first stage of login is to request login from the Authorizer, passing it the screen name for verification.
 void sendCookie(AIMSession sess, AIMConnection conn, byte[] cookie)
          This just pushes the passed cookie onto the passed connection, without the SNAC header or any of that.
 void sendFLAPVer(AIMSession sess, AIMConnection conn)
          Normally the FLAP version is sent as the first few bytes of the cookie, meaning that you generally never call this.
 void sendLogin(AIMSession sess, AIMConnection conn, java.lang.String sn, java.lang.String password, ClientInfo ci, java.lang.String key, java.lang.String clientString)
          The initial login packet.
 void sendSecurID(AIMSession sess, AIMConnection conn, java.lang.String securID)
          The client SecurID reply for server SNAC 0x0017/0x000a.
 
Methods inherited from class org.walluck.oscar.handlers.SNACHandler
getFamily, getVersion, setFamily, setVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REG_X1

public static final int REG_X1
ICQ registration X1.

See Also:
Constant Field Values

REG_X2

public static final int REG_X2
ICQ registration X2.

See Also:
Constant Field Values

REG_X3

public static final int REG_X3
ICQ registration X3.

See Also:
Constant Field Values
Constructor Detail

LoginHandler

public LoginHandler()
Family 0x0017

Method Detail

sendCookie

public void sendCookie(AIMSession sess,
                       AIMConnection conn,
                       byte[] cookie)
                throws java.io.IOException

This just pushes the passed cookie onto the passed connection, without the SNAC header or any of that.

Very commonly used, as every connection except auth will require this to be the first thing you send.

Parameters:
sess - the oscar session
conn - the authorizer connection for this session
cookie - the login cookie
Throws:
java.io.IOException - if an error occurs

sendFLAPVer

public void sendFLAPVer(AIMSession sess,
                        AIMConnection conn)
                 throws java.io.IOException

Normally the FLAP version is sent as the first few bytes of the cookie, meaning that you generally never call this.

But there are times when something might want it seperate. Specifically, this is sent this internally when doing SNAC login.

Parameters:
sess - the oscar session
conn - the authorizer connection for this session
Throws:
java.io.IOException - if an error occurs

requestLogin

public void requestLogin(AIMSession sess,
                         AIMConnection conn,
                         java.lang.String sn)
                  throws java.io.IOException
In the AIM 3.5 protocol, the first stage of login is to request login from the Authorizer, passing it the screen name for verification. If the name is invalid, a 0x0017/0x0003 is spit back, with the standard error contents. If valid, a 0x0017/0x0007 comes back, which is the signal to send it the main login command (0x0017/0x0002).

Parameters:
sess - the oscar session
conn - the authorizer connection for this session
sn - the screenname
Throws:
java.io.IOException - if an error occurs

sendLogin

public void sendLogin(AIMSession sess,
                      AIMConnection conn,
                      java.lang.String sn,
                      java.lang.String password,
                      ClientInfo ci,
                      java.lang.String key,
                      java.lang.String clientString)
               throws java.io.IOException
The initial login packet.

NOTE!! If you want/need to make use of the sendmemblock() function, then the client information you send here must exactly match the executable that you're pulling the data from.

 Java AIM 1.1.19:
   clientstring = "AOL Instant Messenger (TM) version 1.1.19 for
 Java built 03/24/98, freeMem 215871 totalMem 1048567, i686, Linus, #2 SMP
 Sun Feb 11 03:41:17 UTC 2001 2.4.1-ac9, IBM Corporation, 1.1.8, 45.3, Tue
 Mar 27 12:09:17 PST 2001"
   clientid = 0x0001
   major  = 0x0001
   minor  = 0x0001
   point = (not sent)
   build  = 0x0013
   unknown= (not sent)

 AIM for Linux 1.1.112:
   clientstring = "AOL Instant Messenger (SM)"
   clientid = 0x1d09
   major  = 0x0001
   minor  = 0x0001
   point = 0x0001
   build  = 0x0070
   unknown= 0x0000008b
   serverstore = 0x01

Parameters:
sess - the oscar session
conn - the authorizer connection for this session
sn - the screenname
password - the password
ci - a ClientInfo class
key - the key sent by the server
clientString - the client string
Throws:
java.io.IOException - if an error occurs

registerUIN

public void registerUIN(AIMSession sess,
                        AIMConnection conn,
                        java.lang.String password)
                 throws java.io.IOException
Registers a new UIN with the ICQ network. Not in gaim.

I don't even know what half of this stuff is.

Parameters:
sess - the oscar session
conn - the authorizer connection for this session
password - the plaintext password you wish to use
Throws:
java.io.IOException - if an error occurs

sendSecurID

public void sendSecurID(AIMSession sess,
                        AIMConnection conn,
                        java.lang.String securID)
                 throws java.io.IOException
The client SecurID reply for server SNAC 0x0017/0x000a.

AIM administrators have a digital display that displays a new 6-digit SecurID number once every 60 seconds. The client must then send the new SecurID number to the server with this command, or the client will be disconnected with an authorization error.

Parameters:
sess - the oscar session
conn - the authorizer connection for this session
securID - the 6-digit SecurID to send
Throws:
java.io.IOException - if an error occurs

handleSNAC

public void handleSNAC(AIMSession sess,
                       SNACHandler handler,
                       AIMFrame frame,
                       SNAC snac,
                       AIMInputStream buffer)
                throws java.io.IOException
Handles incoming SNAC's.

Specified by:
handleSNAC in class SNACHandler
Parameters:
sess - the oscar session
handler - the handler
frame - the incoming frame
snac - the incoming SNAC
buffer - the incoming buffer
Throws:
java.io.IOException - if an error occurs