org.eclipse.ecf.protocol.msn
Class ChatSession

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

public final class ChatSession
extends java.lang.Object

A ChatSession is a conversation that's held between two or more participants.

As specified by MsnClient's disconnect() method, ChatSessions are not automatically disconnected when the client itself disconnects. However, clean-up will be performed automatically when a sessionTimedOut() event occurs or when the last user has left (as checked by monitoring the contactLeft(Contact) event).

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.


Method Summary
 void addChatSessionListener(IChatSessionListener listener)
          Adds a IChatSessionListener to this session.
 void close()
           
protected  void finalize()
           
 Contact[] getParticipants()
           Note: This method will likely be modified in the future (renamed, change in return type, Contact[] <-> java.util.List, inclusion/exclusion of the current user, complete removal, etc.).
 void invite(java.lang.String userEmail)
          Invites the user with the specified email to this chat session.
 void removeChatSessionListener(IChatSessionListener listener)
          Removes a IChatSessionListener from this session.
 void sendMessage(java.lang.String message)
          Sends a message to the users connected to this chat session.
 void sendTypingNotification()
          Notifies the participants of this chat session that the current user is typing a message.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()

invite

public void invite(java.lang.String userEmail)
            throws java.io.IOException
Invites the user with the specified email to this chat session.

Parameters:
userEmail - the user's email address
Throws:
java.io.IOException - If an I/O error occurs while attempting to send the invitation to the user

getParticipants

public Contact[] getParticipants()

Note: This method will likely be modified in the future (renamed, change in return type, Contact[] <-> java.util.List, inclusion/exclusion of the current user, complete removal, etc.). Please use it at your own risk.

This method returns the Contacts that are currently participating in this ChatSession. Note that this does not include the current user.

Returns:
array of contacts that are the participants.

sendMessage

public void sendMessage(java.lang.String message)
                 throws java.io.IOException
Sends a message to the users connected to this chat session.

Parameters:
message - the message to be sent
Throws:
java.io.IOException - If an I/O occurs when sending the message to the server

sendTypingNotification

public void sendTypingNotification()
                            throws java.io.IOException
Notifies the participants of this chat session that the current user is typing a message.

Throws:
java.io.IOException - If an I/O occurs when sending the message to the server

addChatSessionListener

public void addChatSessionListener(IChatSessionListener listener)
Adds a IChatSessionListener to this session.

Parameters:
listener - the listener to be added

removeChatSessionListener

public void removeChatSessionListener(IChatSessionListener listener)
Removes a IChatSessionListener from this session.

Parameters:
listener - the listener to be removed

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable