public interface ChatMessage
ChatRoom
ChatMessage
, use ChatRoom.createEmptyMessage()
, thenaddUtf8TextContent(java.lang.String)
or a Content
withaddFileContent(org.linphone.core.Content)
. A valid Content
forsend()
to send it.ChatMessage
, you need to have configured a fileCore.setFileTransferServer(java.lang.String)
. On the receivingdownloadContent(org.linphone.core.Content)
to download received files or enableCore
using Core.setMaxSizeForAutoDownloadIncomingFiles(int)
ChatMessage
created by a ChatRoomBackend.Basic
ChatRoom
can only contain one Content
, either text or file. Modifier and Type | Interface and Description |
---|---|
static class |
ChatMessage.Direction |
static class |
ChatMessage.State |
Modifier and Type | Method and Description |
---|---|
void |
addContent(Content content)
Adds a content to the ChatMessage.
|
void |
addCustomHeader(java.lang.String headerName,
java.lang.String headerValue)
Add custom headers to the message.
|
void |
addFileContent(Content content)
Adds a file content to the ChatMessage.
|
void |
addListener(ChatMessageListener listener) |
void |
addTextContent(java.lang.String text)
Deprecated.
01/07/2020. Use
addUtf8TextContent(java.lang.String) instead. |
void |
addUtf8TextContent(java.lang.String text)
Creates a
Content of type PlainText with the given text as body. |
void |
cancelFileTransfer()
Cancel an ongoing file transfer attached to this message.
|
boolean |
downloadContent(Content content)
|
java.lang.String |
getAppdata()
Linphone message has an app-specific field that can store a text.
|
java.lang.String |
getCallId()
Gets the callId accociated with the message.
|
ChatRoom |
getChatRoom()
Returns the chatroom this message belongs to.
|
Content[] |
getContents()
Returns the list of contents in the message.
|
java.lang.String |
getContentType()
Get the content type of a chat message.
|
Core |
getCore()
Returns back pointer to
Core object. |
java.lang.String |
getCustomHeader(java.lang.String headerName)
Retrieve a custom header value given its name.
|
long |
getEphemeralExpireTime()
Returns the real time at which an ephemeral message expires and will be
deleted. |
long |
getEphemeralLifetime()
Returns lifetime of an ephemeral message.
|
ErrorInfo |
getErrorInfo()
Get full details about delivery error of a chat message.
|
java.lang.String |
getExternalBodyUrl()
Linphone message can carry external body as defined by rfc2017.
|
Content |
getFileTransferInformation()
Get the file_transfer_information (used by call backs to recover informations
during a rcs file transfer) |
java.lang.String |
getForwardInfo()
Gets the forward info if available as a string.
|
Address |
getFromAddress()
Get origin of the message.
|
Address |
getLocalAddress()
Returns the local address the message was sent or received with.
|
java.lang.String |
getMessageId()
Get the message identifier.
|
long |
getNativePointer()
Gets the native pointer used by this class to make native method calls.
|
ParticipantImdnState[] |
getParticipantsByImdnState(ChatMessage.State state)
Gets the list of participants for which the imdn state has reached the
specified state and the time at which they did. |
ChatMessage.State |
getState()
Get the state of the message.
|
java.lang.String |
getTextContent()
Deprecated.
01/07/2020. Use
getUtf8Text() instead. |
long |
getTime()
Get the time the message was sent.
|
Address |
getToAddress()
Get destination of the message.
|
boolean |
getToBeStored()
Get if a chat message is to be stored.
|
java.lang.Object |
getUserData()
Gets the object stored in this object user's data
|
java.lang.String |
getUtf8Text()
Get text part of this message.
|
boolean |
hasTextContent()
Deprecated.
27/10/2020. Check if
getContents() contains a Content for which it's content type is PlainText. |
boolean |
isEphemeral()
Returns wether the chat message is an ephemeral message or not.
|
boolean |
isFileTransfer()
Deprecated.
06/07/2020 check if
getContents() contains a Content for which Content.isFileTransfer() returns true. |
boolean |
isFileTransferInProgress()
Gets whether or not a file is currently being downloaded or uploaded.
|
boolean |
isForward()
Returns wether the chat message is a forward message or not.
|
boolean |
isOutgoing()
Returns wehther the message has been sent or received.
|
boolean |
isRead()
Returns wether the message has been read or not.
|
boolean |
isSecured()
Get if the message was encrypted when transfered.
|
boolean |
isText()
Deprecated.
06/07/2020 check if
getContents() contains a Content with a PlainText content type. |
int |
putChar(int character)
Fulfill a chat message char by char.
|
void |
removeContent(Content content)
Removes a content from the ChatMessage.
|
void |
removeCustomHeader(java.lang.String headerName)
Removes a custom header from the message.
|
void |
removeListener(ChatMessageListener listener) |
void |
send()
Send a chat message.
|
void |
setAppdata(java.lang.String data)
Linphone message has an app-specific field that can store a text.
|
void |
setContentType(java.lang.String contentType)
Set the content type of a chat message.
|
void |
setExternalBodyUrl(java.lang.String externalBodyUrl)
Linphone message can carry external body as defined by rfc2017.
|
void |
setListener(ChatMessageListener listener) |
void |
setToBeStored(boolean toBeStored)
Set if a chat message is to be stored.
|
void |
setUserData(java.lang.Object data)
Sets the object to store in this object user's data
|
int |
setUtf8Text(java.lang.String text)
Set a chat message text to be sent by linphone_chat_room_send_message.
|
java.lang.String |
toString() |
@Nullable java.lang.String getAppdata()
void setAppdata(@Nullable java.lang.String data)
data
- the data to store into the message. @NonNull java.lang.String getCallId()
@NonNull ChatRoom getChatRoom()
ChatRoom
in which this message has been sent or received. @NonNull java.lang.String getContentType()
void setContentType(@NonNull java.lang.String contentType)
contentType
- The new content type of the chat message @NonNull Content[] getContents()
Content
. long getEphemeralExpireTime()
long getEphemeralLifetime()
isEphemeral()
@NonNull ErrorInfo getErrorInfo()
ErrorInfo
describing the details. @Nullable java.lang.String getExternalBodyUrl()
void setExternalBodyUrl(@Nullable java.lang.String externalBodyUrl)
externalBodyUrl
- ex: access-type=URL; URL="http://www.foo.com/file" @Nullable Content getFileTransferInformation()
Content
structure or null if not present. @Nullable java.lang.String getForwardInfo()
@NonNull Address getFromAddress()
Address
of the sender. boolean isEphemeral()
@Deprecated boolean isFileTransfer()
getContents()
contains a Content
Content.isFileTransfer()
returns true. boolean isFileTransferInProgress()
boolean isForward()
boolean isOutgoing()
boolean isRead()
boolean isSecured()
@Deprecated boolean isText()
getContents()
contains a Content
@NonNull Address getLocalAddress()
Address
of the local address used to send/receive this@NonNull java.lang.String getMessageId()
ChatMessage.State getState()
ChatMessage.State
of the message. @Deprecated @Nullable java.lang.String getTextContent()
getUtf8Text()
instead. Content
buffer if available in System Locale, nulllong getTime()
@NonNull Address getToAddress()
Address
of the recipient. boolean getToBeStored()
void setToBeStored(boolean toBeStored)
toBeStored
- Whether or not the chat message is to be stored @Nullable java.lang.String getUtf8Text()
int setUtf8Text(@Nullable java.lang.String text)
text
- The text in UTF8 to set. void addContent(@NonNull Content content)
content
- the Content
object to add. void addCustomHeader(@NonNull java.lang.String headerName, @Nullable java.lang.String headerValue)
headerName
- name of the header headerValue
- header value void addFileContent(@NonNull Content content)
content
- the Content
object to add. @Deprecated void addTextContent(@NonNull java.lang.String text)
addUtf8TextContent(java.lang.String)
instead. text
- The text in System Locale to add to the message. void addUtf8TextContent(@NonNull java.lang.String text)
text
- The text in UTF8 to add to the message. void cancelFileTransfer()
boolean downloadContent(@NonNull Content content)
content
- the Content
object to download (must have the Content.isFileTransfer()
@Nullable java.lang.String getCustomHeader(@NonNull java.lang.String headerName)
headerName
- header name searched @NonNull ParticipantImdnState[] getParticipantsByImdnState(ChatMessage.State state)
state
- The LinphoneChatMessageState the imdn have reached (only use@Deprecated boolean hasTextContent()
getContents()
contains a Content
int putChar(int character)
character
- T.140 char void removeContent(@NonNull Content content)
content
- the Content
object to remove. void removeCustomHeader(@NonNull java.lang.String headerName)
headerName
- name of the header to remove void send()
void addListener(ChatMessageListener listener)
void removeListener(ChatMessageListener listener)
void setListener(ChatMessageListener listener)
void setUserData(java.lang.Object data)
data
- the object to storejava.lang.Object getUserData()
long getNativePointer()
java.lang.String toString()
toString
in class java.lang.Object