wtalk.protocols
Interface WTalkProtocol

All Known Implementing Classes:
PMSProtocol

public interface WTalkProtocol

Generic interface for protocols supported by WTalk.


Method Summary
 void addBuddy(java.lang.String buddy, java.lang.String group)
          Adds a buddy to a "Buddy List" stored or managed by either ther server or WTalk, as opposed to the shell.
 void changePassword(java.lang.String oldpwd, java.lang.String newpwd)
          Changes the password that will be used for future authentication attempts for the user.
 void chatList(java.lang.String room)
          Requests information on a chat, room, or all chats on the server [system].
 void chatMessage(java.lang.String room, java.lang.String data)
          Sends a message to all members in room.
 void connect()
          Connects to a preset server and port.
 void connect(java.lang.String login)
          Overloaded to set user name to 'login', and then connects to a preset server and port.
 void connect(java.lang.String server, int port)
          Overloaded to connects to a specified server and port--and remembers these values so that connect() will use them.
 void connect(java.lang.String server, int port, java.lang.String login)
          Overloaded to set user name to 'login' and then connects to a specified server and port--and remembers these values so that connect() will use them.
 void disconnect(java.lang.String msg)
          Disconnects if the WTalkProtocol is connected.
 java.lang.String getName()
          Returns the user's name (handle) understood by the current connection.
 java.lang.String getServer()
          Returns the name of the current server that connect() will use.
 int getServerPort()
          Returns current Port; the last port set by setServerPort().
 boolean isConnected()
          Returns whether the WTalkProtocol object has an active connection.
 void joinChat(java.lang.String room)
          Joins chat room.
 void partChat(java.lang.String room)
          Leaves (parts) chat room.
 void removeBuddy(java.lang.String buddy, java.lang.String group)
          Removes a buddy from a "Buddy List" stored or managed by either the server or WTalk, as opposed to the shell.
 void sendMessage(java.lang.String to, java.lang.String data)
          Sends a "normal" text message, data.
 void sendRaw(java.lang.String msg)
          Sends an "unformatted" or "raw" message.
 void sendWall(java.lang.String msg)
          Sends a brodcast (wall) message to all users.
 void setAutoMessageHandler(wtalk.RMsgHandler r)
          Sets handler for automated messages.
 void setAway(java.lang.String message)
          Sets away status and messages, or removes away status.
 void setBan(java.lang.String user, boolean banned)
          Sets or removes a ban on user.
 void setChatMessageHandler(wtalk.RMsgHandler r)
          Sets message handler for chat mesages.
 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)
          Sets message handler for private messages.
 void setReceivedMessageHandler(wtalk.RMsgHandler r)
          Sets default message handler.
 void setServer(java.lang.String server)
          Sets the server to use when connect() is called.
 void setServerPort(int port)
          Sets the port to use when connecting to a host.
 void setSystemMessageHandler(wtalk.RMsgHandler r)
          Sets message handler for system messages.
 void setTopic(java.lang.String room, java.lang.String topic)
          Sets or retrieves the topic of room.
 void setUserListHandler(wtalk.IUserList ul)
          WTalk requires some file to handle lists of users, known as "Buddy Lists".
 void setWallMessageHandler(wtalk.RMsgHandler r)
          Sets message handler for global brodcasts (walls).
 void whois(java.lang.String user)
          Requests information on "who is <user>".
 

Method Detail

setReceivedMessageHandler

public void setReceivedMessageHandler(wtalk.RMsgHandler r)
Sets default message handler.

See Also:
RMsgHandler

setChatMessageHandler

public void setChatMessageHandler(wtalk.RMsgHandler r)
Sets message handler for chat mesages.

See Also:
RMsgHandler

setPrivateMessageHandler

public void setPrivateMessageHandler(wtalk.RMsgHandler r)
Sets message handler for private messages.

See Also:
RMsgHandler

setWallMessageHandler

public void setWallMessageHandler(wtalk.RMsgHandler r)
Sets message handler for global brodcasts (walls).

See Also:
RMsgHandler

setSystemMessageHandler

public void setSystemMessageHandler(wtalk.RMsgHandler r)
Sets message handler for system messages.

See Also:
RMsgHandler

setAutoMessageHandler

public void setAutoMessageHandler(wtalk.RMsgHandler r)
Sets handler for automated messages.

See Also:
RMsgHandler

setUserListHandler

public void setUserListHandler(wtalk.IUserList ul)
WTalk requires some file to handle lists of users, known as "Buddy Lists". This class must implement IUserList, though it need not actually do anything with the the information provided.

Parameters:
ul - Class which manages User Lists.
See Also:
IUserList

sendRaw

public void sendRaw(java.lang.String msg)
Sends an "unformatted" or "raw" message.

What this means on a protocol-to-protocol basis varies, though for text-based protocols it is generally the message by itself.


