org.walluck.oscar.handlers.icq.tcp
Class DirectClient

java.lang.Object
  extended by java.lang.Thread
      extended by org.walluck.oscar.handlers.icq.tcp.DirectClient
All Implemented Interfaces:
Runnable

public class DirectClient
extends Thread

ICQ TCP v6 - v8 support.

Since:
1.0
Version:
1.0
Author:
David Walluck

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static int CONNECTED
          Connected.
static int WAITING_FOR_INIT
          Waiting for init.
static int WAITING_FOR_INIT_ACK
          Waiting for init ack.
static int WAITING_FOR_INIT2
          Waiting for init 2.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DirectClient(AIMSession sess, int uin, String host, int port, boolean incoming)
          Creates a new DirectClient instance.
 
Method Summary
 void confirmUIN()
          Describe confirmUIN method here.
 boolean decrypt(AIMInputStream in, AIMOutputStream out)
          FIXME: this is completely broken.
 void encrypt(AIMInputStream in, AIMOutputStream out)
          Describe encrypt method here.
 int getLocalPort()
          Describe getLocalPort method here.
 int nextMsgId()
          Get the next Msg ID.
 void parseInit2(AIMInputStream buffer)
          Describe parseInit2 method here.
 void parseInitAck(AIMInputStream buffer)
          Describe parseInitAck method here.
 void parseInitPacket(AIMInputStream buffer)
          Describe parseInitPacket method here.
 void parsePacket(AIMInputStream buffer)
          Describe parsePacket method here.
 void parsePacketInt(AIMInputStream buffer)
          Describe parsePacketInt method here.
 void run()
          Describe run method here.
 void sendAck(int seq, int subcmd, boolean accept)
          Describe sendAck method here.
 void sendDirect(AIMOutputStream b, boolean encrypt)
          Describe sendDirect method here.
 void sendInit2()
          Describe sendInit2 method here.
 void sendInitAck()
          Describe sendInitAck method here.
 void sendInitPacket()
          Describe sendInitPacket method here.
 void sendMessage(int uin, String msg, short subcmd, int lstatus, ICQColor foregroundColor, ICQColor backgroundColor)
          Describe sendMessage method here.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WAITING_FOR_INIT_ACK

public static final int WAITING_FOR_INIT_ACK
Waiting for init ack.

See Also:
Constant Field Values

WAITING_FOR_INIT

public static final int WAITING_FOR_INIT
Waiting for init.

See Also:
Constant Field Values

WAITING_FOR_INIT2

public static final int WAITING_FOR_INIT2
Waiting for init 2.

See Also:
Constant Field Values

CONNECTED

public static final int CONNECTED
Connected.

See Also:
Constant Field Values
Constructor Detail

DirectClient

public DirectClient(AIMSession sess,
                    int uin,
                    String host,
                    int port,
                    boolean incoming)
Creates a new DirectClient instance.

Parameters:
sess - an AIMSession value
uin - an int value
host - a String value
port - an int value
incoming - a boolean value
Method Detail

getLocalPort

public int getLocalPort()
Describe getLocalPort method here.

Returns:
an int value

confirmUIN

public void confirmUIN()
                throws IOException
Describe confirmUIN method here.

Throws:
IOException - if an error occurs

sendInitPacket

public void sendInitPacket()
                    throws IOException
Describe sendInitPacket method here.

Throws:
IOException - if an error occurs

sendInitAck

public void sendInitAck()
                 throws IOException
Describe sendInitAck method here.

Throws:
IOException - if an error occurs

sendInit2

public void sendInit2()
               throws IOException
Describe sendInit2 method here.

Throws:
IOException - if an error occurs

sendAck

public void sendAck(int seq,
                    int subcmd,
                    boolean accept)
             throws IOException
Describe sendAck method here.

Parameters:
seq - an int value
subcmd - an int value
accept - a boolean value
Throws:
IOException - if an error occurs

sendMessage

public void sendMessage(int uin,
                        String msg,
                        short subcmd,
                        int lstatus,
                        ICQColor foregroundColor,
                        ICQColor backgroundColor)
                 throws IOException
Describe sendMessage method here.

Parameters:
uin - an int value
msg - a String value
subcmd - a short value
lstatus - an int value
foregroundColor - an ICQColor value
backgroundColor - an ICQColor value
Throws:
IOException - if an error occurs

parseInitPacket

public void parseInitPacket(AIMInputStream buffer)
                     throws IOException
Describe parseInitPacket method here.

Parameters:
buffer - an AIMInputStream value
Throws:
IOException - if an error occurs

parseInitAck

public void parseInitAck(AIMInputStream buffer)
                  throws IOException
Describe parseInitAck method here.

Parameters:
buffer - an AIMInputStream value
Throws:
IOException - if an error occurs

parseInit2

public void parseInit2(AIMInputStream buffer)
                throws IOException
Describe parseInit2 method here.

Parameters:
buffer - an AIMInputStream value
Throws:
IOException - if an error occurs

parsePacket

public void parsePacket(AIMInputStream buffer)
                 throws IOException
Describe parsePacket method here.

Parameters:
buffer - an AIMInputStream value
Throws:
IOException - if an error occurs

parsePacketInt

public void parsePacketInt(AIMInputStream buffer)
                    throws IOException
Describe parsePacketInt method here.

Parameters:
buffer - an AIMInputStream value
Throws:
IOException - if an error occurs

decrypt

public boolean decrypt(AIMInputStream in,
                       AIMOutputStream out)
                throws IOException
FIXME: this is completely broken. Why?

Parameters:
in - an AIMInputStream value
out - an AIMOutputStream value
Returns:
a boolean value
Throws:
IOException - if an error occurs

encrypt

public void encrypt(AIMInputStream in,
                    AIMOutputStream out)
             throws IOException
Describe encrypt method here.

Parameters:
in - an AIMInputStream value
out - an AIMOutputStream value
Throws:
IOException - if an error occurs

sendDirect

public void sendDirect(AIMOutputStream b,
                       boolean encrypt)
                throws IOException
Describe sendDirect method here.

Parameters:
b - an AIMOutputStream value
encrypt - a boolean value
Throws:
IOException - if an error occurs

nextMsgId

public int nextMsgId()
Get the next Msg ID. Start at 0xffff and decrement by 1 until we reach 0x0000.

Returns:
the next message ID

run

public void run()
Describe run method here.

Specified by:
run in interface Runnable
Overrides:
run in class Thread