ChatNow! Client Reference
The ChatNow! client included with ConferenceRoom 2.0
represents a departure from the standard chat client style of the 1.9.x series
client. The ChatNow! client is not designed to be a powerful interface, but
rather a highly customizable, embeddable user interface. With it's simplistic,
modular plug and play approach and extensive graphic options, page designers
can create a chat interface optimized for their needs. ChatNow is available
only for the ConferenceRoom Enterprise Edition Server.
The
full ChatNow! package actually consists of several applets which function as
modules, the most important of which is the actual ChatNow applet. This
module is the core engine of ChatNow, and handles all the communication between
the chat server and the embedded modules on the web page. It must always be
included on a web page and you must always set a NAME attribute in the <APPLET>
tags so that the modules may find it. It is an invisible applet, so it will
not affect your page layout. You should also give it WIDTH=0 HEIGHT=0 attributes.
You should define this applet very early in your web page source, before any
of the modules so that it can be loaded before them. Once loaded, the ChatNow
applet will establish a connection with the server as a Guest nick and wait
for other modules to begin controlling it.
Important notes:
- If
you use the ARCHIVE tag to deliver archived copies of the ChatNow.class and
its supporting classes (desirable, this reduces the number of connections
made as well as the size of the downloaded files), that tag MUST be
repeated for each module embedded in the page.
- The
CODEBASE tag must also always be used and be identical (this tag sets the
base directory where the Java classes are stored).
- Because
the ChatNow package includes support for running JavaScript commands, you
must include the MAYSCRIPT tag in the applet definition for the ChatNow applet
and each supporting module. Note that JavaScript support is only verified
to work on Internet Explorer 4.0+ and Netscape for Windows.
- One
final restriction is that the ChatNow applet and it's supporting modules must
always be on the same page and/or frame. Applets are not allowed to communicate
across pages or frames. Unfortunately, a bug exists in the current Microsoft
VM that does allow this, which can cause problems if you have more than one
page with a ChatNow client loaded. A quick fix for this problem is to use
unique names for the ChatNow.class applet per page, so that it's supporting
modules know exactly which one to communicate with.
Applet
params and PRM files:
Normally, applets take their settings from param statements but with ConferenceRoom
before and now with ChatNow!, our applets can have a companion prm file. This
file simply lists the params in a more simplified structure. For example, when
specifying params in the HTML where the applet is created you would use:
<PARAM NAME="server" VALUE="irc.webmaster.com">
However, in a PRM file you would use:
server=irc.webmaster.com
Not only will using PRM files save typing, it also lets you
specify applet params on the server itself, without worry that someone could
hijack your chat code and put it on their own server. With most Java applets,
someone can simply copy the HTML that creates the applet, change some params
to their liking, and put it on their own web page. They essentially get a free
copy of the applet, running off your own server. WebMaster, Inc. does this for
their backpack service, allowing people to use our resources to put their own
registered chat room on their page.
The default PRM files are always read if available, so the params you
set in them will always be used. By using PRM files, you can set params and
not have to worry about someone changing them as params specified in HTML will
not normally override those set in a PRM file. There is an optional override
param that will allow you to specify params that can be set from HTML. In the
ChatNow! package, the ChatNow class and each module can use PRM files. Each
has a default file, and another can be specified with the ssp param.
The default file must be named specifically, and can be either in the folder
where the Java code (the ChatNow.zip file) exists, or in the folder where the
HTML page exists, or both. As per Java security restrictions, the PRM file located
with the HTML must be on the same server as the Java code. If both locations
are used, the settings in the two files will be combined, with the PRM file
located with the HTML taking precedence. An additional file may be specified
with the ssp param which must also reside on the same server, and will
take precedence over both of the default files. The naming convention for the
default PRM files are ChatNow.prm for ChatNow.class and Module.prm
for each Module.class. Capitalization is important.
PRM file related params
for the ChatNow applet and it's modules are:
- lock
[true/false] lock params to only the default prm file. A file specified
with the ssp param is ignored. Can only be in a default prm file.
- override
specify params that can be overridden through HTML. Separate params with a
; semicolon.
Ex. override=server;password;port
Can only be in a default prm file.
- ssp
specify a server-side param file to draw params from
Applet params for the
ChatNow applet are:
- authorizedhost
if you want to serve the applet HTML from a particular host or hosts, but
want to make sure only your host(s) are able to work, specify them with this
param. Multiple hosts can be specified by separating them with a comma. The
host machine serving the Java code itself is always considered an authorized
host and does not need to be specified. If your host can be specified in multiple
ways, be sure to list them all.
Why is this useful?
Enterprising people can "hijack" your chat, by simply copying your
HTML that defines the applet onto their own pages, thus providing their own
chat off of your resources! By setting this param, you can say exactly
which server(s) are able to serve up your applet. Be sure to put this setting
in ChatNow's default prm file, so that it is always loaded.
- server
chat server to connect to, defaults to the server from which the applet was
loaded
- password
password to the server (if necessary)
- port
port to connect to, defaults to 6667
- idle
number of minutes to allow the client to idle on the server, defaults to unlimited
- nick
nickname to use to login to the server. Uses a guest nickname if not set
- user
username to use to login to the server. Only used when nick is set
- name
real name to use to login to the server. Only used when nick is set
- join
room to join upon connection. This may also be scripted in the AutoReply module
- key
room key to use if necessary
There
are a few internal commands that are not sent to the server but have special
meaning to ChatNow!:
- cmd_query
[nickname] Open a query to a particular nickname, which means any chat
sent after the command will be sent to the nickname as a private message.
By issuing the command without a nickname, you turn the query mode off.
- cmd_showdocument
[url] Asks the browser to bring up a page with the requested document.
Do not abuse this command!
- cmd_about
displays information about ChatNow!
- cmd_listmodules
displays a list of currently active modules
- cmd_locale
change to a different language locale if possible
- cmd_javascript
[command] Executes a Javascript command. Probably only supported on Netscape
Navigator and IE 4.0+ for Windows. Doesn't appear to work on MacOS.
Internal
commands are a way for modules to crosstalk, for example the AutoReply module
can issue a cmd_sound command to make CNSoundPlayer play a sound related to
a particular server reply, a private message perhaps.
There
are a few external commands that are accessible from JavaScript:
- connect()
if the applet isn't connected, will initiate a connection attempt
- connected()
returns true if the applet is currently connected
- disconnect()
if the applet is connected, will disconnect
- server()
returns the server we connect to
- port()
returns the port we connect to
- nick()
returns the user's nickname
- output(command)
sends a command to the parsing engine, if not preceeded by a '/', it's
assumed the command is text to be spoken in the current channel (if any)
- output(target,
text) sends text to a particular target, a nickname or channel. If preceeded
by a '/', the text is considered to be a command instead and target is ignored
- target()
get the current target, in case the user is in query mode to another nickname
- setTarget(target)
set the current target
All modules share a few standard applet params:
- bg background color
- fg foreground color
- appletname name given to the ChatNow applet. This
param must always be provided so that the modules can locate the ChatNow applet.
- insets sometimes to fit your graphics, you may
want to add insets around the text area, in the format top,left,bottom,right
default is 0,0,0,0. Not all modules use insets.
- font font name
- style font style, PLAIN(default), BOLD, ITALIC,
or BOLD+ITALIC
- size font point size
This
module is designed to show the text of a chat room. Normally you would always
want to include this module, as it generally shows what is going on. You can
have any number of these on a page, and can 'tune' them to specific rooms if
necessary. You also have several graphical options available to customize the
look of the module, and take steps to embed it into the page.
Applet params specific to the HistoryModule module are:
- watchroom
if you want to specify a particular room to show
- ignoreroom
you can specify a list of rooms, separated by a comma, to not watch
- mycolor
color used to show the user's own chat
- talkcolor
color used to show normal conversations
- joincolor
color used to show users joining the chat room
- partcolor
color used to show users leaving the chat room
- quitcolor
color used to show users quitting
- kickcolor
color used to show users who are kicked from the chat room
- actioncolor
color used to show actions in the chat room
- soundcolor
color used to show actions with sounds in the chat room
- privatecolor
color used to show private messages
- noticecolor
color used to show notice messages
- systemcolor
color used for messages from the system
- errorcolor
color used to show errors
- urlcolor
color used to show URLs
- titlecolor
color used for the background of the titlebar and the scrollbar
- titletextcolor
color used for the titlebar text and the scrollbar background
- fgimage
specify a foreground (overlay) image, you should use transparent gifs to allow
the text to show through
- midimage
specify a middle image, rendered on top of the background image and uder the
text
- bgimage
specify a background image
- showtitlebar
show the titlebar, which shows the room name and topic, defaults to true
- scrollercolor
color used for the scrollbar, overrides titlecolor
- scrollerbgcolor
color used for the scrollbar background, overrides titletextcolor
- showscrollbar
show the scrollbar, defaults to true
- nobevel
don't render a bevel around the text, defaults to false. The bevel may sometimes
interfere with your graphics or produce an undesired effect
- shownicknames
show a person's nickname when they speak, defaults to true. Only affects
in-channel speaking
There
are a few internal commands that are not sent to the server but have special
meaning to HistoryModule:
- cmd_clear
clears the display
- cmd_history
[text] prints the specified text in any HistoryModule, useful for special
announcements.
- cmd_setcolor
[nick] [color] sets a color on a particular nick. Not specifying a color
resets it to the default
There
are a few external commands that are accessible from JavaScript:
- channel()
returns the current channel (if any)
This
module is designed to show users in a chat room. You can also tune this to a
specific room like HistoryLog. Some of the graphical options are the same as
well. Another feature is that UserLog allows you to customize what happens when
you click on a nickname. Build your command, and when you want to insert the
nickname that was clicked, use %n.
Applet params specific to the UsersModule module are:
- watchroom
if you want to specify a particular room to show
- ignoreroom
you can specify a list of rooms, separated by a comma, to not watch
- selectcolor
color to draw with when selected
- titlecolor
color used for the background of the titlebar and the scrollbar
- titletextcolor
color used for the titlebar text and the scrollbar background
- scrollercolor
color used for the scrollbar, overrides titlecolor
- scrollerbgcolor
color used for the scrollbar background, overrides titletextcolor
- opcolor
color to draw with when user is op-ed
- voicecolor
color to draw with when user has voice
- uopcolor
color to draw with when user is uop-ed
- fgimage
specify a foreground (overlay) image, you should use transparent gifs to allow
the text to show through
- midimage
specify a middle image, rendered on top of the background image and uder the
text
- bgimage
specify a background image
- showtitlebar
show the titlebar, which shows the room name and topic, defaults to true
- nobevel
don't render a bevel around the text, defaults to false. The bevel may sometimes
interfere with your graphics or produce an undesired effect
- onclick
command to issue on clicking a user, default is "/cmd_query %n"
- ondclick
command to issue on double clicking a user, default is "/whois %n"
- onemptyclick
command to issue on clicking off a user, default is "/cmd_query"
(which turns querying mode off)
There
are a few internal commands that are not sent to the server but have special
meaning to UserModule:
- cmd_setcolor
[nick] [color] sets a color on a particular nick. Not specifying a color
resets it to the default for that user
There
are a few external commands that are accessible from JavaScript:
- users()
returns a list of all users in a channel, separated by a space
Ex. "@John @Paul @George Ringo"
This
module is designed to show available rooms. Some of the graphical options are
the same as well. Another feature is that RoomLog allows you to customize what
happens when you click on a room. Build your command, and when you want to insert
the room that was clicked, use %r. To insert the topic, use %t. To insert the
number of users, use %n.
Applet params specific to the RoomsModule module are:
- selectcolor
color to draw with when selected
- titlecolor
color used for the background of the titlebar and the scrollbar
- titletextcolor
color used for the titlebar text and the scrollbar background
- scrollercolor
color used for the scrollbar, overrides titlecolor
- scrollerbgcolor
color used for the scrollbar background, overrides titletextcolor
- fgimage
specify a foreground (overlay) image, you should use transparent gifs to allow
the text to show through
- midimage
specify a middle image, rendered on top of the background image and uder the
text
- bgimage
specify a background image
- showtitlebar
show the titlebar, which shows the room name and topic, defaults to true
- nobevel
don't render a bevel around the text, defaults to false. The bevel may sometimes
interfere with your graphics or produce an undesired effect
- onclick
command to issue on clicking a room, default is "/cmd_history %r [%n
users] : %t"
- ondclick
command to issue on double clicking a room, default is "/join %r"
- onemptyclick
command to issue on clicking off a room, default is ""
This
module provides a place to type commands and talk in rooms. It can also be directed
to send to a specific room or nickname, and you can have more than one on a
page.
Applet params specific to the RoomLog module are:
- lurk
if true, a guest nickname cannot be used to chat. The user may continue to
watch the chat (to lurk) but must supply a new nickname to participate. Defaults
to false
- sendto
specifies a room or nickname for all typed text to be sent to. If not set,
text will be sent to the current room
- eventmessage
If you're hosting an event, and this input module is used only for sending
questions to a guest or moderator, the user will be show the eventmessage
after submitting his question
- prompt
specifies a test prompt to appear with the input bar
- showsendbutton
if true, a send button will appear to the right of the input bar. Defaults
to false
This
module is designed so that you can extend the command set and tailor automatic
reactions to specific situations, for example adding a personalized help command.
This module has no visual feedback and can be hidden away like ChatNow.class.
You may use several commands for the same code or match. It is recommended you
use a specific command prefix with an underscore character to avoid creating
collisions with actual server commands, otherwise your command will also be
sent to the server which may not recognize them. The ChatNow! applet and it's
modules use CMD_ as a prefix, and commands with this prefix are never sent to
the server. Any command containing an underscore character '_' will never be
sent to the server. All commands are received in uppercase form. The AutoCommand
applet WILL receive the same commands you send, so take care not to create any
infinite loops!
This module has 100 available of a single param:
- command
- command1
- ...
- command99
The format of a command param is:
[cmd];[target];[data];[my command]
Asterisk, '*' may be used for standard pattern matching. Examples are:
- command=CMD_HELLOTECHSUPPORT;*;*;/privmsg
john I am here for tech support
This command could be issued along with a corresponding reply from the
AutoReply class to have the client automatically log on to the server and
message a tech support person. The AutoReply parameter could look like:
reply17=JOIN;*;*;#techsupport;/cmd_hellotechsupport
- command5=PRIVMSG;#event;*;/cmd_history
Your question has been sent and will be reviewed by the moderator
This command can be used during a chat event to display important information
on each message to the #event channel
There
are a few internal commands that are not sent to the server but have special
meaning to AutoCommand:
- cmd_addcommand
[command] add a new command on the stack, takes the same arguments as
the command params
- cmd_removecommand
[command or index] removes ALL stored commands of this name or the specified
index. Can use * pattern matching.
There
are a few external commands that are accessible from JavaScript:
- getCommands()
returns all the stored commands in the format
[index]:[command] [index2]:[command2] ...
This
module is designed so that you can tailor automatic reactions to specific situations,
for example automatically joining a room when you connect to a server. This
module has no visual feedback and can be hidden away like ChatNow.class. You
may use several replies for the same code or match.
This module has 100 available of a single param:
The format of a reply param is:
[code];[from];[to];[body];[my reply]
Asterisk, '*' may be used for standard pattern matching. Examples are:
- reply=001;*;*;*;/join
#webchat
reply1=001;*;*;*;/list
These replies will automatically make the client join #webchat and begin
retrieving a channel list after receiving the '001' code
- reply5=PRIVMSG;johnny;*;*;/msg
johnny hey, I'll be back shortly
This reply will message a nickname Johnny back each time he messages you
- reply27=PRIVMSG;*;*;*hey*;Hey
there!
This reply will say "Hey there!" any time someone else says
hey in a room with you
There
are a few internal commands that are not sent to the server but have special
meaning to AutoReply:
- cmd_addreply
[reply] add a new reply on the stack, takes the same arguments as the
reply params
- cmd_removereply
[reply or index] removes ALL stored replies of this name or the specified
index. Can use * pattern matching.
There
are a few external commands that are accessible from JavaScript:
- getReplies()
returns all the stored replies in the format
[index]:[reply] [index2]:[reply2] ...
This
module will play incoming or outgoing sounds. Like AutoResponse.class, it has
no visual feedback and should be hidden on the page with a 0 width and height.
Applet params for this module are:
- sounds
directory to find the sounds files to use, defaults to "/sounds/"
- joinsound
sound file to play when someone joins your channel
- noticesound
sound file to play when someone sends you a notice
There
are a few internal commands that are not sent to the server but have special
meaning to CNSoundPlayer:
- cmd_sound
[sound file]plays a particular sound file from the sounds directory
There
are a few external commands that are accessible from JavaScript:
- sound(url)
plays the sound specified in the given URL
This
module will show a topic and optionally users for a particular room similar
to the top lines of the HistoryModule and UsersModule. However, you can place
this anywhere on the page.
Applet params for this module are:
- channel
specify a particular channel, otherwise it's just whatever channel is being
viewed
- showtopic
[true/false] show the topic in the channel, defaults to true
- showusers
[true/false] show the number of users in the channel, defaults to true
There
are a few external commands that are accessible from JavaScript:
- channel()
returns the current channel (if any)
- topic()
returns the current topic (if in a channel)
- users()
returns the number of users (if in a channel)
This
module can be used to allow a user to submit a question to a particular target,
as well as fill in some key information about the user, such as name, location,
etc. It can be either embedded on the page, or accessible as a popup window
from a button.
Applet params for this module are:
- targetspecify
a particular target to send the submitted question to, defaults to none
- buttontext
specify text for the popup button, defaults to none. If none, then the
module appears embedded and there is no popup button or window
- submittext
specify text for the submit button on the popup window or embedded module
- prompt1
.. prompt10 specify the text for up to 10 information prompts
- template
specify the template when submitting the question. Special characters
will be substituted with prompts, control codes, and other information. They
are:
- %1
- %10 substitutes the corresponding prompt value
- %q
substitutes the user's question
- %n
substitutes the user's nickname
- %b
substitutes the BOLD character
- %r
substitutes the REVERSE character
- %u
substitutes the UNDERLINE character
- %k
substitutes the COLOR character
- %o
substitutes the NORMAL character
- %
substitutes the % character if necessary
There
are a few external commands that are accessible from JavaScript:
- value(int)
returns the specified prompt's value (if any)