cca.net.jostl
Class TOCConnection

java.lang.Object
  extended by cca.net.jostl.TOCConnection
All Implemented Interfaces:
TOCConstants, java.lang.Runnable

public class TOCConnection
extends java.lang.Object
implements java.lang.Runnable, TOCConstants

Handles connection with OSCAR server using TOC2 protocol

November 19, 2006
- added checking for icq users

November 10, 2006
- added support for toc2_login
- added IM_IN_ENC2
- added CLIENT_EVENT2
- added BART2
- added CHAT_IN_ENC2


November 7, 2006
- fixed bug with firing buddy return status


Copyright (C) 2006 by Dustin Zimnox


This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Field Summary
protected  int authorizerPort
           
protected  java.lang.String authorizerServer
           
static java.lang.String AUTO_ADD_GROUP
           
protected static java.lang.String DEFAULT_GROUP
           
protected  int FLAP_VERSION
           
protected  int loginPort
           
protected  java.lang.String loginServer
           
protected  java.lang.String REVISION
           
 java.lang.String VERSION
           
 
Fields inherited from interface cca.net.jostl.TOCConstants
ALLOW_BUDDIES_ONLY, CAP_ADD_INS, CAP_AIMICQ, CAP_BUDDY_ICON, CAP_CHANNEL2, CAP_DIRECT_IM, CAP_DIRECT_PLAY, CAP_FILE_SHARE, CAP_FILE_TRANSFER, CAP_GAMES, CAP_ICQ_RELAY, CAP_INVALID_GAMES, CAP_SEND_LIST, CAP_TALK, CAP_UTF8, CLIENT_EVENT_ENTERED, CLIENT_EVENT_STOPPED, CLIENT_EVENT_TYPING, DENY_ALL, DENY_SOME, MESSAGE_LENGTH_LIMIT, PERMIT_ALL, PERMIT_SOME, SERVICE_AOL, SERVICE_CELL, SERVICE_ICQ, SERVICE_NORMAL, SERVICE_UNCONFIRMED, SERVICE_UNKNOWN
 
Constructor Summary
TOCConnection()
          Constructors
TOCConnection(java.lang.String clientName)
           
 
Method Summary
 void acceptChatInvite(int roomID)
          Accepts a chatroom invitation.
 void acceptRvous(java.lang.String buddy, java.lang.String cookie, java.lang.String service, java.lang.String tlv)
          Accepts a rendezvous proposal
 void acceptRvous(TOCBuddy buddy, java.lang.String cookie, java.lang.String service, java.lang.String tlv)
          Accepts a rendezvous proposal
 void addBuddy(java.lang.String name, java.lang.String group)
          Adds a new buddy to the user's buddy list If the group the buddy belongs to doesn't already exist, it will be created.
 void addBuddy(TOCBuddy buddy)
          Adds a new buddy to the user's buddy list If the group the buddy belongs to doesn't already exist, it will be created.
 void addTOCListener(TOCListener listener)
          Register a listener with this TOCConnection to receive events
 void addToDeny(java.lang.String buddy)
          Adds a buddy to the deny list
 void addToDeny(java.lang.String[] buddies)
          Adds multiple buddies to the deny list
 void addToDeny(TOCBuddy buddy)
          Adds a buddy to the deny list
 void addToDeny(TOCBuddy[] buddies)
          Adds multiple buddies to the deny list
 void addToPermit(java.lang.String buddy)
          Adds a buddy to the permit list
 void addToPermit(java.lang.String[] buddies)
          Adds multiple buddies to the permit list
 void addToPermit(TOCBuddy buddy)
          Adds a buddy to the permit list
 void addToPermit(TOCBuddy[] buddies)
          Adds multiple buddies to the permit list
 void cancelRvous(java.lang.String buddy, java.lang.String cookie, java.lang.String service, java.lang.String tlv)
           
 void cancelRvous(TOCBuddy buddy, java.lang.String cookie, java.lang.String service, java.lang.String tlv)
           
 void changePassword(java.lang.String oldPass, java.lang.String newPass)
          Changes the password for the account Passwords cannot contain spaces
 void createChatRoom(java.lang.String name)
          Creates a new chat room.
 void createGroup(java.lang.String group)
          Creates a new group on the user's buddy list
 void deleteGroup(java.lang.String group)
          Deletes a group on the user's buddy list
 java.lang.String getAuthorizationServerAddress()
          Gets the authorization server address
 int getAuthorizationServerPort()
          Gets the authorization server port
 TOCBuddy getBuddy(java.lang.String name)
          Gets an TOCBuddy object from a buddy name
 void getBuddyInfo(java.lang.String buddy)
          Retrieves a buddy's information in the form of a GOTO_URL sent back from the server
 void getBuddyInfo(TOCBuddy buddy)
          Retrieves a buddy's information in the form of a GOTO_URL sent back from the server
 java.util.Iterator getBuddyList()
          Returns an Iterator containing all TOCBuddy's created from the CONFIG2 sent by TOC
 void getDirInfo(java.lang.String buddy)
          Retrieves a buddy's directory info
 void getDirInfo(TOCBuddy buddy)
          Retrieves a buddy's directory info
 java.lang.String getLoginServerAddress()
          Gets the login server address
 int getLoginServerPort()
          Gets the login server port
 int getPermitMode()
          Returns the permit mode
 java.lang.String getUsername()
          Gets the name of the user currently signed in
 boolean hasConfig()
          Returns true if the config was received from TOC
 boolean isBuddyOnDeny(TOCBuddy buddy)
          Determines if the buddy is on the user's deny list
 boolean isBuddyOnPermit(TOCBuddy buddy)
          Determines if buddy is on the user's permit list
 boolean isConnected()
          Returns true if this connection is active
 void leaveChat(int roomID)
          Leaves the specified chatroom
