org.eclipse.ecf.protocol.msn
Class MsnClient

java.lang.Object
  extended by org.eclipse.ecf.protocol.msn.MsnClient

public final class MsnClient
extends java.lang.Object

The MsnClient class allows a developer to easily create a client that will authenticate the user and establish a connection with the MSN servers.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Constructor Summary
MsnClient()
          Instantiate a new MsnClient that defaults to setting the user as being online and available when signing in.
MsnClient(Status initialStatus)
          Instantiate a new MsnClient that set the user to the specified status when signing in.
 
Method Summary
 void addSessionListener(ISessionListener listener)
          Add an ISessionListener to this client.
 void connect(java.lang.String userEmail, java.lang.String password)
          Connects the client to the MSN servers.
 ChatSession createChatSession(java.lang.String email)
          Creates a ChatSession to connect to the specified contact.
 void disconnect()
          Disconnects the user from the MSN servers.
 ContactList getContactList()
          Returns the contact list that is associated with this client.
 java.lang.String getDisplayName()
          Returns the displayed name of this user.
 java.lang.String getPersonalMessage()
          Retrieves the user's current personal message.
 Status getStatus()
          Returns the status that the user is currently in.
 java.lang.String getUserEmail()
          Returns the user's account's email address.
 void removeSessionListener(ISessionListener listener)
          Removes an ISessionListener from this client.
 void setDisplayName(java.lang.String newName)
          Sets the display name of this user.
 void setPersonalMessage(java.lang.String personalMessage)
          Sets the user's personal message to the specified string.
 void setStatus(Status status)
          Changes the user's status to the provided status flag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MsnClient

public MsnClient()
Instantiate a new MsnClient that defaults to setting the user as being online and available when signing in.


MsnClient

public MsnClient(Status initialStatus)
Instantiate a new MsnClient that set the user to the specified status when signing in.

Parameters:
initialStatus - the status that a user would like to sign on to the servers as, refer to Status.ONLINE and other static variables for the available options.
Method Detail

connect

public void connect(java.lang.String userEmail,
                    java.lang.String password)
             throws java.io.IOException
Connects the client to the MSN servers.

Parameters:
userEmail - the user's email address that is associated with an MSN account
password - the email's corresponding password
Throws:
java.io.IOException - If an I/O error occurred while connecting to the dispatch or notification servers.

disconnect

public void disconnect()
Disconnects the user from the MSN servers. Please note that any ChatSessions that may have been created since the client was instantiated are not disconnected automatically in this method.


setStatus

public void setStatus(Status status)
               throws java.io.IOException
Changes the user's status to the provided status flag.

Parameters:
status - the status that the user wishes to change to
Throws:
java.io.IOException - if some problem setting status (e.g. disconnected).

getStatus

public Status getStatus()
Returns the status that the user is currently in.

Returns:
the user's current status

getContactList

public ContactList getContactList()
Returns the contact list that is associated with this client.

Returns:
this client's contact list

createChatSession

public ChatSession createChatSession(java.lang.String email)
                              throws java.io.IOException
Creates a ChatSession to connect to the specified contact.

Parameters:
email - the contact to connect to
Returns:
the created ChatSession
Throws:
java.io.IOException - If an I/O error occurred

setDisplayName

public void setDisplayName(java.lang.String newName)
                    throws java.io.IOException
Sets the display name of this user.

Parameters:
newName - the new name of this user
Throws:
java.io.IOException

getDisplayName

public java.lang.String getDisplayName()
Returns the displayed name of this user.

Returns:
the name that this user is using

getUserEmail

public java.lang.String getUserEmail()
Returns the user's account's email address.

Returns:
the email address the user is using for MSN login

setPersonalMessage

public void setPersonalMessage(java.lang.String personalMessage)
                        throws java.io.IOException
Sets the user's personal message to the specified string.

Parameters:
personalMessage - the new message to use as the user's personal message
Throws:
java.io.IOException - If an I/O error occurred while sending the data to the notification server

getPersonalMessage

public java.lang.String getPersonalMessage()
Retrieves the user's current personal message.

Returns:
the personal message that the user is currently using

addSessionListener

public void addSessionListener(ISessionListener listener)
Add an ISessionListener to this client.

Parameters:
listener - the listener to be added

removeSessionListener

public void removeSessionListener(ISessionListener listener)
Removes an ISessionListener from this client.

Parameters:
listener - the listener to be removed