public class MetaContactChatTransport extends java.lang.Object implements ChatTransport, ContactPresenceStatusListener
Constructor and Description |
---|
MetaContactChatTransport(MetaContactChatSession chatSession,
Contact contact)
Creates an instance of MetaContactChatTransport by specifying
the parent chatSession and the contact associated with
the transport.
|
MetaContactChatTransport(MetaContactChatSession chatSession,
Contact contact,
ContactResource contactResource,
boolean isDisplayResourceOnly)
Creates an instance of MetaContactChatTransport by specifying
the parent chatSession and the contact associated with
the transport.
|
Modifier and Type | Method and Description |
---|---|
void |
addInstantMessageListener(MessageListener l)
Adds an instant message listener to this chat transport.
|
void |
addSmsMessageListener(MessageListener l)
Adds an SMS message listener to this chat transport.
|
boolean |
allowsFileTransfer()
Returns
true if this chat transport supports file transfer,
otherwise returns false . |
boolean |
allowsInstantMessage()
Returns
true if this chat transport supports instant
messaging, otherwise returns false . |
boolean |
allowsMessageCorrections()
Returns
true if this chat transport supports message
corrections and false otherwise. |
boolean |
allowsSmsMessage()
Returns
true if this chat transport supports sms
messaging, otherwise returns false . |
boolean |
allowsTypingNotifications()
Returns
true if this chat transport supports typing
notifications, otherwise returns false . |
boolean |
askForSMSNumber()
Whether a dialog need to be opened so the user can enter the destination
number.
|
void |
contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt)
Indicates that a contact has changed its status.
|
void |
correctInstantMessage(java.lang.String message,
java.lang.String mimeType,
java.lang.String correctedMessageUID)
Sends message as a message correction through this transport,
specifying the mime type (html or plain text) and the id of the
message to replace.
|
void |
dispose()
Removes all previously added listeners.
|
Contact |
getContact()
Returns the contact associated with this transport.
|
java.lang.Object |
getDescriptor()
Returns the descriptor of this chat transport.
|
java.lang.String |
getDisplayName()
Returns the display name corresponding to this chat transport.
|
long |
getMaximumFileLength()
Returns the maximum file length supported by the protocol in bytes.
|
java.lang.String |
getName()
Returns the contact address corresponding to this chat transport.
|
ChatSession |
getParentChatSession()
Returns the parent session of this chat transport.
|
ProtocolProviderService |
getProtocolProvider()
Returns the ProtocolProviderService, corresponding to this chat
transport.
|
java.lang.String |
getResourceName()
Returns the resource name of this chat transport.
|
PresenceStatus |
getStatus()
Returns the presence status of this transport.
|
void |
inviteChatContact(java.lang.String contactAddress,
java.lang.String reason)
Invites a contact to join this chat.
|
boolean |
isContentTypeSupported(java.lang.String contentType)
Determines whether this chat transport supports the supplied content type
|
boolean |
isDisplayResourceOnly()
Indicates if the display name should only show the resource.
|
void |
removeInstantMessageListener(MessageListener l)
Removes the instant message listener from this chat transport.
|
void |
removeSmsMessageListener(MessageListener l)
Removes the given sms message listener from this chat transport.
|
FileTransfer |
sendFile(java.io.File file)
Sends the given file through this chat transport file transfer operation
set.
|
void |
sendInstantMessage(java.lang.String message,
java.lang.String mimeType)
Sends the given instant message through this chat transport,
by specifying the mime type (html or plain text).
|
FileTransfer |
sendMultimediaFile(java.io.File file)
Sends the given SMS multimedia message trough this chat transport,
leaving the transport to choose the destination.
|
void |
sendSmsMessage(java.lang.String message)
Sends the given sms message trough this chat transport.
|
void |
sendSmsMessage(java.lang.String phoneNumber,
java.lang.String messageText)
Sends the given sms message trough this chat transport.
|
int |
sendTypingNotification(int typingState)
Sends a typing notification state.
|
public MetaContactChatTransport(MetaContactChatSession chatSession, Contact contact)
chatSession
- the parent ChatSessioncontact
- the Contact associated with this transportpublic MetaContactChatTransport(MetaContactChatSession chatSession, Contact contact, ContactResource contactResource, boolean isDisplayResourceOnly)
chatSession
- the parent ChatSessioncontact
- the Contact associated with this transportcontactResource
- the ContactResource associated with the
contactisDisplayResourceOnly
- indicates if only the resource name should
be displayedpublic Contact getContact()
public java.lang.String getName()
getName
in interface ChatTransport
public java.lang.String getDisplayName()
getDisplayName
in interface ChatTransport
public java.lang.String getResourceName()
getResourceName
in interface ChatTransport
public boolean isDisplayResourceOnly()
ChatTransport
isDisplayResourceOnly
in interface ChatTransport
public PresenceStatus getStatus()
getStatus
in interface ChatTransport
public ProtocolProviderService getProtocolProvider()
getProtocolProvider
in interface ChatTransport
public boolean allowsInstantMessage()
true
if this chat transport supports instant
messaging, otherwise returns false
.allowsInstantMessage
in interface ChatTransport
true
if this chat transport supports instant
messaging, otherwise returns false
.public boolean allowsMessageCorrections()
true
if this chat transport supports message
corrections and false otherwise.allowsMessageCorrections
in interface ChatTransport
true
if this chat transport supports message
corrections and false otherwise.public boolean allowsSmsMessage()
true
if this chat transport supports sms
messaging, otherwise returns false
.allowsSmsMessage
in interface ChatTransport
true
if this chat transport supports sms
messaging, otherwise returns false
.public boolean allowsTypingNotifications()
true
if this chat transport supports typing
notifications, otherwise returns false
.allowsTypingNotifications
in interface ChatTransport
true
if this chat transport supports typing
notifications, otherwise returns false
.public boolean allowsFileTransfer()
true
if this chat transport supports file transfer,
otherwise returns false
.true
if this chat transport supports file transfer,
otherwise returns false
.public void sendInstantMessage(java.lang.String message, java.lang.String mimeType) throws java.lang.Exception
sendInstantMessage
in interface ChatTransport
message
- The message to send.mimeType
- The mime type of the message to send: text/html or
text/plain.java.lang.Exception
- if the send operation is interruptedpublic void correctInstantMessage(java.lang.String message, java.lang.String mimeType, java.lang.String correctedMessageUID)
correctInstantMessage
in interface ChatTransport
message
- The message to send.mimeType
- The mime type of the message to send: text/html or
text/plain.correctedMessageUID
- The ID of the message being corrected by
this message.public boolean isContentTypeSupported(java.lang.String contentType)
isContentTypeSupported
in interface ChatTransport
contentType
- the type we want to checkpublic void sendSmsMessage(java.lang.String phoneNumber, java.lang.String messageText) throws java.lang.Exception
sendSmsMessage
in interface ChatTransport
phoneNumber
- phone number of the destinationmessageText
- The message to send.java.lang.Exception
- if the send operation is interruptedpublic boolean askForSMSNumber()
askForSMSNumber
in interface ChatTransport
public void sendSmsMessage(java.lang.String message) throws java.lang.Exception
sendSmsMessage
in interface ChatTransport
message
- the message to sendjava.lang.Exception
- if the send operation is interruptedpublic int sendTypingNotification(int typingState)
sendTypingNotification
in interface ChatTransport
typingState
- the typing notification state to sendpublic FileTransfer sendFile(java.io.File file) throws java.lang.Exception
sendFile
in interface ChatTransport
file
- the file to sendjava.lang.Exception
- if anything goes wrongpublic FileTransfer sendMultimediaFile(java.io.File file) throws java.lang.Exception
sendMultimediaFile
in interface ChatTransport
file
- the file to sendjava.lang.Exception
- if the send doesn't succeedpublic long getMaximumFileLength()
getMaximumFileLength
in interface ChatTransport
public void inviteChatContact(java.lang.String contactAddress, java.lang.String reason)
ChatTransport
inviteChatContact
in interface ChatTransport
contactAddress
- the address of the contact we invitereason
- the reason for the invitepublic ChatSession getParentChatSession()
getParentChatSession
in interface ChatTransport
public void addSmsMessageListener(MessageListener l)
addSmsMessageListener
in interface ChatTransport
l
- The message listener to add.public void addInstantMessageListener(MessageListener l)
addInstantMessageListener
in interface ChatTransport
l
- The message listener to add.public void removeSmsMessageListener(MessageListener l)
removeSmsMessageListener
in interface ChatTransport
l
- The message listener to remove.public void removeInstantMessageListener(MessageListener l)
removeInstantMessageListener
in interface ChatTransport
l
- The message listener to remove.public void contactPresenceStatusChanged(ContactPresenceStatusChangeEvent evt)
contactPresenceStatusChanged
in interface ContactPresenceStatusListener
evt
- The presence event containing information about the
contact status change.public void dispose()
dispose
in interface ChatTransport
public java.lang.Object getDescriptor()
getDescriptor
in interface ChatTransport
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.