protected static java.lang.String normalizeString(java.lang.String s)
          Normalizes a string
protected  void parseTocData(byte[] buffer)
          Data received from TOC
protected  void processConfig(java.lang.String config)
          Parses the config string.
 void proposeRvous(java.lang.String buddy, java.lang.String uuid, java.lang.String cookie, java.lang.String seq, java.lang.String rip, java.lang.String pip, java.lang.String vip, java.lang.String port, java.lang.String tlv)
          Propose a rendezvous - not yet implemented
 void removeBuddy(TOCBuddy buddy)
          Removes a buddy from the user's buddy list Currently not working??????
 void removeFromDeny(java.lang.String buddy)
          Removes a buddy from the deny list
 void removeFromDeny(java.lang.String[] buddies)
          Removes multiple buddies from the deny list
 void removeFromDeny(TOCBuddy buddy)
          Removes a buddy from the deny list
 void removeFromDeny(TOCBuddy[] buddies)
          Removes multiple buddies from the deny list
 void removeFromPermit(java.lang.String buddy)
          Removes a buddy from the permit list
 void removeFromPermit(java.lang.String[] buddies)
          Removes multiple buddies from the permit list
 void removeFromPermit(TOCBuddy buddy)
          Removes a buddy from the permit list
 void removeFromPermit(TOCBuddy[] buddies)
          Removes multiple buddies from the permit list
 void removeTOCListener(TOCListener listener)
          Register a listener with this TOCConnection to receive events
 void returnFromAway()
          Return from away status
 void returnFromIdle()
          Sets the users status back from being idle.
 void run()
          Processing method for the connection with TOC server.
 void searchDirectory(java.lang.String first, java.lang.String middle, java.lang.String last, java.lang.String maiden, java.lang.String city, java.lang.String state, java.lang.String country, java.lang.String email, java.lang.String webSearch)
          Sets the user's directory information.
 void sendChatInvite(java.lang.String roomId, java.lang.String buddy, java.lang.String message)
          Sends an invitation to a buddy
 void sendChatInvite(java.lang.String roomId, TOCBuddy buddy, java.lang.String message)
          Sends an invitation to a buddy
 void sendChatMessage(int roomID, java.lang.String message)
          Sends a message to the chatroom readable by everyone in that room.
 void sendChatWarning(int roomID, java.lang.String buddy, boolean anonymous)
          Warns a buddy in the chatroom
 void sendChatWarning(int roomID, TOCBuddy buddy, boolean anonymous)
          Warns a buddy in the chatroom
 void sendChatWhisper(int roomID, java.lang.String buddy, java.lang.String message)
          Whisper a message to only a specific buddy in the chatroom
 void sendChatWhisper(int roomID, TOCBuddy buddy, java.lang.String message)
          Whisper a message to only a specific buddy in the chatroom
