|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--wtalk.protocols.pms.PMSProtocol
Field Summary | |
protected java.io.DataInputStream |
mDis
|
protected java.io.DataOutputStream |
mDos
|
protected java.net.Socket |
mSock
|
static java.lang.String |
PMS_NAME
|
Constructor Summary | |
PMSProtocol()
Constructor |
Method Summary | |
void |
addBuddy(java.lang.String buddy,
java.lang.String group)
Adds a buddy to "group" on a list maintained on the server. |
void |
changePassword(java.lang.String oldpwd,
java.lang.String newpwd)
Dummy function needed to implement WTalkProtocol. |
void |
chatList(java.lang.String room)
Dummy function needed to implement WTalkProtocol. |
void |
chatMessage(java.lang.String room,
java.lang.String data)
Dummy function needed to implement WTalkProtocol. |
void |
connect()
Connects to the server |
void |
connect(java.lang.String login)
Connects to the server |
void |
connect(java.lang.String server,
int port)
Connects to the server |
void |
connect(java.lang.String server,
int port,
java.lang.String login)
Connect to the server |
void |
createTestBuddyList()
Function with which to test buddy list functionality. |
void |
disconnect(java.lang.String msg)
Dummy function needed to implement WTalkProtocol. |
java.lang.String |
getConnectionName()
Returns a connection name for use with user lists. |
java.lang.String |
getName()
Returns the user's name (handle) understood by the current connection. |
java.lang.String |
getServer()
Returns name of current server. |
int |
getServerPort()
Gets the current server port |
boolean |
isConnected()
Returns true if there is an active connection, false otherwise. |
void |
joinChat(java.lang.String room)
Dummy function needed to implement WTalkProtocol. |
void |
partChat(java.lang.String room)
Dummy function needed to implement WTalkProtocol. |
void |
removeBuddy(java.lang.String buddy,
java.lang.String group)
Removes a buddy from "group" on a list maintained on the server. |
protected void |
sendBuddyListCmd(java.io.DataOutputStream dos,
java.lang.String grp,
java.lang.String user,
int version,
int msgType)
Send the server buddy list management commands. |
void |
sendMessage(java.io.DataOutputStream dos,
java.lang.String to,
java.lang.String data,
int version,
java.util.Vector recipients,
java.lang.String chatID)
Sends a message from one user to another. |
void |
sendMessage(java.lang.String to,
java.lang.String data)
Wrapper function for the sendMessage function called below. |
void |
sendRaw(java.lang.String msg)
Dummy function needed to implement WTalkProtocol. |
protected void |
sendSignOn(java.io.DataOutputStream dos,
java.lang.String name,
java.lang.String password,
int version)
Send a message to the server with the user's name and password indicating they wish to logon to the system. |
void |
sendSimpleMessage(java.io.DataOutputStream dos,
java.lang.String data,
int version,
int msgType)
Write out any "simple" message to the socket. |
void |
sendStatusInfo(java.io.DataOutputStream dos,
int version,
int msgType,
java.lang.String name,
java.lang.String phoneNum,
java.lang.String email,
java.lang.String major,
java.lang.String location,
int idle,
int away)
Send updated status info to the server. |
void |
sendWall(java.lang.String msg)
Dummy function needed to implement WTalkProtocol. |
void |
setAutoMessageHandler(wtalk.RMsgHandler r)
Implements the function defined in WTalkProtocol |
void |
setAway(java.lang.String message)
Sets or removes away message that the server will send to users who try and message us. |
void |
setBan(java.lang.String user,
boolean banned)
Implements WTalkProtocol function. |
void |
setChatMessageHandler(wtalk.RMsgHandler r)
Implements the function defined in WTalkProtocol |
void |
setName(java.lang.String name)
Sets the user's name for the active connection to name |
void |
setPassword(java.lang.String passwd)
Sets the password the connection will use to authenticate. |
void |
setPrivateMessageHandler(wtalk.RMsgHandler r)
Implements the function defined in WTalkProtocol |
void |
setReceivedMessageHandler(wtalk.RMsgHandler r)
Implements the function defined in WTalkProtocol |
void |
setServer(java.lang.String server)
Sets the server to use when connect() is called.
|
void |
setServerPort(int port)
Sets the current server port |
void |
setSystemMessageHandler(wtalk.RMsgHandler r)
Implements the function defined in WTalkProtocol |
void |
setTopic(java.lang.String room,
java.lang.String topic)
Dummy function needed to implement WTalkProtocol. |
void |
setUserListHandler(wtalk.IUserList ul)
Sets handler for manipulating the buddy list |
void |
setWallMessageHandler(wtalk.RMsgHandler r)
Implements the function defined in WTalkProtocol |
void |
whois(java.lang.String user)
Dummy function needed to implement WTalkProtocol. |
void |
writeMsgHeader(java.io.DataOutputStream dos,
int version,
int msgType,
int dataSize,
int time)
Write out the individual components of the message header. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PMS_NAME
protected java.net.Socket mSock
protected java.io.DataOutputStream mDos
protected java.io.DataInputStream mDis
Constructor Detail |
public PMSProtocol()
Method Detail |
public void writeMsgHeader(java.io.DataOutputStream dos, int version, int msgType, int dataSize, int time) throws java.io.IOException, java.lang.NumberFormatException
dos
- A DataOutputStream mapped to the socket to which the message header is to be writtenversion
- The version of the PMS protocol being usedmsgType
- A code identifying the type of message that is being written outdataSize
- The size of the data contained in the message, including an extra byte for each string to account for the null terminatortime
- The time to use to stamp the message (in ms from the epoch)
An
- IOException is thrown when there is a problem writing to the DataOutputStream.
java.io.IOException
java.lang.NumberFormatException
public java.lang.String getConnectionName()
public void setReceivedMessageHandler(wtalk.RMsgHandler r)
setReceivedMessageHandler
in interface WTalkProtocol
WTalkProtocol
public void setChatMessageHandler(wtalk.RMsgHandler r)
setChatMessageHandler
in interface WTalkProtocol
WTalkProtocol
public void setPrivateMessageHandler(wtalk.RMsgHandler r)
setPrivateMessageHandler
in interface WTalkProtocol
WTalkProtocol
public void setWallMessageHandler(wtalk.RMsgHandler r)
setWallMessageHandler
in interface WTalkProtocol
WTalkProtocol
public void setSystemMessageHandler(wtalk.RMsgHandler r)
setSystemMessageHandler
in interface WTalkProtocol
WTalkProtocol
public void setAutoMessageHandler(wtalk.RMsgHandler r)
setAutoMessageHandler
in interface WTalkProtocol
WTalkProtocol
public void setUserListHandler(wtalk.IUserList ul)
setUserListHandler
in interface WTalkProtocol
ul
- is a class that implements wtalk.IUserListIUserList
public void sendRaw(java.lang.String msg)
sendRaw
in interface WTalkProtocol
WTalkProtocol
public void connect() throws java.io.IOException
connect
in interface WTalkProtocol
java.io.IOException
- if there is an I/O errorpublic void connect(java.lang.String login) throws java.io.IOException
connect
in interface WTalkProtocol
login
- String representing login (user name)
java.io.IOException
- if there's an I/O errorpublic void connect(java.lang.String server, int port) throws java.io.IOException
connect
in interface WTalkProtocol
server
- String representing host to connect toport
- int representing port to connect to
java.io.IOException
- if there's an I/O errorpublic void connect(java.lang.String server, int port, java.lang.String login) throws java.io.IOException
connect
in interface WTalkProtocol
server
- String representing host to connect toport
- int representing port to connect tologin
- String representing login (user name)
java.io.IOException
- if there's an I/O errorpublic void disconnect(java.lang.String msg)
disconnect
in interface WTalkProtocol
WTalkProtocol
public boolean isConnected()
isConnected
in interface WTalkProtocol
WTalkProtocol
public void setName(java.lang.String name)
setName
in interface WTalkProtocol
name
- User name to request. Depending on the protocol
it is not guaranteed that this request will be granted,
or if it will even make since once connected.WTalkProtocol
public java.lang.String getName()
getName
in interface WTalkProtocol
WTalkProtocol
public void setPassword(java.lang.String passwd)
Note that this does not change the password to authenticate, and no such method is provided under the PMS protocol.
setPassword
in interface WTalkProtocol
passwd
- Password to use to authenticate.WTalkProtocol
public void changePassword(java.lang.String oldpwd, java.lang.String newpwd)
changePassword
in interface WTalkProtocol
oldpwd
- The old password, such as the one used to authenticate
with when loggin on.newpwd
- A new password, to be used in future authentication
attempts.WTalkProtocol
public void setServer(java.lang.String server)
connect()
is called.
This function does not attempt to connect.
setServer
in interface WTalkProtocol
server
- Host that connect()
will connect to.WTalkProtocol
public java.lang.String getServer()
getServer
in interface WTalkProtocol
public void setServerPort(int port)
setServerPort
in interface WTalkProtocol
port
- The port the server should run onpublic int getServerPort()
getServerPort
in interface WTalkProtocol
public void sendMessage(java.io.DataOutputStream dos, java.lang.String to, java.lang.String data, int version, java.util.Vector recipients, java.lang.String chatID) throws java.io.IOException
dos
- A DataOutputStream mapped to the socket to which the message header is to be writtento
- The name of the user to which the message should be sentdata
- The content of the message to be sentversion
- The version of the PMS protocol being usedrecipients
- A vector of Strings containing the users to whom the message should be sentchatID
- The name associated with the chat to which this message should be sent
An
- IOException is thrown when a problems occurs trying to write to the DataOutputStream
java.io.IOException
public void sendSimpleMessage(java.io.DataOutputStream dos, java.lang.String data, int version, int msgType) throws java.io.IOException
dos
- A DataOutputStream mapped to the socket to which the message header is to be writtendata
- The data with which this command is dealing (varies depending on msgType)version
- The version of the PMS protocol being usedmsgType
- A code identifying the type of message that is being written out
An
- IOException is thrown when a problems occurs trying to write to the DataOutputStream
java.io.IOException
public void sendStatusInfo(java.io.DataOutputStream dos, int version, int msgType, java.lang.String name, java.lang.String phoneNum, java.lang.String email, java.lang.String major, java.lang.String location, int idle, int away) throws java.io.IOException
dos
- A DataOutputStream mapped to the socket to which the message header is to be writtenversion
- The version of the PMS protocol being usedmsgType
- A code identifying the type of message that is being written outname
- The name of the user associated with this infophoneNum
- A String representing the phone number of the useremail
- A String representing the e-mail address of the usermajor
- A String reprsenting the name of the user's majorlocation
- A String indentifying the user's locationidle
- The user's idle time (in ms from the epoch)away
- The user's away time (in ms from the epoch)
An
- IOException is thrown when a problems occurs trying to write to the DataOutputStream
java.io.IOException
protected void sendSignOn(java.io.DataOutputStream dos, java.lang.String name, java.lang.String password, int version) throws java.io.IOException
dos
- A DataOutputStream mapped to the socket to which the message header is to be writtenname
- The name of the user trying to connect to the systempassword
- The password of the user trying to connect to the systemversion
- The version of the PMS protocol being used
An
- IOException is thrown when a problems occurs trying to write to the DataOutputStream
java.io.IOException
protected void sendBuddyListCmd(java.io.DataOutputStream dos, java.lang.String grp, java.lang.String user, int version, int msgType) throws java.io.IOException
dos
- A DataOutputStream mapped to the socket to which the message header is to be writtengrp
- The group with which the user is (to be) associateduser
- The name of the user on which to actversion
- The version of the PMS protocol being usedmsgType
- A code identifying the type of message that is being written out
An
- IOException is thrown when a problems occurs trying to write to the DataOutputStream
java.io.IOException
public void createTestBuddyList()
public void sendMessage(java.lang.String to, java.lang.String data)
sendMessage
in interface WTalkProtocol
to
- A String designating to whom the message should be sentdata
- A String containing the data (the message) to be sentpublic void whois(java.lang.String user)
whois
in interface WTalkProtocol
user
- Name of user to requst information on.WTalkProtocol
public void addBuddy(java.lang.String buddy, java.lang.String group)
addBuddy
in interface WTalkProtocol
buddy
- Name of buddy to add.group
- Name of group buddy is to be added to.public void removeBuddy(java.lang.String buddy, java.lang.String group)
removeBuddy
in interface WTalkProtocol
buddy
- Name of buddy to remove.group
- Name of group buddy is to be removed from.public void setAway(java.lang.String message)
setAway
in interface WTalkProtocol
message
- The message to send when users contact us, or null
to not send any message (removes away status).public void joinChat(java.lang.String room)
joinChat
in interface WTalkProtocol
room
- Name of chat to join.WTalkProtocol
public void partChat(java.lang.String room)
partChat
in interface WTalkProtocol
room
- Name of chat to part.WTalkProtocol
public void chatMessage(java.lang.String room, java.lang.String data)
chatMessage
in interface WTalkProtocol
room
- The room to which a message is sent.data
- The contents of the message.WTalkProtocol
public void setTopic(java.lang.String room, java.lang.String topic)
setTopic
in interface WTalkProtocol
room
- Room whose topic we are concerned.topic
- If not null, the topic which will be
set in room. If null, a request
to receive the current topic is sent.WTalkProtocol
public void chatList(java.lang.String room)
chatList
in interface WTalkProtocol
room
- The chat which we would like information.
A null value indicates a request for all active chats
if this is permitted by the protocol (it may not be).WTalkProtocol
public void sendWall(java.lang.String msg)
sendWall
in interface WTalkProtocol
msg
- The message to brodcast.WTalkProtocol
public void setBan(java.lang.String user, boolean banned)
setBan
in interface WTalkProtocol
user
- User whose banned state we are concerned.banned
- If true, user is banned, otherwise
banned status is removed.WTalkProtocol
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |