com.chatessentials.GlassBot
Class GlassBot

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.chatessentials.GlassBot.GlassBot
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class GlassBot
extends javax.servlet.http.HttpServlet
implements java.lang.Runnable

GlassBot(R) Base Class

Description: This is the base class for a bot. You must derive your bots from this class and override public methods with your own methods. Each GlassBot can be executed through main() method or invoked in the GlassRoom server. In earlier method you must define your own main method and in second one you must copy the class files into "classes" folder of GlassRoom server and define the bot in the GlassRoom control panel.

Copyright: Copyright (c) 2003

Company: Chat Essentials co.

Version:
1.1
Author:
A. Nayebi
See Also:
Serialized Form

Field Summary
static java.lang.String RET_PRIVATE_VOICE_ACC
           
static java.lang.String RET_PRIVATE_VOICE_REJ
           
 boolean startedByMain
          Indicates that bot is started by main() method.
 
Constructor Summary
GlassBot()
          Default constructor of a bot.
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doGet() method of Servlet called by servlet engine if you use this class as a servlet.
 void doPost(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doPost() method of Servlet called by servlet engine if you use this class as a servlet.
 boolean getDebugMode()
          Gets the state of debug mode.
 java.lang.String getNick()
          Use this method to get nickname of bot.
 java.util.Properties getProperties()
          Use this method to get the Properties object of bot.
 void init(javax.servlet.ServletConfig config)
          This method is initialization method of super class (Servlet).
 void initBot(java.net.InetAddress serverAddress, java.lang.String botNick, java.lang.String password, java.lang.String defaultRoom, java.lang.String propertiesFileName, int directPort, int servletPort, int voicePort)
          This method is called by GlassRoom to initialize the bot.
 void initFailed(char err)
          This method is invoked by GlassRoom to indicate that bot is not initiated successfully.
 void initiated()
          This method is invoked by GlassRoom to indicate that bot is initiated successfully.
 boolean isStarted()
          Call this method to ensure that bot is started.
 void killerException()
          Called by GlassRoom chat client when a killer exception such as disconnection is occured.
static void main(GlassBot glassBot, java.lang.String[] args)
          Helper main() method to start the bot from command line.
 void onAlive()
          Called by GlassRoom chat client when server replies to "alive" command
 void onBan(com.chatessentials.GlassRoom.UserMinor banned, com.chatessentials.GlassRoom.UserMinor banner)
          Called by GlassRoom chat client when a user bans other user.
 void onChatWatchPairs(java.lang.String[][] chatWatchPairsEng)
          Called by GlassRoom chat client when a list of chatwatch pairs arrives to the bot.
 void onCloseRoom(java.lang.String roomName)
          Called by GlassRoom chat client when a room is closed
 void onError(int errorNumber)
          Called by GlassRoom chat client when an error is occured
 void onFileReceive(com.chatessentials.GlassRoom.UserMinor user, java.lang.String sFileURL, boolean sentInPublic)
          Called by GlassRoom chat client when a public file is sent to the bot.
 void onInit()
          Called by GlassRoom chat client when first phase of initialization of user get finished in chat server.
 void onInitBot(java.net.InetAddress serverAddress, java.lang.String botNick, java.lang.String password, java.lang.String defaultRoom, java.lang.String propertiesFileName, int directPort, int servletPort, int voicePort)
          Called by GlassRoom to indicate that bot is started.
 void onInitializationFinished()
          Called by GlassRoom chat client when second phase of initialization get finished in chat server.
 void onJoin(com.chatessentials.GlassRoom.UserMinor user, com.chatessentials.GlassRoom.ChannelMinor room, java.lang.String secondName, int imageNo)
          Called by GlassRoom chat client when a user enters a room.
 void onListRooms()
          Called by GlassRoom chat client when a list of rooms arrives to the bot.
 void onListUsersInRoom(java.lang.String listedRoom)
          Called by GlassRoom chat client when a list of users of a room arrives to the bot.
 void onLogin(com.chatessentials.GlassRoom.UserMinor user, java.lang.String secondName, int imageNo)
          Called by GlassRoom chat client when a user login to system.
 void onLogout(java.lang.String nick)
          Called by GlassRoom chat client when a user leaves the system.
 void onModifyRoom(java.lang.String oldRoomName, com.chatessentials.GlassRoom.ChannelMinor newRoom)
          Called by GlassRoom chat client when a room name is changed
 void onNewRoom(com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when a new room is created.
 void onNickChange(java.lang.String oldNick, java.lang.String newNick)
          Called by GlassRoom chat client when a user changes his nickname
 void onPart(com.chatessentials.GlassRoom.UserMinor user, com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when a user leaves a room.
 void onPrivateMessage(com.chatessentials.GlassRoom.UserMinor sender, java.lang.String message, java.net.URL url)
          Called by GlassRoom chat client when a private message arrives to this bot.
 void onPrivateVoiceAcc(com.chatessentials.GlassRoom.UserMinor sender, java.lang.String address, int port)
          Called by GlassRoom chat client when a user accepts your private voice chat request.
 void onPrivateVoiceReject(com.chatessentials.GlassRoom.UserMinor sender)
          Called by GlassRoom chat client when a user rejects your private voice chat request.
 void onPrivateVoiceReq(com.chatessentials.GlassRoom.UserMinor sender, java.lang.String address, int port)
          Called by GlassRoom chat client when a private voice chat session request arrives to this bot.
 void onProfChange(com.chatessentials.GlassRoom.UserMinor user, java.lang.String secondName, int imageNo)
          Called by GlassRoom chat client when a user changes his profile
 void onProfile(com.chatessentials.GlassRoom.UserMinor user, com.chatessentials.GlassRoom.UserInfo ui)
          Called by GlassRoom chat client when a user changes his profile.
 void onPublicMessage(com.chatessentials.GlassRoom.UserMinor sender, java.lang.String message, java.net.URL url, boolean isBroadCast)
          Called by GlassRoom chat client when a public message arrives to this bot.
 void onSetNick(java.lang.String nick)
          Called by GlassRoom chat client when nickname of bot is set.
 void onSpeakOff(com.chatessentials.GlassRoom.UserMinor user)
          Called by GlassRoom chat client when the speaker finishes his speaking.
 void onSpeakOn(com.chatessentials.GlassRoom.UserMinor user, long timeToSpeak)
          Called by GlassRoom chat client when a user starts to speak in the current voice room of bot.
 void onSpeakTimeOut()
          Called by GlassRoom chat client when the bot's time-to-speak get finished.
 void onStartBot()
          Called by GlassRoom to indicate that bot is started.
 void onStartTypingMessage(com.chatessentials.GlassRoom.UserMinor sender)
          Called by GlassRoom chat client when a user starts typing in a private chat window.
 void onStopBot()
          Called by GlassRoom to indicate that bot is stopped.
 void onStopTypingMessage(com.chatessentials.GlassRoom.UserMinor sender)
          Called by GlassRoom chat client when a user stops typing in a private chat window.
 void onTalkStart()
          Called by GlassRoom chat client when the bot starts to record voice.
 void onVoiceJoin(com.chatessentials.GlassRoom.UserMinor user, com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when a user do voice-join to a room.
 void onVoiceOff(com.chatessentials.GlassRoom.UserMinor user)
          Called by GlassRoom chat client when a user turns his voice off.
 void onVoiceOn(com.chatessentials.GlassRoom.UserMinor user)
          Called by GlassRoom chat client when a user turns his voice on.
 void onVoicePart(com.chatessentials.GlassRoom.UserMinor user, com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when a user do voice-part from a room.
 void onYouBan(com.chatessentials.GlassRoom.UserMinor banner)
          Called by GlassRoom chat client when the bot is banned.
 void onYouJoin(com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when the bot enters a room.
 void onYouPart(com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when the bot leaves a room.
 void onYourProfile()
          Called by GlassRoom chat client when the chat server accepts your profile change
 void onYouVoiceJoin(com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when the bot do voice-join (listen) to a room
 void onYouVoicePart(com.chatessentials.GlassRoom.ChannelMinor room)
          Called by GlassRoom chat client when the bot do voice-part from a room.
 void run()
           
 void sendPrivateMessage(java.lang.String mess, java.lang.String nick)
          Use this method to send private messages to a user.
 void sendPrivateMessage(java.lang.String mess, java.lang.String nick, java.lang.String url)
          Use this method to send public messages with URL.
 void sendPublicMessage(java.lang.String mess)
          Use this method to send public messages to the current room.
 void sendPublicMessage(java.lang.String mess, java.lang.String url)
          Use this method to send public messages with URL.
 void sendRaw(java.lang.String str)
          Use this method to send raw messages to server.
 void setDebugMode(boolean b)
          You may set 'debugMode' variable to switch the bot to debug mode.
 void start()
          Called internally to start bot thread.
 void startBot()
          This method is called by GlassRoom to start the bot.
 void stop()
          Called internally to stop bot thread.
 void stopBot()
          This method is called by GlassRoom to stop the bot.
 
Methods inherited from class javax.servlet.http.HttpServlet
service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, log
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RET_PRIVATE_VOICE_ACC

public static final java.lang.String RET_PRIVATE_VOICE_ACC
See Also:
Constant Field Values

RET_PRIVATE_VOICE_REJ

public static final java.lang.String RET_PRIVATE_VOICE_REJ
See Also:
Constant Field Values

startedByMain

public boolean startedByMain
Indicates that bot is started by main() method.

Constructor Detail

GlassBot

public GlassBot()
Default constructor of a bot. Indeed, it only constructs the object and doesn't start any communication. You must start your bot through initBot(java.net.InetAddress, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, int, int) then startBot() methods.

Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  java.io.IOException
doGet() method of Servlet called by servlet engine if you use this class as a servlet. If you start the bot by main() method or you embedd the bot directly in GlassRoom chat server don't override this method.

Overrides:
doGet in class javax.servlet.http.HttpServlet
Parameters:
request -
response -
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
javax.servlet.Servlet#doGet

doPost

public void doPost(javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws javax.servlet.ServletException,
                   java.io.IOException
doPost() method of Servlet called by servlet engine if you use this class as a servlet. If you start the bot by main() method or you embedd the bot directly in GlassRoom chat server don't override this method.

Overrides:
doPost in class javax.servlet.http.HttpServlet
Parameters:
request -
response -
Throws:
javax.servlet.ServletException
java.io.IOException
See Also:
javax.servlet.Servlet#doPost

getDebugMode

public boolean getDebugMode()
Gets the state of debug mode.

Returns:
true if in debug mode and false otherwise.

getNick

public java.lang.String getNick()
Use this method to get nickname of bot.


getProperties

public java.util.Properties getProperties()
Use this method to get the Properties object of bot.

Returns:
Properties object of this bot or null if there is not any Properties object.
See Also:
initBot()

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
This method is initialization method of super class (Servlet). If you plan to use the bot as a servlet. You can initialize and start it in this method. If you start the bot by main() method or you embedd the bot directly in GlassRoom chat server don't override this method.

Specified by:
init in interface javax.servlet.Servlet
Overrides:
init in class javax.servlet.GenericServlet
javax.servlet.ServletException

initBot

public final void initBot(java.net.InetAddress serverAddress,
                          java.lang.String botNick,
                          java.lang.String password,
                          java.lang.String defaultRoom,
                          java.lang.String propertiesFileName,
                          int directPort,
                          int servletPort,
                          int voicePort)
                   throws java.lang.Exception
This method is called by GlassRoom to initialize the bot. You must specify the server address, bot's nick, password and other initialization parameters here. GlassRoom then calls startBot() to start the bot after initialization.

Parameters:
serverAddress - IP address of server.
botNick - Nickname of bot.
password - Password of bot (if required).You can define a user with the nickName of the bot and define a password for it in GlassRoom database. In this case you can assign special rights to bot through control panel.
defaultRoom - Default room of bot. Bot will automatically enter in this room.
propertiesFileName - Path of properties file in standard Java properties format. each property is composed from a pair of a key and a value. Each line of properties file contains a pair in form of key=value. '!' and '#' are used for comment lines.

This properties file will load in a Properties object that can be retrieved through getProperties() method. For exaqmple if you want to get a value named as foo, you can use the below code:

String foo = adsFileName = getProperties().getProperty("foo");

directPort - Direct connection port number. Default is 7100.
java.lang.Exception

initFailed

public void initFailed(char err)
This method is invoked by GlassRoom to indicate that bot is not initiated successfully. You can override this method by your own error handler. Default one writes a simple error description in System.out

Parameters:
err - The error code returned by chat server.

initiated

public void initiated()
This method is invoked by GlassRoom to indicate that bot is initiated successfully. You can override this method. Default one simply writes "Bot is initiated." in System.out


isStarted

public boolean isStarted()
Call this method to ensure that bot is started.


killerException

public void killerException()
Called by GlassRoom chat client when a killer exception such as disconnection is occured. The bot must finish it's work when this exception is thrown.


main

public static void main(GlassBot glassBot,
                        java.lang.String[] args)
Helper main() method to start the bot from command line. The derived class' main() method must create an object of itself and pass it to this main() method.

Parameters:
glassBot - GlassBot derived object
args - Same as "args" sent to main method of derived object.

onAlive

public void onAlive()
Called by GlassRoom chat client when server replies to "alive" command


onBan

public void onBan(com.chatessentials.GlassRoom.UserMinor banned,
                  com.chatessentials.GlassRoom.UserMinor banner)
Called by GlassRoom chat client when a user bans other user.

Parameters:
banned - User who is banned
banner - User who ban

onChatWatchPairs

public void onChatWatchPairs(java.lang.String[][] chatWatchPairsEng)
Called by GlassRoom chat client when a list of chatwatch pairs arrives to the bot.

Parameters:
chatWatchPairsEng - Array of pairs of words to be found and replaced.

onCloseRoom

public void onCloseRoom(java.lang.String roomName)
Called by GlassRoom chat client when a room is closed

Parameters:
roomName - name of room

onError

public void onError(int errorNumber)
Called by GlassRoom chat client when an error is occured

Parameters:
errorNumber - number of error

onFileReceive

public void onFileReceive(com.chatessentials.GlassRoom.UserMinor user,
                          java.lang.String sFileURL,
                          boolean sentInPublic)
Called by GlassRoom chat client when a public file is sent to the bot.

Parameters:
user - Sender of file
sFileURL - URL to get the file from
sentInPublic - Is file sent in public or private

onInit

public void onInit()
Called by GlassRoom chat client when first phase of initialization of user get finished in chat server. In this phase a peer object is build in chat server for this user.


onInitBot

public void onInitBot(java.net.InetAddress serverAddress,
                      java.lang.String botNick,
                      java.lang.String password,
                      java.lang.String defaultRoom,
                      java.lang.String propertiesFileName,
                      int directPort,
                      int servletPort,
                      int voicePort)
               throws java.lang.Exception
Called by GlassRoom to indicate that bot is started. You can override this method by your own code.

java.lang.Exception

onInitializationFinished

public void onInitializationFinished()
Called by GlassRoom chat client when second phase of initialization get finished in chat server. In this phase all the state information such as list of other users and rooms is sent to user.


onJoin

public void onJoin(com.chatessentials.GlassRoom.UserMinor user,
                   com.chatessentials.GlassRoom.ChannelMinor room,
                   java.lang.String secondName,
                   int imageNo)
Called by GlassRoom chat client when a user enters a room.

Parameters:
user - User who entered to room
room - Room
secondName - Second name of user
imageNo - Icon number of user

onListRooms

public void onListRooms()
Called by GlassRoom chat client when a list of rooms arrives to the bot. this list is sent when the bot logins to chat server first time. Later, bot can retrieve this list by sending "list" command


onListUsersInRoom

public void onListUsersInRoom(java.lang.String listedRoom)
Called by GlassRoom chat client when a list of users of a room arrives to the bot. this list is sent when the bot logins to chat server first time. Later, bot can retrieve this list by sending "who" command

Parameters:
listedRoom - Room which is listed. Room name is started with "#" and a "#" room name stands for list of users who have no room.

onLogin

public void onLogin(com.chatessentials.GlassRoom.UserMinor user,
                    java.lang.String secondName,
                    int imageNo)
Called by GlassRoom chat client when a user login to system.

Parameters:
user - User who login to system
secondName - Second name of user
imageNo - Icon number of user

onLogout

public void onLogout(java.lang.String nick)
Called by GlassRoom chat client when a user leaves the system.

Parameters:
nick - Nickname of user

onModifyRoom

public void onModifyRoom(java.lang.String oldRoomName,
                         com.chatessentials.GlassRoom.ChannelMinor newRoom)
Called by GlassRoom chat client when a room name is changed

Parameters:
oldRoomName - Old name of room
newRoom - New name of room

onNewRoom

public void onNewRoom(com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when a new room is created.

Parameters:
room - Room object

onNickChange

public void onNickChange(java.lang.String oldNick,
                         java.lang.String newNick)
Called by GlassRoom chat client when a user changes his nickname

Parameters:
oldNick - Old nickname
newNick - new nickname

onPart

public void onPart(com.chatessentials.GlassRoom.UserMinor user,
                   com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when a user leaves a room.

Parameters:
user - User who leaves the room
room - Room

onPrivateMessage

public void onPrivateMessage(com.chatessentials.GlassRoom.UserMinor sender,
                             java.lang.String message,
                             java.net.URL url)
Called by GlassRoom chat client when a private message arrives to this bot.

Parameters:
sender - Sender of message
message - Message body
url - URL included in message. null if thers is no URL.

onPrivateVoiceAcc

public void onPrivateVoiceAcc(com.chatessentials.GlassRoom.UserMinor sender,
                              java.lang.String address,
                              int port)
Called by GlassRoom chat client when a user accepts your private voice chat request.

Parameters:
sender - Requester user
address - IP address of requester
port - Port number of requester

onPrivateVoiceReject

public void onPrivateVoiceReject(com.chatessentials.GlassRoom.UserMinor sender)
Called by GlassRoom chat client when a user rejects your private voice chat request.

Parameters:
sender - User that rejected the private voice chat session.

onPrivateVoiceReq

public void onPrivateVoiceReq(com.chatessentials.GlassRoom.UserMinor sender,
                              java.lang.String address,
                              int port)
Called by GlassRoom chat client when a private voice chat session request arrives to this bot. You must reply this message with the below code to accept the session :

sendRaw( PRIVATE_VOICE_ACC + ' ' + sender ); or

sendRaw( PRIVATE_VOICE_REJ + ' ' + sender ); to reject the request. If you accept private voice chat session then you can open your private chat window by opening the below URL :

String url = "http://" + communicator.host + ":" + communicator.SERVLET_PORT + communicator.UPLOAD_SERVLET_PATH_NAME + '?' + "com=V&" + "nic=" + URLEncoder.encode(ni) + '&' + "add=" + URLEncoder.encode(address) + '&' + "port=" + URLEncoder.encode(port) + '&' + "doc=" + URLEncoder.encode(applet.getCodeBase().toString());

Parameters:
sender - Requester user
address - IP address of requester
port - Port number of requester

onProfChange

public void onProfChange(com.chatessentials.GlassRoom.UserMinor user,
                         java.lang.String secondName,
                         int imageNo)
Called by GlassRoom chat client when a user changes his profile

Parameters:
user - User object
secondName - Second name of user
imageNo - Icon number of user

onProfile

public void onProfile(com.chatessentials.GlassRoom.UserMinor user,
                      com.chatessentials.GlassRoom.UserInfo ui)
Called by GlassRoom chat client when a user changes his profile.

Parameters:
user - User object
ui - User information

onPublicMessage

public void onPublicMessage(com.chatessentials.GlassRoom.UserMinor sender,
                            java.lang.String message,
                            java.net.URL url,
                            boolean isBroadCast)
Called by GlassRoom chat client when a public message arrives to this bot.

Parameters:
sender - Sender of message
message - Message body
url - URL included in message. null if thers is no URL.
isBroadCast - Is it a broadcast message ?

onSetNick

public void onSetNick(java.lang.String nick)
Called by GlassRoom chat client when nickname of bot is set. When a bot tries to pick a nick name for itself or tries to change current nick name. If server accepts that name and there is no conflict this message is sent to bot to ensure that the nickname is changed.

Parameters:
nick - Nickname

onSpeakOff

public void onSpeakOff(com.chatessentials.GlassRoom.UserMinor user)
Called by GlassRoom chat client when the speaker finishes his speaking.

Parameters:
user - User object

onSpeakOn

public void onSpeakOn(com.chatessentials.GlassRoom.UserMinor user,
                      long timeToSpeak)
Called by GlassRoom chat client when a user starts to speak in the current voice room of bot.

Parameters:
user - User object
timeToSpeak - Time to speak of user. The talk button will be disabled this time.

onSpeakTimeOut

public void onSpeakTimeOut()
Called by GlassRoom chat client when the bot's time-to-speak get finished.


onStartBot

public void onStartBot()
                throws java.lang.Exception
Called by GlassRoom to indicate that bot is started. You can override this method by your own code.

java.lang.Exception

onStartTypingMessage

public void onStartTypingMessage(com.chatessentials.GlassRoom.UserMinor sender)
Called by GlassRoom chat client when a user starts typing in a private chat window.

Parameters:
sender - User who send this message

onStopBot

public void onStopBot()
Called by GlassRoom to indicate that bot is stopped. You can override this method by your own code.


onStopTypingMessage

public void onStopTypingMessage(com.chatessentials.GlassRoom.UserMinor sender)
Called by GlassRoom chat client when a user stops typing in a private chat window.

Parameters:
sender - User who send this message

onTalkStart

public void onTalkStart()
Called by GlassRoom chat client when the bot starts to record voice.


onVoiceJoin

public void onVoiceJoin(com.chatessentials.GlassRoom.UserMinor user,
                        com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when a user do voice-join to a room.

Parameters:
user - User object
room - Room object

onVoiceOff

public void onVoiceOff(com.chatessentials.GlassRoom.UserMinor user)
Called by GlassRoom chat client when a user turns his voice off.

Parameters:
user - User object

onVoiceOn

public void onVoiceOn(com.chatessentials.GlassRoom.UserMinor user)
Called by GlassRoom chat client when a user turns his voice on.

Parameters:
user - User object

onVoicePart

public void onVoicePart(com.chatessentials.GlassRoom.UserMinor user,
                        com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when a user do voice-part from a room.

Parameters:
user - User object
room - Room object

onYouBan

public void onYouBan(com.chatessentials.GlassRoom.UserMinor banner)
Called by GlassRoom chat client when the bot is banned.

Parameters:
banner - User who ban

onYouJoin

public void onYouJoin(com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when the bot enters a room.

Parameters:
room - Room

onYouPart

public void onYouPart(com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when the bot leaves a room.

Parameters:
room - Room

onYourProfile

public void onYourProfile()
Called by GlassRoom chat client when the chat server accepts your profile change


onYouVoiceJoin

public void onYouVoiceJoin(com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when the bot do voice-join (listen) to a room

Parameters:
room - Room

onYouVoicePart

public void onYouVoicePart(com.chatessentials.GlassRoom.ChannelMinor room)
Called by GlassRoom chat client when the bot do voice-part from a room.

Parameters:
room -

run

public final void run()
Specified by:
run in interface java.lang.Runnable

sendPrivateMessage

public void sendPrivateMessage(java.lang.String mess,
                               java.lang.String nick)
Use this method to send private messages to a user.

Parameters:
mess - Message to be sent
nick - Nickname of target user

sendPrivateMessage

public void sendPrivateMessage(java.lang.String mess,
                               java.lang.String nick,
                               java.lang.String url)
Use this method to send public messages with URL. When users click on this message a browser window will be opened pointing to this URL.

Parameters:
mess - Message to be sent
nick - Nickname of target user
url - URL address of the page

sendPublicMessage

public void sendPublicMessage(java.lang.String mess)
Use this method to send public messages to the current room.

Parameters:
mess - Message to be send.

sendPublicMessage

public void sendPublicMessage(java.lang.String mess,
                              java.lang.String url)
Use this method to send public messages with URL. When users click on this message a browser window will be opened pointing to this URL.

Parameters:
mess - Message to be sent
url - URL address of the page

sendRaw

public void sendRaw(java.lang.String str)
Use this method to send raw messages to server. In this case you must compose the message yourself.

Parameters:
str - String to be send to server.
See Also:

setDebugMode

public void setDebugMode(boolean b)
You may set 'debugMode' variable to switch the bot to debug mode. Some useful mesages and alerts will be printed in System.out to help you to debug your bot

Parameters:
b - Turns on/off the debug mode.

start

public void start()
Called internally to start bot thread. Use startBot() method to start bot. Don't call this method directly or override it.


startBot

public final void startBot()
                    throws BotException,
                           java.lang.Exception
This method is called by GlassRoom to start the bot. initBot(java.net.InetAddress, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, int, int) must be called to initialize the bot before this method.

BotException
java.lang.Exception

stop

public void stop()
Called internally to stop bot thread. Use stopBot() method to stop bot. Don't call this method directly or override it.


stopBot

public final void stopBot()
This method is called by GlassRoom to stop the bot.