protected  void sendFlap(java.lang.String data, byte frameType)
          Sends a string of data to the server
 void sendMessage(java.lang.String buddy, java.lang.String message)
          Sends an instant message to a buddy.
 void setAuthorizationServer(java.lang.String server, int port)
          Sets the authorization server Default address: login.oscar.aol.com Default port: 29999
 void setAway(java.lang.String message)
          Set's the away message
 void setCaps(java.lang.String caps)
          Lets the server know what capabilities this client supports.
 void setDebug(boolean debug)
           
 void setDirInfo(java.lang.String first, java.lang.String middle, java.lang.String last, java.lang.String maiden, java.lang.String city, java.lang.String state, java.lang.String country, java.lang.String email, java.lang.String webSearch)
          Sets the user's directory information.
 void setIdle(int seconds)
          Sets the user idle.
 void setInfo(java.lang.String info)
          Sets user's profile information
 void setLoginServer(java.lang.String server, int port)
          Sets the login server Default address: toc.oscar.aol.com Default port: 5190
 void setNameFormat(java.lang.String name)
          Changes the format of the username This can only change the spacing of the characters, and capitalization of the characters.
 void setPermitMode(int p)
          Sets the permit mode Use the static permit mode variables
 void signOff()
          Disconnects from the TOC server
 void signOn(java.lang.String user, java.lang.String pass)
          Signs onto the TOC network using the TOC2.0 protocol
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loginServer

protected java.lang.String loginServer

loginPort

protected int loginPort

authorizerServer

protected java.lang.String authorizerServer

authorizerPort

protected int authorizerPort

FLAP_VERSION

protected final int FLAP_VERSION
See Also:
Constant Field Values

REVISION

protected final java.lang.String REVISION
See Also:
Constant Field Values

VERSION

public java.lang.String VERSION

DEFAULT_GROUP

protected static final java.lang.String DEFAULT_GROUP
See Also:
Constant Field Values

AUTO_ADD_GROUP

public static final java.lang.String AUTO_ADD_GROUP
See Also:
Constant Field Values
Constructor Detail

TOCConnection

public TOCConnection()
Constructors


TOCConnection

public TOCConnection(java.lang.String clientName)
Method Detail

setDebug

public void setDebug(boolean debug)

run

public void run()
Processing method for the connection with TOC server.

Specified by:
run in interface java.lang.Runnable

isConnected

public boolean isConnected()
Returns true if this connection is active


signOn

public void signOn(java.lang.String user,
                   java.lang.String pass)
            throws java.io.IOException
Signs onto the TOC network using the TOC2.0 protocol

Parameters:
user - username to sign on with
pass - password to sign on with
Throws:
java.io.IOException
See Also:
signOff()

signOff

public void signOff()
             throws java.io.IOException
Disconnects from the TOC server

Throws:
java.io.IOException
See Also:
signOn(String, String)

parseTocData

protected void parseTocData(byte[] buffer)
Data received from TOC

Parameters:
buffer - byte array of data sent from server

processConfig

protected void processConfig(java.lang.String config)
Parses the config string. The config contains the buddy list information

Parameters:
config - the config sent by the server
See Also:
hasConfig(), getBuddyList()

setAway

public void setAway(java.lang.String message)
             throws java.io.IOException
Set's the away message

Parameters:
message - the away message
Throws:
java.io.IOException

returnFromAway

public void returnFromAway()
                    throws java.io.IOException
Return from away status

Throws:
java.io.IOException

setCaps

public void setCaps(java.lang.String caps)
             throws java.io.IOException
Lets the server know what capabilities this client supports. Multiple capabilities can be sent by seperating each UUID with a space.

