|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvooga.network.VoogaClient
vooga.network.chat.VoogaChatClient
public class VoogaChatClient
VoogaChatClients handle all server connection and chat communications. This can be used to send/receive messages, create/join chatrooms, etc.
Field Summary | |
---|---|
static long |
ACHIEVEMENT_CHANNEL
|
static java.lang.String |
CONNECT
|
static java.lang.String |
DISCONNECT
|
static long |
ERROR_CHANNEL
|
static long |
FRIEND_UPDATE_CHANNEL
|
static java.lang.String |
ONLINE
|
static long |
PERSONAL_ECHO_CHANNEL
|
static long |
PERSONAL_MESSAGE_CHANNEL
|
static long |
SYSTEM_CHANNEL
|
Constructor Summary | |
---|---|
VoogaChatClient(java.lang.String userName,
IVoogaChatReceiver receiver)
|
|
VoogaChatClient(java.lang.String userName,
IVoogaChatReceiver receiver,
java.util.List<java.lang.String> friends)
Creates a VoogaChatClient that listens to the given list of friends. |
Method Summary | |
---|---|
void |
addFriend(java.lang.String userName)
Adds the specified userName as a friend. |
void |
addFriends(java.util.List<java.lang.String> userNames)
Adds the list of friends provided by userNames. |
void |
connect(java.net.InetAddress host)
Connects to the server. |
java.util.List<java.lang.Long> |
getChannels()
Used to determine the channels the client currently occupies. |
boolean |
inChannel(long channelID)
Used to check if currently in a channel. |
protected void |
initializeConnection()
Performs any necessary set-up for a new connection. |
void |
joinChannel(long channelID)
Join the specified channel. |
void |
leaveChannel(long channelID)
Leave the specified channel |
void |
run()
Background thread runs this and outputs messages from server as they are received. |
void |
sendMessage(long channelID,
java.lang.String message)
Sends a message to the specified channel |
void |
sendPersonalMessage(java.lang.String userName,
java.lang.String message)
Sends a personal message to the specified user. |
Methods inherited from class vooga.network.VoogaClient |
---|
allowConnection, blockConnection, connect, connect, disconnect, getMyInputStream, getMyName, getMyOutputStream, getMySocket, isConnected, setConnected, setMyName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long PERSONAL_MESSAGE_CHANNEL
public static final long SYSTEM_CHANNEL
public static final long ACHIEVEMENT_CHANNEL
public static final long ERROR_CHANNEL
public static final long PERSONAL_ECHO_CHANNEL
public static final long FRIEND_UPDATE_CHANNEL
public static final java.lang.String DISCONNECT
public static final java.lang.String CONNECT
public static final java.lang.String ONLINE
Constructor Detail |
---|
public VoogaChatClient(java.lang.String userName, IVoogaChatReceiver receiver)
userName
- The name of the user connected through this client.receiver
- Used to send back messages from the server. If receiver is null,
received chat messages just get printed to System.out. You probably
do not want this.public VoogaChatClient(java.lang.String userName, IVoogaChatReceiver receiver, java.util.List<java.lang.String> friends)
userName
- receiver
- friends
- Method Detail |
---|
public void joinChannel(long channelID)
channelID
- the unique channel ID
java.io.IOException
public void leaveChannel(long channelID)
channelID
- the unique channel ID
java.io.IOException
public void run()
public void sendMessage(long channelID, java.lang.String message)
channelID
- the unique ID of the channel to send tomessage
- the message being sent
java.io.IOException
public void sendPersonalMessage(java.lang.String userName, java.lang.String message)
userName
- the name of the user to send a message tomessage
-
java.io.IOException
protected void initializeConnection()
VoogaClient
initializeConnection
in class VoogaClient
public void connect(java.net.InetAddress host)
connect
in class VoogaClient
host
- The IP of an existing VoogaChatServer.public java.util.List<java.lang.Long> getChannels()
public boolean inChannel(long channelID)
channelID
-
public void addFriends(java.util.List<java.lang.String> userNames)
userNames
- public void addFriend(java.lang.String userName)
userName
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |