|
|||||||||
| Home >> All >> org >> relayirc >> [ chatengine overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.relayirc.chatengine
Class ChatEngine

java.lang.Objectorg.relayirc.chatengine.ChatEngine
- All Implemented Interfaces:
- IChatEngine
- public class ChatEngine
- extends java.lang.Object
- implements IChatEngine
- extends java.lang.Object
Manages a connection to an IRC server and handles incoming messages by creating channel objects, routing messages to channel objects and routing events to chat engine listeners.
After you have constructed a chat engine, add a ChatEngineListener to be notified of server connection and disconnection, channel joins and parts and status messages from the engine. Connect to the chat server using the connect() method and use the sendJoin() and sendPart() commands to join and leave chat channels. When a channel is joined, your listener will be informed and you may add a ChannelListener to the channel object so that you can repond to messages, bans, kicks, etc. from that channel.
| Nested Class Summary | |
private class |
ChatEngine._ChatEngineMux
|
(package private) static interface |
ChatEngine._EngineEventNotifier
|
| Field Summary | |
private java.lang.String |
_altNick
|
private java.lang.String |
_appName
|
private java.lang.String |
_appVersion
|
private int |
_channelCount
|
private java.util.Hashtable |
_channels
|
private IRCConnection |
_connection
|
private java.lang.String |
_fullName
|
private IdentServer |
_identd
|
private java.util.Vector |
_listeners
|
private ChatEngine._ChatEngineMux |
_mux
|
private java.lang.String |
_nick
|
private ChannelSearch |
_search
|
private Server |
_server
|
private java.lang.String |
_userName
|
| Constructor Summary | |
ChatEngine(java.lang.String serverName,
int serverPort,
java.lang.String nick,
java.lang.String altNick,
java.lang.String userName,
java.lang.String fullName)
Construct a chat engine by specifying server name, server port and user logon parameters. |
|
| Method Summary | |
void |
addChatEngineListener(ChatEngineListener listener)
Add a chat engine listener. |
void |
connect()
Connect to IRC server that was specified in the constructor. |
private void |
createChannel(java.lang.String name)
|
void |
disconnect()
Disconnect from server by sending a QUIT to the server, closing the socket to the server and then waiting for the message loop thread to die. |
void |
fireStatusEvent(java.lang.String msg)
Send status message to all ChatEngineListeners. |
java.lang.String |
getAppName()
Get app name to be reported to version queries. |
java.lang.String |
getAppVersion()
Get app version to be reported to version queries. |
private Channel |
getChannel(java.lang.String name)
Returns view for specified channel, or null if there is none. |
private Channel |
getChannel(java.lang.String name,
boolean manditory)
Returns channel object specified by name, creates one if necessary. |
java.lang.String |
getNick()
Get nick name currently in use |
private boolean |
isChannelActive(java.lang.String channel)
Determine if channel view is active. |
boolean |
isConnected()
Check connection status and returns true if connected. |
boolean |
isConnecting()
Check connection status and returns true if engine is in the process of connecting |
private void |
notifyListeners(ChatEngine._EngineEventNotifier notifier)
|
void |
processUserInput(java.lang.String txt,
java.lang.String chan)
Processes text entered by the user within a channel. |
void |
removeChatEngineListener(ChatEngineListener listener)
Remove a chat engine listener. |
void |
sendCommand(java.lang.String str)
Send command string directly to server |
void |
sendJoin(Channel chan)
Join specified channel by sending JOIN command to IRC server, adding channel object to engine's channel collection and notifying listeners of channel join. |
void |
sendJoin(java.lang.String name)
Join specified channel by sending a JOIN command to the IRC server creating a new channel object and notifying listeners of channel join. |
void |
sendMessage(java.lang.String str,
java.lang.String chan)
Deprecated. Use Channel.privMsg() instead. |
void |
sendPart(Channel chan)
Send channel part, notify listeners and remove channel. |
void |
sendPart(java.lang.String chanName)
Send channel part, notify listeners and remove channel. |
void |
sendQuit(java.lang.String str)
Send quit message to server. |
void |
sendVersion(java.lang.String user)
Send version information to server |
void |
setAppName(java.lang.String name)
Set app name to be reported to version queries. |
void |
setAppVersion(java.lang.String version)
Set app verion to be reported to version queries. |
void |
startChannelSearch(ChannelSearch search)
Start a channel search using the specified channel search object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
_server
private Server _server
_channelCount
private int _channelCount
_nick
private java.lang.String _nick
_altNick
private java.lang.String _altNick
_userName
private java.lang.String _userName
_fullName
private java.lang.String _fullName
_connection
private IRCConnection _connection
_search
private ChannelSearch _search
_identd
private IdentServer _identd
_channels
private java.util.Hashtable _channels
_listeners
private java.util.Vector _listeners
_appName
private java.lang.String _appName
_appVersion
private java.lang.String _appVersion
_mux
private ChatEngine._ChatEngineMux _mux
| Constructor Detail |
ChatEngine
public ChatEngine(java.lang.String serverName, int serverPort, java.lang.String nick, java.lang.String altNick, java.lang.String userName, java.lang.String fullName)
- Construct a chat engine by specifying server name, server port and
user logon parameters.
| Method Detail |
notifyListeners
private void notifyListeners(ChatEngine._EngineEventNotifier notifier)
addChatEngineListener
public void addChatEngineListener(ChatEngineListener listener)
- Add a chat engine listener.
- Specified by:
addChatEngineListenerin interfaceIChatEngine
removeChatEngineListener
public void removeChatEngineListener(ChatEngineListener listener)
- Remove a chat engine listener.
- Specified by:
removeChatEngineListenerin interfaceIChatEngine
getAppName
public java.lang.String getAppName()
- Get app name to be reported to version queries.
- Specified by:
getAppNamein interfaceIChatEngine
setAppName
public void setAppName(java.lang.String name)
- Set app name to be reported to version queries.
- Specified by:
setAppNamein interfaceIChatEngine
getAppVersion
public java.lang.String getAppVersion()
- Get app version to be reported to version queries.
- Specified by:
getAppVersionin interfaceIChatEngine
setAppVersion
public void setAppVersion(java.lang.String version)
- Set app verion to be reported to version queries.
- Specified by:
setAppVersionin interfaceIChatEngine
isConnected
public boolean isConnected()
- Check connection status and returns true if connected.
- Specified by:
isConnectedin interfaceIChatEngine
isConnecting
public boolean isConnecting()
- Check connection status and returns true if engine
is in the process of connecting
- Specified by:
isConnectingin interfaceIChatEngine
getNick
public java.lang.String getNick()
- Get nick name currently in use
- Specified by:
getNickin interfaceIChatEngine
connect
public void connect()
- Connect to IRC server that was specified in the constructor.
- Specified by:
connectin interfaceIChatEngine
disconnect
public void disconnect()
- Disconnect from server by sending a QUIT to the server, closing
the socket to the server and then waiting for the message loop
thread to die.
- Specified by:
disconnectin interfaceIChatEngine
fireStatusEvent
public void fireStatusEvent(java.lang.String msg)
- Send status message to all ChatEngineListeners.
- Specified by:
fireStatusEventin interfaceIChatEngine
processUserInput
public void processUserInput(java.lang.String txt, java.lang.String chan)
- Processes text entered by the user within a channel. If the
text starts with /me, then the rest of the text is sent to the
server as an ACTION command. If the text starts with / then the
/ is stripped off and the text is sent to the server as a command.
Otherwise, the text is sent as a message.
- Specified by:
processUserInputin interfaceIChatEngine
sendCommand
public void sendCommand(java.lang.String str)
- Send command string directly to server
- Specified by:
sendCommandin interfaceIChatEngine
sendJoin
public void sendJoin(Channel chan)
- Join specified channel by sending JOIN command to IRC server,
adding channel object to engine's channel collection and notifying
listeners of channel join.
- Specified by:
sendJoinin interfaceIChatEngine
sendJoin
public void sendJoin(java.lang.String name)
- Join specified channel by sending a JOIN command to the IRC server
creating a new channel object and notifying listeners of channel join.
- Specified by:
sendJoinin interfaceIChatEngine
sendMessage
public void sendMessage(java.lang.String str, java.lang.String chan)
- Deprecated. Use Channel.privMsg() instead.
- Send a PRIVMSG message to server.
- Specified by:
sendMessagein interfaceIChatEngine
- Send a PRIVMSG message to server.
sendPart
public void sendPart(Channel chan)
- Send channel part, notify listeners and remove channel.
- Specified by:
sendPartin interfaceIChatEngine
sendPart
public void sendPart(java.lang.String chanName)
- Send channel part, notify listeners and remove channel.
- Specified by:
sendPartin interfaceIChatEngine
sendVersion
public void sendVersion(java.lang.String user)
- Send version information to server
- Specified by:
sendVersionin interfaceIChatEngine
sendQuit
public void sendQuit(java.lang.String str)
- Send quit message to server.
- Specified by:
sendQuitin interfaceIChatEngine
startChannelSearch
public void startChannelSearch(ChannelSearch search)
- Start a channel search using the specified channel search object.
- Specified by:
startChannelSearchin interfaceIChatEngine
createChannel
private void createChannel(java.lang.String name)
isChannelActive
private boolean isChannelActive(java.lang.String channel)
- Determine if channel view is active.
getChannel
private Channel getChannel(java.lang.String name)
- Returns view for specified channel, or null if there is none.
getChannel
private Channel getChannel(java.lang.String name, boolean manditory)
- Returns channel object specified by name, creates one if necessary.
|
|||||||||
| Home >> All >> org >> relayirc >> [ chatengine overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.relayirc.chatengine.ChatEngine