Babylon Java Chat

Class BabylonClientConnection

java.lang.Object
  extended by java.lang.Thread
      extended by BabylonConnection
          extended by BabylonClientConnection
All Implemented Interfaces:
java.lang.Runnable

public class BabylonClientConnection
extends BabylonConnection

This class represents a user connection on the client side. All communication by the client is performed by this class.

Author:
Andy McLaughlin

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  boolean stop
           
protected  java.util.Vector userList
           
 
Fields inherited from class BabylonConnection
fileTransfers, imageTransfers, iStream, lastReceiveTime, lastSendTime, online, oStream, protocolVersion, socket, threadGroup, watchDog
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
BabylonClientConnection(java.net.Socket s, BabylonPanel panel)
           
 
Method Summary
protected  void addToIgnored()
          This routine will add the selected users from the user list to our list of ignored users.
protected  void addToIgnored(java.lang.String name)
          Ignore a specific user.
protected  BabylonUser findUser(java.lang.String userName)
          Find a user in the list based on their user name.
protected  void lostConnection()
           
 void run()
           
protected  void sendActivity(short activity)
          This tells our selected recipients that we're in the middle of typing or drawing something.
protected  void sendAllowUser(int userId, java.lang.String roomName)
          Tell the server that we want to un-ban the user from the current chat room.
protected  void sendBanUser(int userId, java.lang.String roomName)
          Tell the server that we want to ban the user from the current chat room.
protected  void sendBootUser(int userId, java.lang.String roomName)
          Tell the server that we want to boot the user from the current chat room.
protected  void sendChatText(java.lang.String data)
          This sends a line of chat text to the selected recipients.
protected  void sendClearCanv()
          Sends the 'clear canvas' signal to the specified users.
protected  void sendDisconnect()
          Tell the server that we're disconnecting.
protected  void sendDrawText(short colour, short x, short y, short type, short attribs, short size, java.lang.String text)
          This sends graphic text to the selected recipients.
protected  void sendEnterRoom(java.lang.String roomName, boolean priv, java.lang.String password)
          Tell the server that we want to join a different chat room.
protected  void sendError(short code, int toId)
          Sends the requested error advisory to the specified user.
protected  void sendFile(java.lang.String fileName, long totalSize, int totalBlocks, int blockSize, int expireMins)
          This requests sending a file to the selected users.
protected  void sendFileAccept(int toId, java.lang.String fileName, boolean accept)
          Tell the server whether or not we want to accept a file transfer initiated by a 'send file' request we've received.
protected  void sendFileBlock(java.lang.String fileName, int blockNumber, byte[] data)
          Send the server a block of a file from a file transfer initiated by a 'send file' request.
protected  void sendInstantMess(int toId, java.lang.String message)
          Sends an instant message to the server for the specified user.
protected  void sendInvite(int userId, java.lang.String roomName)
          Tell the server that we want to invite a user into our chat room.
protected  void sendLeaveMess(java.lang.String toName, java.lang.String message)
          Sends our message to the server for the specified user.
protected  void sendLine(short colour, short startX, short startY, short endX, short endY, short thick)
          This sends a graphic line to the selected recipients
protected  void sendPageUser()
          Sends the paging signal to the specified users.
protected  void sendPoly(short kind, short colour, short x, short y, short width, short height, short thick, boolean fill)
          This sends a graphic polygon to the selected recipients.
protected  void sendReadMess()
          Sends a request to the server to retrieve our stored messages.
protected  void sendRoomList()
          This will ask the server to send us a list of the current chat rooms.
protected  void sendSendEmail(java.lang.String fromAddress, java.lang.String toAddress, java.lang.String subject, java.lang.String text)
          Sends a 'send email' request to the server with the supplied parameters and data.
protected  void shutdown(boolean notifyUser)
           
 
Methods inherited from class BabylonConnection
sendActivity, sendAllowUser, sendBanUser, sendBootUser, sendChatText, sendClearCanv, sendConnect, sendDisconnect, sendDrawText, sendEnterRoom, sendError, sendFile, sendFileAccept, sendFileBlock, sendFileCancel, sendImage, sendImageBlock, sendInstantMess, sendInvite, sendLeaveMess, sendLine, sendPageUser, sendPing, sendPoly, sendProtocol, sendReadMess, sendRoomList, sendSendEmail, sendServerMessage, sendServerText, sendStoredMess, sendUserInfo, shutdown
 
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

