public abstract class AbstractOperationSetBasicInstantMessaging extends java.lang.Object implements OperationSetBasicInstantMessaging
OperationSetBasicInstantMessaging
in order to make it easier for
implementers to provide complete solutions while focusing on
implementation-specific details.Modifier and Type | Class and Description |
---|---|
(package private) static class |
AbstractOperationSetBasicInstantMessaging.MessageEventType |
DEFAULT_MIME_ENCODING, DEFAULT_MIME_TYPE, HTML_MIME_TYPE
Constructor and Description |
---|
AbstractOperationSetBasicInstantMessaging() |
Modifier and Type | Method and Description |
---|---|
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(byte[] content,
java.lang.String contentType,
java.lang.String encoding,
java.lang.String subject)
Create a Message instance for sending arbitrary MIME-encoding content.
|
Message |
createMessage(java.lang.String messageText)
Create a Message instance for sending a simple text messages with default
(text/plain) content type and encoding.
|
abstract Message |
createMessage(java.lang.String content,
java.lang.String contentType,
java.lang.String encoding,
java.lang.String subject)
Create a Message instance for sending arbitrary MIME-encoding content.
|
Message |
createMessageWithUID(java.lang.String messageText,
java.lang.String contentType,
java.lang.String messageUID)
Create a Message instance with the specified UID, content type
and a default encoding.
|
protected void |
fireMessageDelivered(Message message,
Contact to)
Notifies all registered message listeners that a message has been
delivered successfully to its addressee..
|
protected void |
fireMessageDeliveryFailed(Message message,
Contact to,
int errorCode) |
protected void |
fireMessageEvent(java.util.EventObject evt)
Delivers the specified event to all registered message listeners.
|
protected void |
fireMessageReceived(Message message,
Contact from)
Notifies all registered message listeners that a message has been
received.
|
long |
getInactivityTimeout()
Returns the inactivity timeout in milliseconds.
|
boolean |
isContentTypeSupported(java.lang.String contentType,
Contact contact)
Determines whether the protocol supports the supplied content type
for the given contact.
|
MessageDeliveredEvent[] |
messageDeliveryPendingTransform(MessageDeliveredEvent evt)
Messages pending delivery to be transformed.
|
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,
ContactResource toResource,
Message message)
Sends the message to the destination indicated by the
to.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isContentTypeSupported, isOfflineMessagingSupported, sendInstantMessage
public AbstractOperationSetBasicInstantMessaging()
public void addMessageListener(MessageListener listener)
addMessageListener
in interface OperationSetBasicInstantMessaging
listener
- the MessageListener to register.public Message createMessage(byte[] content, java.lang.String contentType, java.lang.String encoding, java.lang.String subject)
content
- content valuecontentType
- the MIME-type for contentencoding
- encoding used for contentsubject
- a String subject or null for now
subject.public Message createMessage(java.lang.String messageText)
createMessage
in interface OperationSetBasicInstantMessaging
messageText
- the string content of the message.public Message createMessageWithUID(java.lang.String messageText, java.lang.String contentType, java.lang.String messageUID)
createMessageWithUID
in interface OperationSetBasicInstantMessaging
messageText
- the string content of the message.contentType
- the MIME-type for contentmessageUID
- the unique identifier of this message.public abstract Message createMessage(java.lang.String content, java.lang.String contentType, java.lang.String encoding, java.lang.String subject)
OperationSetBasicInstantMessaging
createMessage
in interface OperationSetBasicInstantMessaging
content
- content valuecontentType
- the MIME-type for contentencoding
- encoding used for contentsubject
- a String subject or null for now
subject.protected void fireMessageDelivered(Message message, Contact to)
message
- the Message that has been delivered.to
- the Contact that message was delivered to.protected void fireMessageDeliveryFailed(Message message, Contact to, int errorCode)
protected void fireMessageEvent(java.util.EventObject evt)
evt
- the EventObject that we'd like delivered to all
registered message listeners.protected void fireMessageReceived(Message message, Contact from)
message
- the Message that has been received.from
- the Contact that message was received from.public void removeMessageListener(MessageListener listener)
removeMessageListener
in interface OperationSetBasicInstantMessaging
listener
- the MessageListener to unregister.public MessageDeliveredEvent[] messageDeliveryPendingTransform(MessageDeliveredEvent evt)
evt
- the message delivery eventpublic boolean isContentTypeSupported(java.lang.String contentType, Contact contact)
isContentTypeSupported
in interface OperationSetBasicInstantMessaging
contentType
- the type we want to checkcontact
- contact which is checked for supported contentTypepublic void sendInstantMessage(Contact to, ContactResource toResource, Message message) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
sendInstantMessage
in interface OperationSetBasicInstantMessaging
to
- the Contact to send message totoResource
- the resource to which the message should be sendmessage
- the Message to send.java.lang.IllegalStateException
- if the underlying ICQ stack is
not registered and initialized.java.lang.IllegalArgumentException
- if to is not an
instance belonging to the underlying implementation.public long getInactivityTimeout()
getInactivityTimeout
in interface OperationSetBasicInstantMessaging
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.