Parameters:
caps - UUIDs indicating available capabilities supported
Throws:
java.io.IOException
See Also:
TOCConstants.CAP_TALK, TOCConstants.CAP_FILE_TRANSFER, TOCConstants.CAP_DIRECT_IM, TOCConstants.CAP_BUDDY_ICON, TOCConstants.CAP_ADD_INS, TOCConstants.CAP_FILE_SHARE, TOCConstants.CAP_SEND_LIST

getBuddy

public TOCBuddy getBuddy(java.lang.String name)
Gets an TOCBuddy object from a buddy name

Parameters:
name - buddy name to retrieve
Returns:
TOCBuddy
See Also:
TOCBuddy

sendFlap

protected void sendFlap(java.lang.String data,
                        byte frameType)
                 throws java.io.IOException
Sends a string of data to the server

Parameters:
data - data to be sent
frameType - FLAP frame type
Throws:
java.io.IOException
See Also:
FRAME_TYPE_SIGNON, FRAME_TYPE_DATA, FRAME_TYPE_ERROR, FRAME_TYPE_SIGNOFF, FRAME_TYPE_KEEP_ALIVE

normalizeString

protected static java.lang.String normalizeString(java.lang.String s)
Normalizes a string

Parameters:
s - The string to normalize
Returns:
the normalized string

getBuddyList

public java.util.Iterator getBuddyList()
Returns an Iterator containing all TOCBuddy's created from the CONFIG2 sent by TOC

Returns:
Iterator
See Also:
hasConfig()

setPermitMode

public void setPermitMode(int p)
Sets the permit mode Use the static permit mode variables

Parameters:
p - permit mode
See Also:
TOCConstants.PERMIT_ALL, TOCConstants.DENY_ALL, TOCConstants.PERMIT_SOME, TOCConstants.DENY_SOME, TOCConstants.ALLOW_BUDDIES_ONLY

addBuddy

public void addBuddy(TOCBuddy buddy)
              throws java.io.IOException
Adds a new buddy to the user's buddy list If the group the buddy belongs to doesn't already exist, it will be created.

Parameters:
buddy - TOCBuddy to add
Throws:
java.io.IOException
See Also:
TOCBuddy

addBuddy

public void addBuddy(java.lang.String name,
                     java.lang.String group)
              throws java.io.IOException
Adds a new buddy to the user's buddy list If the group the buddy belongs to doesn't already exist, it will be created.

Parameters:
buddy - name of buddy to add
group - name of group the buddy belongs to
Throws:
java.io.IOException

sendMessage

public void sendMessage(java.lang.String buddy,
                        java.lang.String message)
                 throws java.io.IOException
Sends an instant message to a buddy. Messages greater than MESSAGE_LENGTH_LIMIT will still be sent but only a substring of the first X number of characters will be used.

Parameters:
buddy - name of buddy to send message to
message - text to send to buddy, including HTML
Throws:
java.io.IOException
See Also:
TOCConstants.MESSAGE_LENGTH_LIMIT

removeBuddy

public void removeBuddy(TOCBuddy buddy)
                 throws java.io.IOException
Removes a buddy from the user's buddy list Currently not working??????

Parameters:
buddy - TOCBuddy to remove
Throws:
java.io.IOException
See Also:
TOCBuddy

sendChatInvite

public void sendChatInvite(java.lang.String roomId,
                           TOCBuddy buddy,
                           java.lang.String message)
                    throws java.io.IOException
Sends an invitation to a buddy

Parameters:
roomId - ID of the chatroom to invite buddy to
buddy - TOCBuddy to invite
message - greeting message
Throws:
java.io.IOException
See Also:
TOCBuddy, createRoom(String)

sendChatInvite

public void sendChatInvite(java.lang.String roomId,
                           java.lang.String buddy,
                           java.lang.String message)
                    throws java.io.IOException
Sends an invitation to a buddy

Parameters:
roomId - ID of the chatroom to invite buddy to
buddy - name of buddy to invite
message - greeting message
Throws:
java.io.IOException
See Also:
createRoom(String)

