|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.relayirc.chatengine.Server
Manages a connection to an IRC server and handles incoming messages by creating channel objects, routing messages to channel objects and routing events to server listeners.
After you have constructed a Server, add a ServerListener to be notified of server connection and disconnection, channel joins and parts and status messages from the Server. Connect to the 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.
The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
Original Code: Relay IRC Chat ServerConstructor Summary | |
Server(java.lang.String name,
int port,
java.lang.String network,
java.lang.String title)
Construct a server by specifying server name, port, network and port. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener: not fully implemented. |
void |
addServerListener(ServerListener listener)
Add a server listener. |
void |
connect(java.lang.String nick,
java.lang.String altNick,
java.lang.String userName,
java.lang.String fullName)
Connect to IRC server that was specified in the constructor. |
void |
connect(User user)
Connect to IRC server that was specified in the constructor. |
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 ServerListeners, used internally. |
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. |
Channel |
getChannel(java.lang.String name)
Returns view for specified channel, or null if there is none. |
Channel |
getChannel(java.lang.String name,
boolean force)
Returns channel object specified by name, creates one if necessary. |
java.lang.String |
getDescription()
Get object's description. |
java.lang.String |
getName()
Host name of server. |
java.lang.String |
getNetwork()
|
java.lang.String |
getNick()
Get nick name currently in use |
int |
getPort()
Get default port: first port in port array. |
int[] |
getPorts()
Get port array. |
java.lang.String |
getTitle()
|
boolean |
isConnected()
Check connection status and returns true if connected. |
boolean |
isConnecting()
Check connection status and returns true if server is in the process of connecting. |
boolean |
isFavorite()
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener: not fully implemented. |
void |
removeServerListener(ServerListener listener)
Remove a server 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 server'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 |
sendNick(java.lang.String nick)
Send new nick name request. |
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 |
sendPrivateMessage(java.lang.String chan,
java.lang.String message)
Send private message. |
void |
sendQuit(java.lang.String str)
Send quit message to server. |
void |
sendVersion(java.lang.String user)
Send version information to server |
void |
sendWhoIs(java.lang.String nick)
Send WHIOS for user specified by nick name. |
void |
sendWhoIs(User user)
Send WHIOS for user specified by User object, object will be updated when WHOIS information is received. |
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 |
setDescription(java.lang.String desc)
Set object's description. |
void |
setFavorite(boolean fave)
|
void |
setName(java.lang.String name)
|
void |
setNetwork(java.lang.String network)
|
void |
setPort(int port)
Set default port: first port in port array. |
void |
setPorts(int[] ports)
Set port array. |
void |
setTitle(java.lang.String title)
|
void |
startChannelSearch(ChannelSearch search)
Start a channel search using the specified channel search object. |
java.lang.String |
toString()
String representation for display purposes. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Server(java.lang.String name, int port, java.lang.String network, java.lang.String title)
name
- IRC chat server hostname (e.g. irc.mindspring.com).port
- Default IRC server port (e.g. 6667).network
- Name of server's network (e.g. EFNet)desc
- Title or display name of server.Method Detail |
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getAppName()
public void setAppName(java.lang.String name)
public java.lang.String getAppVersion()
public void setAppVersion(java.lang.String version)
public boolean isConnected()
public boolean isConnecting()
public java.lang.String getDescription()
IChatObject
getDescription
in interface IChatObject
public void setDescription(java.lang.String desc)
IChatObject
setDescription
in interface IChatObject
public boolean isFavorite()
public void setFavorite(boolean fave)
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getNetwork()
public void setNetwork(java.lang.String network)
public java.lang.String getNick()
public int getPort()
public void setPort(int port)
public int[] getPorts()
public void setPorts(int[] ports)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void addServerListener(ServerListener listener)
public void removeServerListener(ServerListener listener)
public void connect(java.lang.String nick, java.lang.String altNick, java.lang.String userName, java.lang.String fullName)
public void connect(User user)
public void disconnect()
public void startChannelSearch(ChannelSearch search)
public void sendCommand(java.lang.String str)
public void sendPrivateMessage(java.lang.String chan, java.lang.String message)
chan
- Channel name or user name that is target of message.message
- The message to be sent.public void sendJoin(Channel chan)
public void sendJoin(java.lang.String name)
public void sendNick(java.lang.String nick)
public void sendPart(Channel chan)
public void sendPart(java.lang.String chanName)
public void sendVersion(java.lang.String user)
public void sendQuit(java.lang.String str)
public void sendWhoIs(java.lang.String nick)
public void sendWhoIs(User user)
public void fireStatusEvent(java.lang.String msg)
public Channel getChannel(java.lang.String name)
public Channel getChannel(java.lang.String name, boolean force)
name
- Name of channel.force
- Force creation of channel if it does not exist.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |