Where Developers Matter
Integrated Development Environments for Windows, Java, and Web Developers
| | Log On

Introducing the CodeGear chat server

By: John Kaster

Abstract: An introduction to the CodeGear chat server beta test

    CodeGear chat server

We have a prototype of the new CodeGear chat server ready for testing, and you're invited to try it out. We are using a Jabber-based open source server called Openfire customized to support CodeGear account logins. Our default chat client is based on a customized version of another open source project called JWChat, which is a JavaScript client for Jabber.

We chose to standardize on Jabber because it is a very popular instant-messaging protocol with huge industry support. There are literally hundreds of clients available for Jabber.

We chose Openfire because it is one of the most full-featured Jabber servers available, we are using the freely available Open Source version, and we can (and do) customize it with JBuilder.

We chose JWChat because it is browser based, it works well with multiple browsers, it is a freely available Open Source project, and the JavaScript was easy to customize.

    Openfire customizations

Openfire is a Jabber server written in Java, with both a commercial version (Enterprise) and the open source version. The open source version appears to be more than sufficient for our needs, with our ability to customize it as needed with JBuilder.

Openfire should be able to scale to our needs without any problems, but the details are a bit light on the page discussing Openfire scalability.

    Blackfish SQL support

We have created a Blackfish SQL schema for Openfire, and have been using Blackfish SQL from the start. After a very productive discussion with one of the developers of Openfire, the "time" field in Openfire database is being changed to "logTime" so it doesn't conflict with the reserved word "time" in Blackfish SQL. Openfire 3.4 and above supports Blackfish SQL. InterBase can also be used with OpenFire 3.4 and above.

The Blackfish SQL schema we use for 3.4.x is available at the end of this document.

    CodeGear plug-in for Openfire

We have created a custom CodeGear plug-in for Openfire to support features Openfire does not have.

CodeGear account support

Openfire has a very nice plug-in architecture that allowed us to create "shadow copies" of CodeGear account information. All account logins use CodeGear membership services. The first time a user logs in to the chat server, an account record is created for them, so their CodeGear chat server preferences can be preserved.

Chat room participation information

In addition to support for CodeGear accounts, we extended Openfire to provide summary information of chat room participation that could be easily accessed by JavaScript. The custom JavaScript routines discussed below use this feature of the CodeGear plug-in.

Moderated room enhancements

Our Openfire plug-in also gracefully handles "unauthorized" entry into rooms that require moderation (such as the sales chat room) when no moderator is present. If a user enters a moderated room when no moderator is present, an automatic reply asks them to come back when a moderator is present and the room will close in 10 seconds. A "/kick" of the user is submitted 10 seconds after this message is displayed, which removes them from the room but allows them to return again later. We implemented this for the plug-in rather than JWChat so all clients connected would comply with the moderation rules.

The "moderation required" setting is a new Openfire server property called mustHaveModeratorRooms, which accepts a comma-delimited list of roomIDs to flag as requiring a moderator. For example:

mustHaveModeratorRooms=sales,coderage1,coderage2

is a valid configuration.

Q&A Interface

We have also introduced a "Question and Answer" (Q&A) interface for web broadcasts like our online conferences and public chats. This Q&A interface uses three (3) chat rooms that pop up on request, and can be placed anywhere on your monitor(s): the public chat room, the VIP room, and the Q&A room.

Public chat room

The public chat room can be used by all people attending the chat, including moderators. Chat participants can /ask questions in moderated chat rooms, and receive notification that their question has been submitted to Q&A room. The Q&A room is only visible to chat moderators. Answers to /asked questions appear in the VIP room.

The main difference between the public chat room for Q&A chats and other public group chats are the [Ask] button, and links to the other rooms used during the event. Clicking on the link for another room will automatically join you to that room, or re-display it if you're "in" the room but it is not visible on your display.

For all participants, the public chat room has a link to open the VIP room. Moderators will also have a link to the Q&A room. Chat administrators can toggle any user as a moderator. If a user is a moderator, a link to open the Q&A room appears in the public chat room.

Hide image
Click to see full-sized image

1 Sample public chat room

VIP Room

Only moderators can post content to the VIP room. Questions answered in the Q&A room appear in the VIP room with some special formatting to group the question and answer together. Moderators can also post messages directly to the VIP room from the Q&A room.

Hide image

2 Sample VIP room with questions and answers

Q&A room

Only moderators can see the Q&A room. The Q&A room color codes the status of the questions.

As the following screen shot shows, multiple actions are available for processing questions. All buttons except for [Send] and [Ask] require a specific question to be selected in the queue.

Hide image
Click to see full-sized image

3 Q&A room view, only for moderators

Button

Description

Assign

Sets the text field for the "Assigned" column if a specific user should answer the question.

Delete

Remove the question from the Q&A room

Mark as Read

Changes the status of a message from unread to read (only for your own browser view). Question ID 9 has been marked as "read" in the screenshot above.

Set Reply

Assign the text of the reply to the question. The question itself can also be edited in this dialog. Question 6 above has its reply set, so it is ready to be answered.

Answer

Send the question and reply to the VIP room. The question must have a reply to be sent. Question ID 7 above has been answered.

Ask

Submits a question to the Q&A queue. /ask <question> can also be used, just as it works in the public chat room.

Send

Send a message to the VIP room. This message has all the special handling described above in the public chat room section.

History preferences override for Group chat rooms

We have introduced new server behavior to override the default "history" that gets displayed for a chat room when the user enters it, to help set the context of the current conversation. For all standard chat rooms, we have configured the server to show the last 25 messages in the chat. We needed to turn off history for the sales room, and that required a customization.

For the sales chat room, the following server properties are used:

room.<roomname>.type = number
room.<roomname>.maxNumber = <# of past chats to show>

In the case of the sales chat room, the specific values for turning off chat history when you join the room are:

room.sales.type=number
room.sales.maxNumber=0

This way, users joining the chat room do not see what conversations have taken place before they arrive.

Sidebar: Using the Sales chat room

This is a "best practice" recommendation for the sales support chat room, should CodeGear start using it.

All communications on the server will be secured via SSL. However, any conversations with specific existing or prospective customers should be private. Once a user joins the sales chat room, and private conversation can be started with that user by clicking on their user name in the roster list. That way, any private information exchanged with that user is only visible to the CodeGear representative and that user.

Other users can be explicitly invited into the private chat by either party.

Registered user rooms

Another customization is rooms that are only available to registered users and moderators. Access for a registered user room is based on comma-delimited list of CodeGear package IDs. If the user account requesting access has registered one of the packages in the ID list, they are granted access to the room. Any unauthorized access from any IM client will be denied.

Registered user rooms appear in the standard room list page. (See Room list JavaScript page below).

Field test rooms

(TODO. This feature is not yet implemented.)

Another customization is rooms that are only available to registered field testers and moderators. Access for a field test room is based on the name of the field test in our Digital Signature system. If the user account requesting access has signed our Field Test NDA and been authorized as a field tester, they are granted access to the room. Any unauthorized access from any IM client will be denied.

Until we roll out version 2.0 of our membership services, access rights will be determined by calling the white listed Digital Signature web services method HasUserSignedTemplateCode(templatecode, [email], [userid]).

Field test rooms do not appear in the standard room list page. (See Room list JavaScript page below).

    JWChat browser client

Our default chat client, JWChat, uses JavaScript to communicate with our Jabber server. It is a very effective browser-based instant messaging client that is easy to extend for our special purposes.

    JWChat commands

JWChat has special text recognition enhancements for chat messaging presented in the browser. It also supports a subset of IRC commands, and some different commands applicable to browser client chats.

The command syntax is a slash character, followed by the command, and the text to parse for the command.

Command

Description

Example

/ask

Ask a question. Only available in certain Q&A chats.

/ask Why is there air?

/join

Join a chat room by room name.

