close=This Chat is now closed.
entered in chatadmin.asp is, when entered via the client, typed as [#close=This Chat is now closed.]
These are the commands supported:
close=close message - displays a close message and closes the chat.
open - reopens the chat.
bgcolor=hex color - sets the background color to the given hex color.
fgcolor=hex color - sets the foreground color to the given hex color.
soundallow=soundstate - turns client sound on (1) or off (0).
clear - clears chat clients' post history.
reset - simulates pressing the reset on all open clients.
usersonline=text - changes "Users Online" to read something else.
title=text - changes the title of the chat to read something else.
refresh - refreshes the chat client's window, preserving alias, color scheme, chatid, chat title, sound status and post direction.
flush - deletes all commands in the server-side command cache.
localflush - deletes all commands in the client-side command cache.
picture=picture URL - replaces the webcam image with the given picture.
restorewebcam - restores webcam picture.
showrefreshes=1 or 0 - turns on or off an indicator to show current server polling rate.
postdirection=1 or 0 - new posts can go to the top (1) or the bottom (0) of the post history.
music=music URL - places a music item in the music cache to be played as soon as the player runs out of music.
musicursor=number - sets the music cursor to some absolute part of the music cache.
preemptmusic=music URL - immediately begins playing a song, stopping whatever song was playing.
flushmusic - flushes music cache. To stop playing music, you also need to execute a preemptmusic= (do not provide a URL)
wait=number - pauses a script's execution for a given number of milliseconds.
jump=number - jump to the provided relative position in the client command queue (-2 jumps you back two steps before the current command).
Additionally, the following objects can be modified in a number of ways:
msg - the post history window.
userlist - the list of users online.
inputter - the place where messages are typed.
scrollbar - the post history scrollbar.
buttons - the buttons beneath inputter.
chatlabel - the title at the top of the chat.
These objects have the following properties that can be set:
color - the color (hex).
x - x position.
y - y position.
xscale - x scale (percentage).
yscale - y scale (percentage).
rotation - rotation (degrees).
alpha - transparency (percentage).
To change a property, you issue commands such as
msg.x=199 (moves the post history over to the 199 position in the chat window)
chatlabel.yscale=50 (squishes the chatlabel to half its normal size)
scrollbar.rotation=40 (rotates scrollbar 40 degress clockwise)
When commands are entered into chatadmin.asp in the larger client command queue window, they immediately replace all commands in the server side queue as well as all queues in all open clients. When commands are entered either via the chat client itself or in the small single command item of chatadmin.asp, they are simply added to the end of all existing command queues.
To expedite the action of a command without having it cached on the client, precede it with an exclamation mark; thus
!restorewebcam
immediately restores the webcam image without bothering to wait for any other client side commands that might precede it in the queue.
Commands can also be provide on the chat's startup by being included in a variable passed in from the host ASP page (chat.asp). This variable is called initalcommands. Commands in initalcommands are to be separated by semicolons and no white space. Should spaces be needed, they must be replaced with pluses. Thus
chatcolors.swf?alias=gus&chatid=&initalcommands=title=This+Chat+Rocks;msg.x=222
would set the title to "This Chat Rocks" and moves the post history to x position 222.
robot robotname person_to_whom_robot_speaks - creates a robot who can be made to talk to only one person (or everyone if that is left out). The robot's artificial intelligence is found in the file turinglib.asp. The robot will go away if you issue a simple robot command with no parameters.
kick username - gets rid of a user, though the user will come right back in unless they are also banned.
ban username - prevents a user's posts from getting through.
banip username - prevents posts from a user's ip address from getting through, thereby avoiding the problem of their changing identities.
The system is client driven, in that, once loaded, the client begins polling the server at /chat/x.asp. It does so by sending variables containing the values of the latest indices of five different sorts of data it has received. These are:
1. the public posts (in the <lines> node)
2. private messages for this user (in the <private> node)
3. commands (in the <commands> node)
4. other chats (in the <chats> node)
5. users online (in the <users> node)
If the client is entirely up-to-date with respect the way things are on the server, then x.asp simply returns a barren <r/> tag. If, however, the client is out of date, then the XML will contain precisely the data that the client lacks. Once the client is caught up, the server returns barren <r/> XML tags once more. There is an "r" attribute that comes along with the <r/> XML tag, and this contains a number corresponding to the number of users currently online. This value is used to slow down polling as more users join the chat, thus minimizing burden to the server. The linear formula for this slowing can be altered at /chat/chatadmin.asp. If a path was passed to x.asp in the "p" variable, then there is also an "i" attribute in the <r/> tag and this will contain an integer reflecting the modification date of the file at the path provided, expressed in seconds since December 31, 1999. This number is used to determine if the webcam has changed and is used to provide intelligent webcam refreshing.
If new public posts are detected, they are immediately rendered and added to the post history. If private posts are detected, they are also rendered and added to the post history. Any commands are added to the client command queue, unless they are preceded by an exclamation mark (meaning they are expedient), in which case they are immediately executed. An entire list of users for a chat will be sent if the checksum of the client-side user list differs from the checksum of the server-side list. This checksum is returned as a "checksum" attribute of the users node to be used for the next server polling.
The posting of new messages (both public and private) is handled at message.asp. For the time being, this posting is done entirely blindly, and the client pays no attention to whether or not it was successful.
If the client is started up without an alias variable passed in, it throws up a login screen and then, upon receipt of the username, checks to see if it is taken. If it is not taken, the user can join the chat. Otherwise, the user must try again. This testing is performed by the client using xmluserexists.asp.
Users may create their own chats and then invite others to them. New chats are created when the client makes calls to xmlnewchat.asp.
These variables are as follows:
chatid - a unique string telling the system which chat thread is to be displayed and receive posts.
alias - the username of the poster on a particular client.
bgcolor - background color.
fgcolor - foreground color.
initalcommands - semi-colon-delimited commands to execute on startup.
soundallow - 1=makes sounds with posts.
postdirection - 1=new posts on top, 0=new posts on bottom.
title - the title of the chat.
justchat - 1 suppresses everything but the chat itself.
suppresswebcam - 1 suppresses the webcam.
fileextension - change this to the file extension of your backend data processor pages, such as ASP or PHP.
datatype - this should be "db" if there is any sort of backend persistence of user identities.
historyallow - the number of posts that are presented when a user enters the chat.