createChatRoom

public void createChatRoom(java.lang.String name)
                    throws java.io.IOException
Creates a new chat room. Upon successful creation, the server will send CHAT_JOIN followed by a CHAT_UPDATE_BUDDY about the user itself.

Parameters:
name - the name for the chatroom
Throws:
java.io.IOException
See Also:
TOCListener.chatroomJoined(String, String), TOCListener.chatroomUpdate(String, String, boolean)

sendChatMessage

public void sendChatMessage(int roomID,
                            java.lang.String message)
                     throws java.io.IOException
Sends a message to the chatroom readable by everyone in that room. User will receive this message from the server along with all other users in the room.

Parameters:
roomID - ID of the chat room
message - the message, including any html tags, to send to the chatroom
Throws:
java.io.IOException
See Also:
TOCListener.chatroomMessageReceived(String, String, String, boolean)

sendChatWhisper

public void sendChatWhisper(int roomID,
                            TOCBuddy buddy,
                            java.lang.String message)
                     throws java.io.IOException
Whisper a message to only a specific buddy in the chatroom

Parameters:
roomID - ID of the chatroom
buddy - TOCBuddy to send private message to
message - The message to send
Throws:
java.io.IOException
See Also:
TOCBuddy

sendChatWhisper

public void sendChatWhisper(int roomID,
                            java.lang.String buddy,
                            java.lang.String message)
                     throws java.io.IOException
Whisper a message to only a specific buddy in the chatroom

Parameters:
roomID - ID of the chatroom
buddy - name of buddy to send private message to
message - The message to send
Throws:
java.io.IOException

sendChatWarning

public void sendChatWarning(int roomID,
                            TOCBuddy buddy,
                            boolean anonymous)
                     throws java.io.IOException
Warns a buddy in the chatroom

Parameters:
roomID - ID of the chatroom
buddy - TOCBuddy to warn
anonymous - true to warn anonymously, false to show buddy your indentity
Throws:
java.io.IOException
See Also:
TOCBuddy

sendChatWarning

public void sendChatWarning(int roomID,
                            java.lang.String buddy,
                            boolean anonymous)
                     throws java.io.IOException
Warns a buddy in the chatroom

Parameters:
roomID - ID of the chatroom
buddy - name of buddy to warn
anonymous - true to warn anonymously, false to show buddy your indentity
Throws:
java.io.IOException

leaveChat

public void leaveChat(int roomID)
               throws java.io.IOException
Leaves the specified chatroom

Parameters:
roomID - ID of the chatroom
Throws:
java.io.IOException

acceptChatInvite

public void acceptChatInvite(int roomID)
                      throws java.io.IOException
Accepts a chatroom invitation. Upon success, client will receive the chatroomJoined event.

Parameters:
roomID - ID of the chat room
Throws:
java.io.IOException
See Also:
TOCListener.chatroomJoined(String, String)

setIdle

public void setIdle(int seconds)
             throws java.io.IOException
Sets the user idle. Server handles updating the idle time, so subsequent calls are not necessary.

Parameters:
seconds - current idle time in seconds
Throws:
java.io.IOException

returnFromIdle

public void returnFromIdle()
                    throws java.io.IOException
Sets the users status back from being idle.

Throws:
java.io.IOException

setInfo

public void setInfo(java.lang.String info)
             throws java.io.IOException
Sets user's profile information

Parameters:
info - profile info
Throws:
java.io.IOException

getBuddyInfo

public void getBuddyInfo(TOCBuddy buddy)
                  throws java.io.IOException
Retrieves a buddy's information in the form of a GOTO_URL sent back from the server

Parameters:
buddy - TOCBuddy to get info for
Throws:
java.io.IOException
See Also:
TOCListener.urlReceived(String, String)

getBuddyInfo

public void getBuddyInfo(java.lang.String buddy)
                  throws java.io.IOException
Retrieves a buddy's information in the form of a GOTO_URL sent back from the server

Parameters:
buddy - name of buddy to get info for
Throws:
java.io.IOException
See Also:
TOCListener.urlReceived(String, String)

getDirInfo

