|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object f00f.net.irc.martyr.clientstate.ClientState
public class ClientState
Maintains a list of client-related facts such as what channels we are in, who else is in the channels, what our nick is, etc.
ClientState is a critical part of martyr. To get access to events that change the client state, the framework user can subclass ClientState and then pass the subclass to the IRCConnection's constructor. Then, when a command detects a change in client state, it will call the corresponding method in the custom ClientState.
If a user of the framework wishes to grab client state information about a channel (when a user joins, when a user leaves, topic change, etc), the user can do so in a similar manner. Simply override the 'addChannel(String)' method to instantiate their own Channel subclass, and call the protected 'addChannel' method. See the addChannel method for an example.
Field Summary | |
---|---|
protected java.util.Hashtable<java.lang.String,Channel> |
channels
|
Constructor Summary | |
---|---|
ClientState()
|
Method Summary | |
---|---|
protected void |
addChannel(Channel channel)
|
void |
addChannel(java.lang.String channame)
Adds a channel to the list of channels we know about. |
Channel |
getChannel(java.lang.String chanName)
|
java.util.Enumeration |
getChannelNames()
|
java.util.Enumeration |
getChannels()
|
java.lang.String |
getName()
|
FullNick |
getNick()
|
java.lang.String |
getPass()
|
int |
getPort()
|
java.lang.String |
getServer()
|
java.lang.String |
getUser()
|
boolean |
isOnChannel(java.lang.String channel)
|
void |
removeChannel(java.lang.String channel)
Removes a channel from the state, does nothing if the channel name is invalid. |
void |
setName(java.lang.String name)
|
void |
setNick(FullNick nick)
|
void |
setPass(java.lang.String pass)
|
void |
setPort(int port)
|
void |
setServer(java.lang.String server)
|
void |
setUser(java.lang.String user)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Hashtable<java.lang.String,Channel> channels
Constructor Detail |
---|
public ClientState()
Method Detail |
---|
public void setNick(FullNick nick)
public FullNick getNick()
public void setUser(java.lang.String user)
public java.lang.String getUser()
public void setName(java.lang.String name)
public java.lang.String getName()
public java.lang.String getPass()
public void setPass(java.lang.String pass)
public void setServer(java.lang.String server)
public java.lang.String getServer()
public void setPort(int port)
public int getPort()
public void addChannel(java.lang.String channame)
Adds a channel to the list of channels we know about. If you want to supply your own Channel object, override this method with:
public void addChannel( String channame ) { addChannel( new MyChannel( channame ) ); }
channame
- Channel to add to list of channelsprotected void addChannel(Channel channel)
public Channel getChannel(java.lang.String chanName)
public void removeChannel(java.lang.String channel)
channel
- Channel to remove from listpublic boolean isOnChannel(java.lang.String channel)
public java.util.Enumeration getChannelNames()
public java.util.Enumeration getChannels()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |