Babylon Java Chat

Class BabylonCommand

java.lang.Object
  extended by BabylonCommand

public class BabylonCommand
extends java.lang.Object

A class containing constants for defining the communications protocol between the client and server. Following is the protocol specification, with brief summary information.

If commands are different between protocol versions, the different verions are noted with asterisks:

Command Name Description Arguments
SETPROTO Used to negotiate the communications protocol version number. Sent by both the client and server back and forth until the highest common version is agreed upon. For example, if the client supports version 2.2, it sends that version. If the server only supports version 2.1, it will reply with that number, and they will henceforth communicate using that version of the protocol. (Double) version
NOOP Do nothing. Not used generally. none
PING Send by the server to "tickle" the client connection and make sure the connection is still valid. The client returns the ping, but this is not strictly necessary to stay connected none
CONNECT Sent by the server to the already-connected clients whenever a new user connects. (String) name
USERINFO
  • Sent by the client at connection time to tell the server about the new user. The client sends a user id of 0, since this is chosen by the server.
  • After adding the new user to the list of connections, the server sends this command to all connected users, including the new user. The new user only needs the user id at this point, but all the other clients record the new user's name, additional info, etc.
  • *2.0* (Integer) user_id, (String) name, (String) password, (Boolean) encrypted, (String) additional

    *2.1* (Integer) user_id, (String) name, (String) password, (Boolean) encrypted, (String) additional, (String) language

    *2.2* (Integer) user_id, (String) name, (String) password, (Boolean) encrypted, (String) email, (String) additional, (String) language

    SERVERMESS Sent by the server to the client. The client will typically raise a dialog box with the text of the message. (String) message
    DISCONNECT
  • Sent by the client to the server when the client wants to disconnect. In that scenario the message is blank.
  • Sent by the server to a client (with the message this time) when the server wants to disconnect the client.
  • Sent by the server to all the other clients to tell them that a client has disconnected.
  • (Integer) user_id, (String) message
    ROOMLIST
  • Sent by the client to the server with only the first argument (number of rooms) equal to 0, to request a list of chat rooms
  • Sent by the server at connection time, and in response to the request in (1), and whenever the list of chat rooms changes.
  • (Short) #rooms, [(String) name, (String) creator, (Boolean) private, (Boolean) invited, (Integer) #users, (String) username...] ...
    INVITE Sent by the client to indicate the invitation. The server forwards the invitation to the invitee client. (Integer) from_id, (String) roomname, (Integer) invitee_id
    ENTERROOM
  • Sent by the client to request a change of chat rooms. The chat room has not actually changed until the client receives (2). If the request is denied, the server will typically send a SERVERMESSAGE command to indicate the reason.
  • Sent by the server to all connected clients to indicate that a client has changed chat rooms. Used by the client in question to confirm that a room change request (1) has been accepted.
  • (Integer) from_id, (String) roomname, (Boolean) private, (String) password, (Boolean) encrypted
    BOOTUSER Sent by the client who owns a chat room to the server in order to request removal of another client from a chat room. The command is forwarded by the server to the booted client if the request is accepted. Denied, for example, if the requesting user doesn't own the room. (Integer) from_id, (String) roomname, (Integer) boot_id
    BANUSER Sent by the client who owns a chat room to the server in order to request banishment of another client from a chat room. If accepted by the server, the banned client will be denied any further attempts to enter the room, and the command is forwarded by the server to the banned client. Denied, for example, if the requesting user doesn't own the room. (Integer) from_id, (String) roomname, (Integer) ban_id
    ALLOWUSER Sent by the client who owns a chat room to the server in order to allow a previously-banned client to a chat room. If accepted by the server, the command is forwarded by the server to the banned client. Denied, for example, if the requesting user doesn't own the room. (Integer) from_id, (String) roomname, (Integer) allow_id
    ACTIVITY Sent by the client to indicate that the user is doing something, for example drawing or typing. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Short) type, (Integer) #for, [(Integer) for_id...]
    CHATTEXT Sent by the client with chat text entered by the user. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Boolean) private, (Short) colour, (String) data, (Integer) #for, [(Integer) for_id...]
    LINE Sent by the client when the user draws a line on the canvas, or draws freehand. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Short) colour, (Short) x0, (Short) y0, (Short) x1, (Short) y1, (Short) thick, (Integer) #for, [(Integer) for_id...]
    RECT Sent by the client when the user draws a rectangle on the canvas. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Short) colour, (Short) x0, (Short) y0, (Short) width, (Short) height, (Short) thick,(Boolean) fill, (Integer) #for, [(Integer) for_id...]
    OVAL Sent by the client when the user draws an oval on the canvas. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Short) colour, (Short) x0, (Short) y0, (Short) width, (Short) height, (Short) thick, (Boolean) fill, (Integer) #for, [(Integer) for_id...]
    DRAWTEXT Sent by the client when the user places graphical text on the canvas. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Short) colour, (Short) x, (Short) y, (Short) type, (Short) attr, (Short) size, (String) text, (Integer) #for, [(Integer) for_id...]
    IMAGE Sent by the client when the user pastes an image on the canvas. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0.

    Prior to version 2.2, all of the image data was sent as part of this command. As of 2.2, this command simply tells the recipient to expect total_blocks IMAGEBLOCK commands to follow, which contain the actual image data.

    *2.1* (Integer) from_id, (Short) x, (Short) y, (Integer) total_size, (Byte[]) data, (Integer) #for, [(Integer) for_id...]

    *2.2* (Integer) from_id, (String) image_name, (Short) x, (Short) y, (Integer) total_size, (Integer) total_blocks, (Integer) block_size, (Integer) #for, [(Integer) for_id...]

    CLEARCANV Sent by the client when the user clears the drawing canvas. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Integer) #for, [(Integer) for_id...]
    PAGEUSER Sent by the client when the user pages another user or users. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Integer) #for, [(Integer) for_id...]
    INSTANTMESS Sent by the client to deliver an instant message to another client. The server forwards the message to the specified recipient. (Integer) from_id, (Integer) for_id, (String) message
    LEAVEMESS Sent by the client to save a message on the server for the specified user name. (Integer) from_id, (String) for_name, (String) message
    READMESS Sent by the client when the user wishes to receive all or his or her saved messages. (Integer) from_id
    STOREDMESS Sent by the server in request to the READMESS request to the requesting client. Sends all of the saved messages, if any. (Short) number, [(String) sender_name, (String) message]...
    ERROR Sent by the client to notify other clients about errors or limitations. For example, the ERROR_NOSOUND error is sent in response to a PAGEUSER command if the paged client can't make the paging sound. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (Short) errorcode, (Integer) #for, [(Integer) for_id...]

    Error codes:
    ERROR_NOPAGE = 1
    ERROR_NOSOUND = 2

    SENDEMAIL Sent by the client to request that the server send an e-mail with the supplied parameters and data. (Integer) from_id, (String) mx_host, (String) from_address, (String) to_address, (String) subject, (String) message
    FILE Sent by the client to request the initiation of a file transfer. Forwarded by the server to the specified list of other clients, or to all connected clients if the #for parameter is 0. (Integer) from_id, (String) file_name, (Long) total_size, (Integer) total_blocks, (Integer) block_size, (Integer) expire_mins, (Integer) #for, [(Integer) for_id...]
    FILEACCEPT Sent by the client accept or refure an invitiation to participate in a file transfer. Forwarded by the server to the specified recipient (the initiator of the file transfer) . (Integer) from_id, (Integer) for_id, (String) file_name, (Boolean) accept
    FILEBLOCK Sent by the client as a block of data that is part of a file transfer, during the upload phase of the sender. Forwarded by the server to each of the file transfer participants who have opted to accept the file. (Integer) from_id, (String) file_name, (Integer) block_number, (Integer) data_length, (Byte[]) data
    FILECANCEL Sent by the client during a file transfer to indicate terminate either the uploading or downloading of a file transfer. Forwarded by the server to the file recipients if the sender cancels the transfer. (Integer) from_id, (String) file_name
    IMAGEBLOCK Following the sending of an IMAGE command specifying the details of an image transfer, the initiator sends the appropriate number of IMAGEBLOCK commands to transfer the actual image data. (Integer) from_id, (String) image_name, (Integer) block_number, (Integer) data_length, (Byte[]) data

    Author:
    Andy McLaughlin

    Field Summary
    static short ACTIVITY
               
    static short ACTIVITY_DRAWING
               
    static short ACTIVITY_TYPING
               
    static short ALLOWUSER
               
    static short BANUSER
               
    static short BOOTUSER
               
    static short CHATTEXT
               
    static short CLEARCANV
               
    static short CONNECT
               
    static short DISCONNECT
               
    static short DRAWTEXT
               
    static short ENTERROOM
               
    static short ERROR
               
    static short ERROR_NOPAGE
               
    static short ERROR_NOSOUND
               
    static short FILE
               
    static short FILEACCEPT
               
    static short FILEBLOCK
               
    static short FILECANCEL
               
    static short IMAGE
               
    static short IMAGEBLOCK
               
    static short INSTANTMESS
               
    static short INVITE
               
    static short LEAVEMESS
               
    static short LINE
               
    static short NOOP
               
    static short OVAL
               
    static short PAGEUSER
               
    static short PING
               
    static short READMESS
               
    static short RECT
               
    static short ROOMLIST
               
    static short SENDEMAIL
               
    static short SERVERMESS
               
    static short SETPROTO
               
    static short STOREDMESS
               
    static short USERINFO
               
     
    Constructor Summary
    BabylonCommand()
               
     
    Method Summary
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    SETPROTO

    public static final short SETPROTO
    See Also:
    Constant Field Values

    NOOP

    public static final short NOOP
    See Also:
    Constant Field Values

    PING

    public static final short PING
    See Also:
    Constant Field Values

    CONNECT

    public static final short CONNECT
    See Also:
    Constant Field Values

    USERINFO

    public static final short USERINFO
    See Also:
    Constant Field Values

    SERVERMESS

    public static final short SERVERMESS
    See Also:
    Constant Field Values

    DISCONNECT

    public static final short DISCONNECT
    See Also:
    Constant Field Values

    ROOMLIST

    public static final short ROOMLIST
    See Also:
    Constant Field Values

    INVITE

    public static final short INVITE
    See Also:
    Constant Field Values

    ENTERROOM

    public static final short ENTERROOM
    See Also:
    Constant Field Values

    BOOTUSER

    public static final short BOOTUSER
    See Also:
    Constant Field Values

    BANUSER

    public static final short BANUSER
    See Also:
    Constant Field Values

    ALLOWUSER

    public static final short ALLOWUSER
    See Also:
    Constant Field Values

    ACTIVITY

    public static final short ACTIVITY
    See Also:
    Constant Field Values

    CHATTEXT

    public static final short CHATTEXT
    See Also:
    Constant Field Values

    LINE

    public static final short LINE
    See Also:
    Constant Field Values

    RECT

    public static final short RECT
    See Also:
    Constant Field Values

    OVAL

    public static final short OVAL
    See Also:
    Constant Field Values

    DRAWTEXT

    public static final short DRAWTEXT
    See Also:
    Constant Field Values

    IMAGE

    public static final short IMAGE
    See Also:
    Constant Field Values

    CLEARCANV

    public static final short CLEARCANV
    See Also:
    Constant Field Values

    PAGEUSER

    public static final short PAGEUSER
    See Also:
    Constant Field Values

    INSTANTMESS

    public static final short INSTANTMESS
    See Also:
    Constant Field Values

    LEAVEMESS

    public static final short LEAVEMESS
    See Also:
    Constant Field Values

    READMESS

    public static final short READMESS
    See Also:
    Constant Field Values

    STOREDMESS

    public static final short STOREDMESS
    See Also:
    Constant Field Values

    ERROR

    public static final short ERROR
    See Also:
    Constant Field Values

    SENDEMAIL

    public static final short SENDEMAIL
    See Also:
    Constant Field Values

    FILE

    public static final short FILE
    See Also:
    Constant Field Values

    FILEACCEPT

    public static final short FILEACCEPT
    See Also:
    Constant Field Values

    FILEBLOCK

    public static final short FILEBLOCK
    See Also:
    Constant Field Values

    FILECANCEL

    public static final short FILECANCEL
    See Also:
    Constant Field Values

    IMAGEBLOCK

    public static final short IMAGEBLOCK
    See Also:
    Constant Field Values

    ACTIVITY_TYPING

    public static final short ACTIVITY_TYPING
    See Also:
    Constant Field Values

    ACTIVITY_DRAWING

    public static final short ACTIVITY_DRAWING
    See Also:
    Constant Field Values

    ERROR_NOPAGE

    public static final short ERROR_NOPAGE
    See Also:
    Constant Field Values

    ERROR_NOSOUND

    public static final short ERROR_NOSOUND
    See Also:
    Constant Field Values
    Constructor Detail

    BabylonCommand

    public BabylonCommand()

    Babylon Java Chat