public class AIM
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.lang.String |
authHost
The OSCAR authentication server.
|
int |
authPort
The OSCAR authentication server's port.
|
protected java.net.Socket |
connection
The connection to the TOC server.
|
static int |
DATA
The ID number for a DATA packet (flap).
|
protected java.lang.String |
id
Screen name of current user.
|
protected java.io.InputStream |
is
An InputStream to the connection.
|
java.lang.String |
language
What language to use.
|
protected java.io.OutputStream |
os
An OutputStream to the connection.
|
java.lang.String |
roastString
The string used to "roast" passwords.
|
protected short |
sequence
The sequence number used for FLAP packets.
|
static int |
SIGNON
The ID number for a SIGNON packet(FLAP).
|
java.lang.String |
tocHost
The host address of the TOC server.
|
int |
tocPort
The port used to connect to the TOC server.
|
java.lang.String |
version
The version of the client.
|
Constructor and Description |
---|
AIM(java.lang.String id,
java.lang.String password)
Constructor for AIM.
|
Modifier and Type | Method and Description |
---|---|
protected int |
calculateCode(java.lang.String uid,
java.lang.String pwd)
Calculate a login security code from the user id and password.
|
protected java.lang.String |
encode(java.lang.String str)
Called to encode a message.
|
java.lang.String |
getError()
Getter for error
|
protected java.lang.String |
getFlap()
Get a FLAP packet
|
boolean |
isLoggedin()
Getter for loggedin
|
boolean |
login(java.lang.String id,
java.lang.String password)
Log in to TOC
|
void |
logout()
Logout of toc and close the socket
|
protected java.lang.String |
normalize(java.lang.String name)
Called to normalize a screen name.
|
protected java.lang.String |
roastPassword(java.lang.String str)
Called to roast the password.
|
void |
send(java.lang.String to,
java.lang.String msg)
Send a IM
|
protected void |
sendFlap(int type,
java.lang.String str)
Send a FLAP packet
|
protected void |
sendFlapSignon()
Send a FLAP signon packet
|
protected void |
sendRaw(java.lang.String str)
Send a string over the socket as raw bytes
|
protected void |
writeWord(short word)
Write a little endian word
|
public java.lang.String tocHost
public int tocPort
public java.lang.String authHost
public int authPort
public java.lang.String language
public java.lang.String version
public java.lang.String roastString
protected short sequence
protected java.net.Socket connection
protected java.io.InputStream is
protected java.io.OutputStream os
protected java.lang.String id
public static final int SIGNON
public static final int DATA
public AIM(java.lang.String id, java.lang.String password)
id
- password
- public boolean login(java.lang.String id, java.lang.String password)
id
- The screen name to login withpassword
- The screen name's passwordpublic void logout()
protected java.lang.String roastPassword(java.lang.String str)
str
- The password to roastprotected int calculateCode(java.lang.String uid, java.lang.String pwd)
uid
- The user id to encodepwd
- The password to encoudeprotected void sendRaw(java.lang.String str) throws java.io.IOException
str
- The string to sendjava.io.IOException
protected void writeWord(short word) throws java.io.IOException
word
- A word to writejava.io.IOException
protected void sendFlapSignon() throws java.io.IOException
java.io.IOException
protected void sendFlap(int type, java.lang.String str) throws java.io.IOException
type
- The type DATA or SIGNONstr
- The string message to sendjava.io.IOException
protected java.lang.String getFlap() throws java.io.IOException
java.io.IOException
public void send(java.lang.String to, java.lang.String msg)
to
- Screen name to send an IM tomsg
- The instant messageprotected java.lang.String normalize(java.lang.String name)
name
- The screen nameprotected java.lang.String encode(java.lang.String str)