Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol
Interface OperationSetBasicInstantMessaging

All Superinterfaces:
OperationSet
All Known Implementing Classes:
AbstractOperationSetBasicInstantMessaging, MockBasicInstantMessaging, OperationSetBasicInstantMessagingDictImpl, OperationSetBasicInstantMessagingGibberishImpl, OperationSetBasicInstantMessagingIcqImpl, OperationSetBasicInstantMessagingJabberImpl, OperationSetBasicInstantMessagingMsnImpl, OperationSetBasicInstantMessagingRssImpl, OperationSetBasicInstantMessagingSipImpl, OperationSetBasicInstantMessagingSSHImpl, OperationSetBasicInstantMessagingYahooImpl, OperationSetBasicInstantMessagingZeroconfImpl

public interface OperationSetBasicInstantMessaging
extends OperationSet

Provides basic functionality for sending and receiving InstantMessages.

Author:
Emil Ivov

Field Summary
static String DEFAULT_MIME_ENCODING
          Default encoding for outgoing messages.
static String DEFAULT_MIME_TYPE
          Default mime type for outgoing messages.
static String HTML_MIME_TYPE
          HTML mime type for use with messages using html.
 
Method Summary
 void addMessageListener(MessageListener listener)
          Registers a MessageListener with this operation set so that it gets notifications of successful message delivery, failure or reception of incoming messages.
 Message createMessage(String messageText)
          Create a Message instance for sending a simple text messages with default (text/plain) content type and encoding.
 Message createMessage(String content, String contentType, String contentEncoding, String subject)
          Create a Message instance for sending arbitrary MIME-encoding content.
 boolean isContentTypeSupported(String contentType)
          Determines whether the protocol supports the supplied content type
 boolean isContentTypeSupported(String contentType, Contact contact)
          Determines whether the protocol supports the supplied content type for the given contact.
 boolean isOfflineMessagingSupported()
          Determines whether the protocol provider (or the protocol itself) support sending and receiving offline messages.
 void removeMessageListener(MessageListener listener)
          Unregisters listener so that it won't receive any further notifications upon successful message delivery, failure or reception of incoming messages.
 void sendInstantMessage(Contact to, Message message)
          Sends the message to the destination indicated by the to contact.
 

Field Detail

DEFAULT_MIME_ENCODING

static final String DEFAULT_MIME_ENCODING
Default encoding for outgoing messages.

See Also:
Constant Field Values

DEFAULT_MIME_TYPE

static final String DEFAULT_MIME_TYPE
Default mime type for outgoing messages.

See Also:
Constant Field Values

HTML_MIME_TYPE

static final String HTML_MIME_TYPE
HTML mime type for use with messages using html.

See Also:
Constant Field Values
Method Detail

createMessage

Message createMessage(String content,
                      String contentType,
                      String contentEncoding,
                      String subject)
Create a Message instance for sending arbitrary MIME-encoding content.

Parameters:
content - content value
contentType - the MIME-type for content
contentEncoding - encoding used for content
subject - a String subject or null for now subject.
Returns:
the newly created message.

createMessage

Message createMessage(String messageText)
Create a Message instance for sending a simple text messages with default (text/plain) content type and encoding.

Parameters:
messageText - the string content of the message.
Returns:
Message the newly created message

sendInstantMessage

void sendInstantMessage(Contact to,
                        Message message)
                        throws IllegalStateException,
                               IllegalArgumentException
Sends the message to the destination indicated by the to contact.

Parameters:
to - the Contact to send message to
message - the Message to send.
Throws:
IllegalStateException - if the underlying ICQ stack is not registered and initialized.
IllegalArgumentException - if to is not an instance belonging to the underlying implementation.

addMessageListener

void addMessageListener(MessageListener listener)
Registers a MessageListener with this operation set so that it gets notifications of successful message delivery, failure or reception of incoming messages.

Parameters:
listener - the MessageListener to register.

removeMessageListener

void removeMessageListener(MessageListener listener)
Unregisters listener so that it won't receive any further notifications upon successful message delivery, failure or reception of incoming messages.

Parameters:
listener - the MessageListener to unregister.

isOfflineMessagingSupported

boolean isOfflineMessagingSupported()
Determines whether the protocol provider (or the protocol itself) support sending and receiving offline messages. Most often this method would return true for protocols that support offline messages and false for those that don't. It is however possible for a protocol to support these messages and yet have a particular account that does not (i.e. feature not enabled on the protocol server). In cases like this it is possible for this method to return true even when offline messaging is not supported, and then have the sendMessage method throw an OperationFailedException with code OFFLINE_MESSAGES_NOT_SUPPORTED.

Returns:
true if the protocol supports offline messages and false otherwise.

isContentTypeSupported

boolean isContentTypeSupported(String contentType)
Determines whether the protocol supports the supplied content type

Parameters:
contentType - the type we want to check
Returns:
true if the protocol supports it and false otherwise.

isContentTypeSupported

boolean isContentTypeSupported(String contentType,
                               Contact contact)
Determines whether the protocol supports the supplied content type for the given contact.

Parameters:
contentType - the type we want to check
contact - contact which is checked for supported contentType
Returns:
true if the contact supports it and false otherwise.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.