public void getDirInfo(TOCBuddy buddy)
                throws java.io.IOException
Retrieves a buddy's directory info

Parameters:
buddy - TOCBuddy to retrieve directory info for
Throws:
java.io.IOException
See Also:
TOCListener#urlReceived(TOCBuddy, String)

getDirInfo

public void getDirInfo(java.lang.String buddy)
                throws java.io.IOException
Retrieves a buddy's directory info

Parameters:
buddy - buddy name to retrieve directory info for
Throws:
java.io.IOException
See Also:
TOCListener#urlReceived(TOCBuddy, String)

setDirInfo

public void setDirInfo(java.lang.String first,
                       java.lang.String middle,
                       java.lang.String last,
                       java.lang.String maiden,
                       java.lang.String city,
                       java.lang.String state,
                       java.lang.String country,
                       java.lang.String email,
                       java.lang.String webSearch)
                throws java.io.IOException
Sets the user's directory information. You should receive a dirStatus event following this method call

Parameters:
first - your first name
middle - your middle name
last - your last name
maiden - your maiden name
city - your city
state - your state
country - your country
email - your email
webSearch - Having anything in this field allows others to find your dir info from web-searches, else they have to use the client
Throws:
java.io.IOException
See Also:
TOCListener.dirStatus(int, String[])

searchDirectory

public void searchDirectory(java.lang.String first,
                            java.lang.String middle,
                            java.lang.String last,
                            java.lang.String maiden,
                            java.lang.String city,
                            java.lang.String state,
                            java.lang.String country,
                            java.lang.String email,
                            java.lang.String webSearch)
                     throws java.io.IOException
Sets the user's directory information. You will either receive an aimError or urlReceived

Parameters:
first - your first name
middle - your middle name
last - your last name
maiden - your maiden name
city - your city
state - your state
country - your country
email - your email
webSearch - Search using other keywords
Throws:
java.io.IOException
See Also:
TOCListener.aimError(int, String[]), TOCListener.urlReceived(String, String)

createGroup

public void createGroup(java.lang.String group)
                 throws java.io.IOException
Creates a new group on the user's buddy list

Parameters:
group - name of the group to add
Throws:
java.io.IOException

deleteGroup

public void deleteGroup(java.lang.String group)
                 throws java.io.IOException
Deletes a group on the user's buddy list

Parameters:
group - name of the group to delete
Throws:
java.io.IOException

addToDeny

public void addToDeny(TOCBuddy buddy)
               throws java.io.IOException
Adds a buddy to the deny list

Parameters:
buddy - TOCBuddy to put on deny list
Throws:
java.io.IOException
See Also:
TOCBuddy

addToDeny

public void addToDeny(TOCBuddy[] buddies)
               throws java.io.IOException
Adds multiple buddies to the deny list

Parameters:
buddies - array of TOCBuddy's to put on deny list
Throws:
java.io.IOException
See Also:
TOCBuddy

addToDeny

public void addToDeny(java.lang.String buddy)
               throws java.io.IOException
Adds a buddy to the deny list

Parameters:
buddy - name to put on deny list
Throws:
java.io.IOException

addToDeny

public void addToDeny(java.lang.String[] buddies)
               throws java.io.IOException
Adds multiple buddies to the deny list

Parameters:
buddies - array of buddy names to put on deny list
Throws:
java.io.IOException

removeFromDeny

public void removeFromDeny(TOCBuddy buddy)
                    throws java.io.IOException
Removes a buddy from the deny list

Parameters:
buddy - TOCBuddy to remove from deny list
Throws:
java.io.IOException
See Also:
TOCBuddy

removeFromDeny

public void removeFromDeny(TOCBuddy[] buddies)
                    throws java.io.IOException
Removes multiple buddies from the deny list

Parameters:
buddies - array of TOCBuddy's to remove from deny list
Throws:
java.io.IOException
See Also:
TOCBuddy

removeFromDeny

public void removeFromDeny(java.lang.String buddy)
                    throws java.io.IOException
Removes a buddy from the deny list

Parameters:
buddy - name to remove from deny list
Throws:
java.io.IOException