/join delphi

/me

Describes something you're doing.

/me laughs

/ban

Moderator only. Ban a user from using our chat server.

/ban bozo

/kick

Moderator only. Kick a user out of a chat room. They can rejoin the chat again.

/kick bozo

/kickall

Moderator only. Kick all non-moderators out of a chat room

/kickall

/say

Posts a message to the chat room. This is the same as not specifying any special command and only entering text.

/say Boo!

/clear

Clears the current chat display in your browser window. Does not clear chat history for the room.

/clear

/nick

Sets your chat nickname. This option is not available in CodeGear chats.

If your CodeGear user account has a nickname set, it will be used in the chat room. If you don't have a nickname specified, FirstName_LastName is used as your nickname. You can set your nickname in membership services.

/topic

Moderator only. Sets the topic of the chat room.

/topic New chat topic!

/invite

Invites a user to join the chat. Available in most chat rooms.

/invite jkaster

/msg

Send a private message to a specific user.

/msg jaben I'm here!

/part

Leave one or more chat rooms

/part delphi

/whois

Display public information on specified user. (This currently has issues on our chat server.)

/whois jkaster

    JWChat customizations

We have already made significant enhancements and bug fixes to JWChat, and will provide the appropriate improvements back to the project after our beta cycle completes.

CSS changes

We have made the JWChat pages look better, and fit the current CodeGear look.

JWChat login page

The JWChat login page has been updated to provide some valuable hints to the user about logging in with their CodeGear account information, their automatic login progress, and enabling pop-ups.

Automatic login

If the user is currently logged in to the CodeGear web sites (the USER cookie is set), automatic login will occur when:

  • the JWChat login page is accessed, or
  • entry to a chat room is requested

If the USER cookie is not found, the user is prompted to login with the JWChat login. After a successful login, the browser then opens the chat room.

Room list JavaScript page

The room list is a "dashboard" page that shows participation levels in the current chat rooms. Room status is updated every 15 seconds. The countdown can be pre-empted by clicking on the "refreshing" link. Any room on the list can be joined via the browser by clicking on the room name.

The room list is available at http://chat.codegear.com. The final chat server implementation will be secure, at https://chat.codegear.com.

Any room that is currently "open" appears in the room list. Rooms that require moderation will be displayed when a moderator is available, and will disappear when a moderator is not present.

CodeGear macros

We have a several standard "phrases" that automatically receive hyperlinks in the chat. These are defined in the JavaScript file cgAdditions.js.

Pattern

Result

3rdRail

Points to the 3rdRail product page

Blackfish, Blackfish SQL

Points to the Blackfish SQL product page

Borland

Points to http://www.borland.com

C++Builder

Points to the C++Builder product page

CC:<CC#>

Points to the CodeCentral web site at the CC item id

CodeGear

Points to http://www.codegear.com

CodeRage

Points to the current CodeRage page

Delphi

Points to the Delphi product page

Delphi for PHP, DelphiPHP

Points to the Delphi for PHP product page

InterBase

Points to the InterBase product page

JBuilder

Points to the JBuilder product page

JGear

Points to the JGear product page

QC:<QC#>

Points to the QualityCentral web site at the QC report ID

QCWIN:Defect_No=<QC#>

Point the QC Windows client to the provided report ID

RAD Studio, RADstudio

Points to the RAD Studio product page

We have also extended the JWChat regex matching to support italics with a syntax like /this should be in italics/.

CodeGear emoticon

To embed the CodeGear favicon in the chat, use the text :cg: as part of your message.

    Online chat awareness

A critical component to the success of this chat system is letting people know about chat room availability and user participation. We have created some JavaScript routines to make it easy to provide online awareness of our group chat rooms on any web page, not just pages on the CodeGear domain.

We have JavaScript routines available that can be embedded in any html page on any web site, so anyone can invite people to participate in our group chats.

These routines go from the most general to the most personal and are called showRoomInfo, joinMe, and chatWithMe. The JavaScript calls refresh their status every 15 seconds. The sample HTML pages provided in this document will automatically update their status every 15 seconds simply by calling the appropriate JavaScript method.

JavaScript string substitution macros

The following "macros" are embeddable in the formatting strings used in the online awareness JavaScript routines described below.

Recognition of these identifiers in strings is case-insensitive.

Macro

Description

{MODERATORS}

# of moderators in the room

{MODERATORSTR}

Evaluates to "moderator" or "moderators", depending on the # of moderators in the room

{PEOPLE}

# of people in the room

{PEOPLESTR}

Evaluates to "person" or "people", depending on the # of people in the room

{ROOM}

Name of room

{ROOMDESC}

Description of room

{ROOMURL}

Direct link to the chat room

{USERS}

# of people that aren’t moderators in the room (users = people – moderators)

{USERSTR}

Evaluates to "user" or "users", depending on the # of users in the room

showRoomInfo

showRoomInfo is a general-purpose JavaScript routine for showing the current status of a specific chat room. It will provide a direct link to the chat room if the values passed into it mean the room is "open" for chatting.

showRoomInfo syntax
showRoomInfo( roomID, roomName, [onlyIfModeratorPresent,
  [hasPeopleFormat, [noModeratorFormat, [noPeopleFormat]]]]);
showRoomInfo parameters

Parameter

Description

roomID

The id of the chat room. Currently configured rooms are listed in the following table, with the default room name followed by the roomID in parenthesis:

Room

Description

3rdRail (ruby)

Ruby and 3rdRail public chat room

Blackfish SQL (blackfish)

Blackfish SQL public chat room

C++Builder (cpp)

C++ and C++Builder public chat room

CDN Developers (cdndev)

CDN Developer public chat room

CodeGear Education (learn)

CodeGear training, certification, and education. Moderated.

CodeGear Sales (sales)

CodeGear Sales. Moderated.

CodeRage Room 1 (coderage1)

CodeRage Room 1 chat room. Moderated.

CodeRage Room 2 (coderage2)

CodeRage Room 2 chat room. Moderated.

Delphi (delphi)

Delphi public chat room

Delphi for PHP (php)

Delphi for PHP public chat room

InterBase (interbase)

InterBase public chat rom

JBuilder (java)

JBuilder and java chat room

roomName

This is "friendly" name of the chat room, and localized values can be passed in for it. Defaults to the "room name" value configured in Open Fire.

onlyIfModeratorPresent

Set to true to require a moderator in the room, false for a general public chat room. If true is passed and no moderator is present, the noModeratorFormat string will be evaluated and returned as the result of this call. This value will be true for rooms like the sales support room.

Default = false.

hasPeopleFormat

This string is evaluated and returned if there are people in the chat room. It can be overridden for localization or customization purposes.

Default = "Chat with the {PEOPLE} {PEOPLESTR} in the {ROOM} room."

noModeratorFormat

This string is evaluated and returned if there is no moderator in the chat room and true is passed for onlyIfModeratorPresent. It can be overridden for localization or customization purposes.

Default = "{ROOM} chat room closed."

noPeopleFormat

This string is evaluated and returned if there are no people in the chat room, and can be overridden for localization or customization purposes.

Default = "Start a chat in the {ROOM} chat room."

showRoomInfo HTML example
<html>
<head>
 <title>Chat Room Stamp Demo</title>
 <script language="JavaScript" type="text/javascript"
   src="http://chat.codegear.com/chatroominfo.js">
 </script>
</head>
<body>
 <script language="JavaScript" type="text/javascript">
   <!-- showRoomInfo( "delphi" ); // -->
 </script>
</body>
</html>

joinMe

joinMe is used to invite someone into a public chat room when a specific user is also participating in that chat room.

joinMe syntax
joinMe( roomID, userID, [roomName, [userFriendlyName, 
[showIfNotInRoom, [ifUserInRoomFormat, 
[ifUserNotInRoomFormat]]]]] );
joinMe parameters