com.limegroup.gnutella.chat
Class InstantMessenger

java.lang.Object
  extended bycom.limegroup.gnutella.chat.InstantMessenger
All Implemented Interfaces:
Chatter

public class InstantMessenger
extends java.lang.Object
implements Chatter

this class is a subclass of Chat, also implementing Chatter interface. it is a one-to-one instant message style chat implementation.


Constructor Summary
InstantMessenger(java.net.Socket socket, ChatManager manager, ActivityCallback callback)
          constructor for an incoming chat request
InstantMessenger(java.lang.String host, int port, ChatManager manager, ActivityCallback callback)
          constructor for an outgoing chat request
 
Method Summary
 void blockHost(java.lang.String host)
           
 java.lang.String getHost()
          returns the host name to which the socket is connected
 java.lang.String getMessage()
           
 int getPort()
          returns the port to which the socket is connected
 void readHeader()
          Reads the header information from the chat request.
 void send(java.lang.String message)
          send a message accross the socket to the other host as with stop, this is alway safe to call, but it is recommended that the gui discourage the user from calling it when a connection is not yet established.
 void start()
          starts the chatting
 void stop()
          stop the chat, and close the connections this is always safe to call, but it is recommended that the gui try to encourage the user not to call this
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InstantMessenger

public InstantMessenger(java.net.Socket socket,
                        ChatManager manager,
                        ActivityCallback callback)
                 throws java.io.IOException
constructor for an incoming chat request


InstantMessenger

public InstantMessenger(java.lang.String host,
                        int port,
                        ChatManager manager,
                        ActivityCallback callback)
                 throws java.io.IOException
constructor for an outgoing chat request

Method Detail

start

public void start()
starts the chatting


stop

public void stop()
stop the chat, and close the connections this is always safe to call, but it is recommended that the gui try to encourage the user not to call this

Specified by:
stop in interface Chatter

send

public void send(java.lang.String message)
send a message accross the socket to the other host as with stop, this is alway safe to call, but it is recommended that the gui discourage the user from calling it when a connection is not yet established.

Specified by:
send in interface Chatter

getHost

public java.lang.String getHost()
returns the host name to which the socket is connected

Specified by:
getHost in interface Chatter

getPort

public int getPort()
returns the port to which the socket is connected

Specified by:
getPort in interface Chatter

getMessage

public java.lang.String getMessage()
Specified by:
getMessage in interface Chatter

blockHost

public void blockHost(java.lang.String host)
Specified by:
blockHost in interface Chatter

readHeader

public void readHeader()
                throws java.io.IOException
Reads the header information from the chat request. At the moment, the header information is pretty useless

Throws:
java.io.IOException