removeFromDeny

public void removeFromDeny(java.lang.String[] buddies)
                    throws java.io.IOException
Removes multiple buddies from the deny list

Parameters:
buddies - array of buddy names to remove from deny list
Throws:
java.io.IOException

addToPermit

public void addToPermit(TOCBuddy buddy)
                 throws java.io.IOException
Adds a buddy to the permit list

Parameters:
buddy - TOCBuddy to put on permit list
Throws:
java.io.IOException
See Also:
TOCBuddy

addToPermit

public void addToPermit(TOCBuddy[] buddies)
                 throws java.io.IOException
Adds multiple buddies to the permit list

Parameters:
buddies - array of TOCBuddy's to put on permit list
Throws:
java.io.IOException
See Also:
TOCBuddy

addToPermit

public void addToPermit(java.lang.String buddy)
                 throws java.io.IOException
Adds a buddy to the permit list

Parameters:
buddy - name to put on permit list
Throws:
java.io.IOException

addToPermit

public void addToPermit(java.lang.String[] buddies)
                 throws java.io.IOException
Adds multiple buddies to the permit list

Parameters:
buddies - array of buddy names to put on permit list
Throws:
java.io.IOException

removeFromPermit

public void removeFromPermit(TOCBuddy buddy)
                      throws java.io.IOException
Removes a buddy from the permit list

Parameters:
buddy - TOCBuddy to remove from permit list
Throws:
java.io.IOException
See Also:
TOCBuddy

removeFromPermit

public void removeFromPermit(TOCBuddy[] buddies)
                      throws java.io.IOException
Removes multiple buddies from the permit list

Parameters:
buddies - array of TOCBuddy's to remove from permit list
Throws:
java.io.IOException
See Also:
TOCBuddy

removeFromPermit

public void removeFromPermit(java.lang.String buddy)
                      throws java.io.IOException
Removes a buddy from the permit list

Parameters:
buddy - name to remove from permit list
Throws:
java.io.IOException

removeFromPermit

public void removeFromPermit(java.lang.String[] buddies)
                      throws java.io.IOException
Removes multiple buddies from the permit list

Parameters:
buddies - array of buddy names to remove from permit list
Throws:
java.io.IOException

setNameFormat

public void setNameFormat(java.lang.String name)
                   throws java.io.IOException
Changes the format of the username This can only change the spacing of the characters, and capitalization of the characters. If both the old format and new format are normalized, they should appear identical. In response, the server will send either ADMIN_NICK_STATUS or ERROR.

Parameters:
name - new formatted name
Throws:
java.io.IOException
See Also:
TOCListener#adminFormatStatus(int), TOCListener.aimError(int, String[])

changePassword

public void changePassword(java.lang.String oldPass,
                           java.lang.String newPass)
                    throws java.io.IOException
Changes the password for the account Passwords cannot contain spaces

Parameters:
oldPass - old/current password
newPass - new password
Throws:
java.io.IOException
See Also:
TOCListener#adminPasswordStatus(int), TOCListener.aimError(int, String[])

acceptRvous

public void acceptRvous(TOCBuddy buddy,
                        java.lang.String cookie,
                        java.lang.String service,
                        java.lang.String tlv)
                 throws java.io.IOException
Accepts a rendezvous proposal

Parameters:
buddy - TOCBuddy to accept proposal from
cookie - cookie sent with the initial proposal
service - the UUID of the service this proposal is to be used for
tlv - any tlv's that need to be sent, base64 encoded values
Throws:
java.io.IOException
See Also:
TOCListener#rvousPropose(TOCBuddy,String,String,String,String,String,String,String,String)

acceptRvous

public void acceptRvous(java.lang.String buddy,
                        java.lang.String cookie,
                        java.lang.String service,
                        java.lang.String tlv)
                 throws java.io.IOException
Accepts a rendezvous proposal

Parameters:
buddy - name of buddy to accept proposal from
cookie - cookie sent with the initial proposal
service - the UUID of the service this proposal is to be used for
tlv - any tlv's that need to be sent, base64 encoded values
Throws:
java.io.IOException
See Also:
TOCListener#rvousPropose(TOCBuddy,String,String,String,String,String,String,String,String)

