org.gimec.msnj
Class Connection

java.lang.Object
  |
  +--org.gimec.msnj.Connection

public class Connection
extends java.lang.Object

The Connection class is the heart of library. This is where you login, send messages, etc.


Constructor Summary
Connection()
           
 
Method Summary
 void addContact(java.lang.String handle)
          Add the specified user to the forward list.
 void addListener(ConnectionListener listener)
          Add a listener to this list of listeners.
 void allowContact(java.lang.String handle)
          Add the specified user to the allow list.
 void blockContact(java.lang.String handle)
          Add the specified user to the block list.
 void changeState(UserState state)
          Change the user's state.
 void endChat(java.lang.String handle)
          Close the Connection to the specified user.
 java.util.List getAllowList()
          Returns a copy of the allow list.
 java.util.List getBlockList()
          Returns a copy of the block list.
 java.lang.String getCommonName()
           
 java.util.List getForwardList()
          Returns a copy of the forward list.
 java.lang.String getHandle()
           
 java.util.List getReverseList()
          Returns a copy of the reverse list.
 UserState getState()
           
 void login(java.lang.String handle, java.lang.String passwd)
          Logs in to the default server.
 void login(java.lang.String handle, java.lang.String passwd, java.lang.String host)
          Logs into the specified server.
 void login(java.lang.String handle, java.lang.String passwd, java.lang.String host, int port)
          Logs into the specified server.
 void logout()
          Log out.
 void removeContact(java.lang.String handle)
          Remove the specified user from a forward list.
 void removeListener(ConnectionListener listener)
          Remove a listener from the list of listeners.
 void sendMessage(java.lang.String handle, MimeMessage message)
          Send a message to the specified user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Connection

public Connection()
Method Detail

login

public void login(java.lang.String handle,
                  java.lang.String passwd)
           throws ConnectionException
Logs in to the default server.

login

public void login(java.lang.String handle,
                  java.lang.String passwd,
                  java.lang.String host)
           throws ConnectionException
Logs into the specified server.

login

public void login(java.lang.String handle,
                  java.lang.String passwd,
                  java.lang.String host,
                  int port)
           throws ConnectionException
Logs into the specified server.

sendMessage

public void sendMessage(java.lang.String handle,
                        MimeMessage message)
                 throws ConnectionException
Send a message to the specified user.

addContact

public void addContact(java.lang.String handle)
                throws ConnectionException
Add the specified user to the forward list.

removeContact

public void removeContact(java.lang.String handle)
                   throws ConnectionException
Remove the specified user from a forward list.

allowContact

public void allowContact(java.lang.String handle)
                  throws ConnectionException
Add the specified user to the allow list.

blockContact

public void blockContact(java.lang.String handle)
                  throws ConnectionException
Add the specified user to the block list.

endChat

public void endChat(java.lang.String handle)
             throws ConnectionException
Close the Connection to the specified user.

logout

public void logout()
            throws ConnectionException
Log out.

changeState

public void changeState(UserState state)
                 throws ConnectionException
Change the user's state.

getForwardList

public java.util.List getForwardList()
Returns a copy of the forward list. Note, changes to this list will not be reflected elsewhere. You must use the addContact, removeContact methods.

getReverseList

public java.util.List getReverseList()
Returns a copy of the reverse list. Note, changes to this list will not be reflected elsewhere.

getAllowList

public java.util.List getAllowList()
Returns a copy of the allow list. Note, changes to this list will not be reflected elsewhere. You must use the allowContact, blockContact methods.

getBlockList

public java.util.List getBlockList()
Returns a copy of the block list. Note, changes to this list will not be reflected elsewhere. You must use the allowContact, blockContact methods.

getHandle

public java.lang.String getHandle()

getCommonName

public java.lang.String getCommonName()

getState

public UserState getState()

addListener

public void addListener(ConnectionListener listener)
Add a listener to this list of listeners.

removeListener

public void removeListener(ConnectionListener listener)
Remove a listener from the list of listeners.