userList

protected java.util.Vector userList

stop

protected boolean stop
Constructor Detail

BabylonClientConnection

public BabylonClientConnection(java.net.Socket s,
                               BabylonPanel panel)
                        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Specified by:
run in class BabylonConnection

findUser

protected BabylonUser findUser(java.lang.String userName)
Find a user in the list based on their user name.


addToIgnored

protected void addToIgnored(java.lang.String name)
Ignore a specific user.


addToIgnored

protected void addToIgnored()
This routine will add the selected users from the user list to our list of ignored users.


sendDisconnect

protected void sendDisconnect()
Tell the server that we're disconnecting.


sendRoomList

protected void sendRoomList()
This will ask the server to send us a list of the current chat rooms.


sendInvite

protected void sendInvite(int userId,
                          java.lang.String roomName)
Tell the server that we want to invite a user into our chat room.


sendEnterRoom

protected void sendEnterRoom(java.lang.String roomName,
                             boolean priv,
                             java.lang.String password)
Tell the server that we want to join a different chat room.


sendBootUser

protected void sendBootUser(int userId,
                            java.lang.String roomName)
Tell the server that we want to boot the user from the current chat room.


sendBanUser

protected void sendBanUser(int userId,
                           java.lang.String roomName)
Tell the server that we want to ban the user from the current chat room.


sendAllowUser

protected void sendAllowUser(int userId,
                             java.lang.String roomName)
Tell the server that we want to un-ban the user from the current chat room.


sendActivity

protected void sendActivity(short activity)
This tells our selected recipients that we're in the middle of typing or drawing something.


sendChatText

protected void sendChatText(java.lang.String data)
This sends a line of chat text to the selected recipients.


sendLine

protected void sendLine(short colour,
                        short startX,
                        short startY,
                        short endX,
                        short endY,
                        short thick)
This sends a graphic line to the selected recipients


sendPoly

protected void sendPoly(short kind,
                        short colour,
                        short x,
                        short y,
                        short width,
                        short height,
                        short thick,
                        boolean fill)
This sends a graphic polygon to the selected recipients.


sendDrawText

protected void sendDrawText(short colour,
                            short x,
                            short y,
                            short type,
                            short attribs,
                            short size,
                            java.lang.String text)
This sends graphic text to the selected recipients.


sendClearCanv

protected void sendClearCanv()
Sends the 'clear canvas' signal to the specified users.


sendPageUser

protected void sendPageUser()
Sends the paging signal to the specified users.


sendInstantMess

protected void sendInstantMess(int toId,
                               java.lang.String message)
Sends an instant message to the server for the specified user.


sendLeaveMess

protected void sendLeaveMess(java.lang.String toName,
                             java.lang.String message)
Sends our message to the server for the specified user.


sendReadMess

protected void sendReadMess()
Sends a request to the server to retrieve our stored messages.


sendError

protected void sendError(short code,
                         int toId)
Sends the requested error advisory to the specified user.


sendSendEmail

protected void sendSendEmail(java.lang.String fromAddress,
                             java.lang.String toAddress,
                             java.lang.String subject,
                             java.lang.String text)
Sends a 'send email' request to the server with the supplied parameters and data.


sendFile

protected void sendFile(java.lang.String fileName,
                        long totalSize,
                        int totalBlocks,
                        int blockSize,
                        int expireMins)
This requests sending a file to the selected users.


sendFileAccept

protected void sendFileAccept(int toId,
                              java.lang.String fileName,
                              boolean accept)
Tell the server whether or not we want to accept a file transfer initiated by a 'send file' request we've received.


sendFileBlock

protected void sendFileBlock(java.lang.String fileName,
                             int blockNumber,
                             byte[] data)
Send the server a block of a file from a file transfer initiated by a 'send file' request.


lostConnection

protected void lostConnection()
Specified by:
lostConnection in class BabylonConnection

shutdown

protected void shutdown(boolean notifyUser)

Babylon Java Chat