org.eclipse.ecf.presence.im
Interface IChat

All Superinterfaces:
org.eclipse.core.runtime.IAdaptable

public interface IChat
extends org.eclipse.core.runtime.IAdaptable

A two-person chat. Instances are created via IChatManager.createChat(ID, org.eclipse.ecf.presence.IIMMessageListener).


Method Summary
 IChatRoomContainer createChatRoomContainer()
          Create a new IChatRoomContainer instance from this chat.
 void dispose()
          Dispose this chat, making it incapable of receiving any more messages or being the source of any more messages.
 IPresenceContainerAdapter getPresenceContainerAdapter()
          Get presence container adapter for this chat instance.
 ID getReceiverID()
          Get the receiver for this chat.
 ID getThreadID()
          Get the thread ID for this chat.
 void sendChatMessage(IChatMessage.Type type, java.lang.String subject, java.lang.String messageBody, java.util.Map properties)
          Send chat message to receiver.
 void sendChatMessage(java.lang.String messageBody)
          Send chat message to receiver.
 void sendTypingMessage(boolean isTyping, java.lang.String body)
          Send typing message to a remote receiver.
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Method Detail

getReceiverID

ID getReceiverID()
Get the receiver for this chat.

Returns:
ID of receiver. Will not return null.

getThreadID

ID getThreadID()
Get the thread ID for this chat.

Returns:
ID of this chat thread. Will not return null.

sendChatMessage

void sendChatMessage(IChatMessage.Type type,
                     java.lang.String subject,
                     java.lang.String messageBody,
                     java.util.Map properties)
                     throws ECFException
Send chat message to receiver.

Parameters:
type - the IChatMessage.Type of the message. May not be null.
subject - the subject of the message. May be null.
messageBody - the body of the message to send. May be null.
properties - any properties to be associated with message. May be null.
Throws:
ECFException - thrown if currently disconnected or some transport error

sendChatMessage

void sendChatMessage(java.lang.String messageBody)
                     throws ECFException
Send chat message to receiver.

Parameters:
messageBody - the body of the message to send. May be null.
Throws:
ECFException - thrown if disconnected or some transport error.

sendTypingMessage

void sendTypingMessage(boolean isTyping,
                       java.lang.String body)
                       throws ECFException
Send typing message to a remote receiver.

Parameters:
isTyping - true if user is typing, false if they've stopped typing.
body - the content of what has been/is being typed. May be null.
Throws:
ECFException - thrown if disconnected or some other communications error.

createChatRoomContainer

IChatRoomContainer createChatRoomContainer()
                                           throws ContainerCreateException
Create a new IChatRoomContainer instance from this chat. This method can be used to convert this two-way chat into an n-way chat room. If not supported by the provider, this method should return null.

If supported by the provider, this allows moving from a two-way chat represented by this IChat instance to an n-way chat room container. The initial set of participants will be the two participants in this two way chat, and the IContainer.getConnectedID() will be non-null, and equal to getThreadID().

If this method is called succesfully (no exception and non-null instance returned) then the other participant in this IChat (i.e. identified by the getReceiverID() will be notified asynchronously via the delivery of an IChatRoomCreationEvent to the IIMMessageListener for the remote IChat instance.

Returns:
a new IChatRoomContainer instance. Will return null if underlying provider does not support this functionality.
Throws:
ContainerCreateException - if chat room container cannot be made (e.g. due to disconnection or other failure).

getPresenceContainerAdapter

IPresenceContainerAdapter getPresenceContainerAdapter()
Get presence container adapter for this chat instance.

Returns:
IPresenceContainerAdapter for this chat instance. Will not return null.

dispose

void dispose()
Dispose this chat, making it incapable of receiving any more messages or being the source of any more messages. Also results in removing any listeners associated with this chat.