cancelRvous

public void cancelRvous(TOCBuddy buddy,
                        java.lang.String cookie,
                        java.lang.String service,
                        java.lang.String tlv)
                 throws java.io.IOException
Parameters:
buddy - TOCBuddy to cancel proposal from
cookie - cookie sent with the initial proposal
service - the UUID of the service this proposal is to be used for
tlv - any tlv's that need to be sent, base64 encoded values
Throws:
java.io.IOException
See Also:
TOCListener#rvousPropose(TOCBuddy,String,String,String,String,String,String,String,String)

cancelRvous

public void cancelRvous(java.lang.String buddy,
                        java.lang.String cookie,
                        java.lang.String service,
                        java.lang.String tlv)
                 throws java.io.IOException
Parameters:
buddy - name of buddy to cancel proposal from
cookie - cookie sent with the initial proposal
service - the UUID of the service this proposal is to be used for
tlv - any tlv's that need to be sent, base64 encoded values
Throws:
java.io.IOException
See Also:
TOCListener#rvousPropose(TOCBuddy,String,String,String,String,String,String,String,String)

proposeRvous

public void proposeRvous(java.lang.String buddy,
                         java.lang.String uuid,
                         java.lang.String cookie,
                         java.lang.String seq,
                         java.lang.String rip,
                         java.lang.String pip,
                         java.lang.String vip,
                         java.lang.String port,
                         java.lang.String tlv)
                  throws java.io.IOException
Propose a rendezvous - not yet implemented

Throws:
java.io.IOException

isBuddyOnPermit

public boolean isBuddyOnPermit(TOCBuddy buddy)
Determines if buddy is on the user's permit list

Parameters:
buddy - TOCBuddy to check for
Returns:
true or false
See Also:
TOCBuddy

isBuddyOnDeny

public boolean isBuddyOnDeny(TOCBuddy buddy)
Determines if the buddy is on the user's deny list

Parameters:
buddy - TOCBuddy to check for
Returns:
true or false
See Also:
TOCBuddy

hasConfig

public boolean hasConfig()
Returns true if the config was received from TOC

Returns:
true if connection has received the config
See Also:
getBuddyList()

getPermitMode

public int getPermitMode()
Returns the permit mode

Returns:
permit mode
See Also:
TOCConstants.PERMIT_ALL, TOCConstants.DENY_ALL, TOCConstants.PERMIT_SOME, TOCConstants.DENY_SOME, TOCConstants.ALLOW_BUDDIES_ONLY

getUsername

public java.lang.String getUsername()
Gets the name of the user currently signed in

Returns:
username of the account signed on with this connection

setLoginServer

public void setLoginServer(java.lang.String server,
                           int port)
Sets the login server Default address: toc.oscar.aol.com Default port: 5190

Parameters:
server - new server address
port - new server port

setAuthorizationServer

public void setAuthorizationServer(java.lang.String server,
                                   int port)
Sets the authorization server Default address: login.oscar.aol.com Default port: 29999

Parameters:
server - new server address
port - new server port

getLoginServerAddress

public java.lang.String getLoginServerAddress()
Gets the login server address

Returns:
address string of the login server
See Also:
setLoginServer(String, int)

getLoginServerPort

public int getLoginServerPort()
Gets the login server port

Returns:
port of the login server
See Also:
setLoginServer(String, int)

getAuthorizationServerAddress

public java.lang.String getAuthorizationServerAddress()
Gets the authorization server address

Returns:
address string of the authorization server
See Also:
setAuthorizationServer(String, int)

getAuthorizationServerPort

public int getAuthorizationServerPort()
Gets the authorization server port

Returns:
port of the authorization server
See Also:
setAuthorizationServer(String, int)

addTOCListener

public void addTOCListener(TOCListener listener)
Register a listener with this TOCConnection to receive events

Parameters:
listener - The listener

removeTOCListener

public void removeTOCListener(TOCListener listener)
Register a listener with this TOCConnection to receive events

Parameters:
listener - The listener