connect

public void connect()
             throws java.io.IOException
Connects to a preset server and port.

Throws:
java.io.IOException - Throws excetption if it cannot connect to the host; for example, invalid hostname or no service running.

connect

public void connect(java.lang.String login)
             throws java.io.IOException
Overloaded to set user name to 'login', and then connects to a preset server and port.

Throws:
java.io.IOException - Throws excetption if it cannot connect to the host; for example, invalid hostname or no service running.

connect

public void connect(java.lang.String server,
                    int port)
             throws java.io.IOException
Overloaded to connects to a specified server and port--and remembers these values so that connect() will use them.

Throws:
java.io.IOException - Throws excetption if it cannot connect to the host; for example, invalid hostname or no service running.

connect

public void connect(java.lang.String server,
                    int port,
                    java.lang.String login)
             throws java.io.IOException
Overloaded to set user name to 'login' and then connects to a specified server and port--and remembers these values so that connect() will use them.

Throws:
java.io.IOException - Throws excetption if it cannot connect to the host; for example, invalid hostname or no service running.

disconnect

public void disconnect(java.lang.String msg)
Disconnects if the WTalkProtocol is connected.


isConnected

public boolean isConnected()
Returns whether the WTalkProtocol object has an active connection.

Returns:
Returns true if the WTalkProtocol has an active connection.

setName

public void setName(java.lang.String name)
Sets the user's name for the active connection to name

Parameters:
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.

getName

public java.lang.String getName()
Returns the user's name (handle) understood by the current connection.

Returns:
The user's current handle on this connection.

setPassword

public void setPassword(java.lang.String passwd)
Sets the password the connection will use to authenticate.

Note: this is not the same as changePassword.

Parameters:
passwd - Password to use to authenticate.

changePassword

public void changePassword(java.lang.String oldpwd,
                           java.lang.String newpwd)
Changes the password that will be used for future authentication attempts for the user.

Parameters:
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.

setServer

public void setServer(java.lang.String server)
Sets the server to use when connect() is called.

This function SHOULD NOT attempt to connect.

Parameters:
server - Host that connect() will connect to.

getServer

public java.lang.String getServer()
Returns the name of the current server that connect() will use. This is often the server we are connected to but may not be if setServer() has been called since we have connected.

Returns:
Name of current server WTalkProtocol has stored.

setServerPort

public void setServerPort(int port)
Sets the port to use when connecting to a host.

Parameters:
port - Port number to use when connecting.

If port==0, then the protocol should use a "Default" port.


getServerPort

public int getServerPort()
Returns current Port; the last port set by setServerPort(). Note that this may return 0, indicating the default port is being used.

Returns:
The current Port stored by the WTalkProtocol.

sendMessage

public void sendMessage(java.lang.String to,
                        java.lang.String data)
Sends a "normal" text message, data.

Parameters:
to - Target of message.
data - Message contents.

whois

public void whois(java.lang.String user)
Requests information on "who is <user>".

Parameters:
user - Name of user to requst information on.

addBuddy

public void addBuddy(java.lang.String buddy,
                     java.lang.String group)
Adds a buddy to a "Buddy List" stored or managed by either ther server or WTalk, as opposed to the shell.

Parameters:
buddy - Buddy's name to be added.
group - Group to which Buddy will be added.

removeBuddy

public void removeBuddy(java.lang.String buddy,
                        java.lang.String group)
Removes a buddy from a "Buddy List" stored or managed by either the server or WTalk, as opposed to the shell.

Parameters:
buddy - Buddy's which will be removed.
group - Group from which Buddy will be removed.

setAway

public void setAway(java.lang.String message)
Sets away status and messages, or removes away status.

Parameters:
message - Sets message as away message. if message is null, away status is removed.

joinChat

public void joinChat(java.lang.String room)
Joins chat room.

Parameters:
room - Name of chat to join.

partChat

public void partChat(java.lang.String room)
Leaves (parts) chat room.

Parameters:
room - Name of chat to part.

chatMessage

public void chatMessage(java.lang.String room,
                        java.lang.String data)
Sends a message to all members in room.

Parameters:
room - The room to which a message is sent.
data - The contents of the message.

setTopic

public void setTopic(java.lang.String room,
                     java.lang.String topic)
Sets or retrieves the topic of room.

Parameters:
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.

chatList

public void chatList(java.lang.String room)
Requests information on a chat, room, or all chats on the server [system].

Parameters:
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).

sendWall

public void sendWall(java.lang.String msg)
Sends a brodcast (wall) message to all users.

Parameters:
msg - The message to brodcast.

setBan

public void setBan(java.lang.String user,
                   boolean banned)
Sets or removes a ban on user.

Parameters:
user - The user with whose bannedness we are concerned.
banned - A true value bans user, false unbans uer.