Babylon Java Chat

Class BabylonServerConnection

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

public class BabylonServerConnection
extends BabylonConnection

This class represents a user connection on the server side. All communication by the server 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  BabylonServer server
           
protected  BabylonStringManager strings
           
protected  BabylonUser user
           
 
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
BabylonServerConnection(java.lang.ThreadGroup tg, java.net.Socket s, BabylonServer parent)
           
 
Method Summary
protected  void leaveChatRoom()
          Remove the user from a chat room, and tell the remaining users about it, if required.
protected  void lostConnection()
           
 void run()
           
protected  void sendActivity(int fromId, short activity)
           
protected  void sendAllowUser(int userId, java.lang.String roomName)
           
protected  void sendBanUser(int userId, java.lang.String roomName)
          Tell the client they have been banned from a chat room.
protected  void sendChatText(int fromId, boolean priv, java.lang.String data)
           
protected  void sendClearCanv(int fromId)
           
protected  void sendDrawText(int fromId, short colour, short x, short y, short type, short attribs, short size, java.lang.String text)
           
protected  void sendError(int fromId, short errorCode)
           
protected  void sendFile(int fromId, java.lang.String fileName, long totalSize, int totalBlocks, int blockSize, int expireMins)
           
protected  void sendInstantMess(int fromId, java.lang.String message)
           
protected  void sendLine(int fromId, short colour, short startX, short startY, short endX, short endY, short thick)
           
protected  void sendPageUser(int fromId)
           
protected  void sendPoly(short kind, int fromId, short colour, short x, short y, short width, short height, short thick, boolean fill)
           
protected  void sendRoomList()
           
protected  void sendStoredMess()
           
 
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

server

protected BabylonServer server

user

protected BabylonUser user

strings

protected BabylonStringManager strings
Constructor Detail

BabylonServerConnection

public BabylonServerConnection(java.lang.ThreadGroup tg,
                               java.net.Socket s,
                               BabylonServer parent)
                        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

leaveChatRoom

protected void leaveChatRoom()
Remove the user from a chat room, and tell the remaining users about it, if required. It will also close a chat room if it's not the "main" chat room and there are no remaining participants.


sendRoomList

protected void sendRoomList()

sendBanUser

protected void sendBanUser(int userId,
                           java.lang.String roomName)
Tell the client they have been banned from a chat room.


sendAllowUser

protected void sendAllowUser(int userId,
                             java.lang.String roomName)

sendActivity

protected void sendActivity(int fromId,
                            short activity)

sendChatText

protected void sendChatText(int fromId,
                            boolean priv,
                            java.lang.String data)

sendLine

protected void sendLine(int fromId,
                        short colour,
                        short startX,
                        short startY,
                        short endX,
                        short endY,
                        short thick)

sendPoly

protected void sendPoly(short kind,
                        int fromId,
                        short colour,
                        short x,
                        short y,
                        short width,
                        short height,
                        short thick,
                        boolean fill)

sendDrawText

protected void sendDrawText(int fromId,
                            short colour,
                            short x,
                            short y,
                            short type,
                            short attribs,
                            short size,
                            java.lang.String text)

sendClearCanv

protected void sendClearCanv(int fromId)

sendPageUser

protected void sendPageUser(int fromId)

sendInstantMess

protected void sendInstantMess(int fromId,
                               java.lang.String message)

sendStoredMess

protected void sendStoredMess()

sendError

protected void sendError(int fromId,
                         short errorCode)

sendFile

protected void sendFile(int fromId,
                        java.lang.String fileName,
                        long totalSize,
                        int totalBlocks,
                        int blockSize,
                        int expireMins)

lostConnection

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

Babylon Java Chat