Class ChatMessage
An chat message is the object that is sent or received through a ChatRoom.
To create a ChatMessage, use
CreateEmptyMessage(), then either add text using
Inherited Members
Namespace: Linphone
Assembly: cs.temp.dll.dll
Syntax
public class ChatMessage : LinphoneObject
Properties
Appdata
Linphone message has an app-specific field that can store a text.
The application might want to use it for keeping data over restarts, like thumbnail image path.
Declaration
public string Appdata { get; set; }
Property Value
Type | Description |
---|---|
System.String | the application-specific data or null if none has been stored. |
CallId
Gets the callId accociated with the message.
Declaration
public string CallId { get; }
Property Value
Type | Description |
---|---|
System.String | the call Id |
ChatRoom
Returns the chatroom this message belongs to.
Declaration
public ChatRoom ChatRoom { get; }
Property Value
Type | Description |
---|---|
ChatRoom | the ChatRoom in which this message has been sent or received. |
Contents
Returns the list of contents in the message.
Declaration
public IEnumerable<Content> Contents { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Content> | The list of Content. |
ContentType
Get the content type of a chat message.
Declaration
public string ContentType { get; set; }
Property Value
Type | Description |
---|---|
System.String | The content type of the chat message |
Core
Returns back pointer to Core object.
Declaration
public Core Core { get; }
Property Value
Type | Description |
---|---|
Core | the Core object associated with this message. |
CurrentCallbacks
Gets the current LinphoneChatMessageCbs.
This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneChatMessageCbs that is calling the callback.
Declaration
public ChatMessageListener CurrentCallbacks { get; }
Property Value
Type | Description |
---|---|
ChatMessageListener | The LinphoneChatMessageCbs that has called the last callback. |
EphemeralExpireTime
Returns the real time at which an ephemeral message expires and will be deleted.
Declaration
public long EphemeralExpireTime { get; }
Property Value
Type | Description |
---|---|
System.Int64 | the time at which an ephemeral message expires. 0 means the message has not been read. |
Remarks
See : IsEphemeral
EphemeralLifetime
Returns lifetime of an ephemeral message.
The lifetime is the duration after which the ephemeral message will disappear once viewed.
Declaration
public int EphemeralLifetime { get; }
Property Value
Type | Description |
---|---|
System.Int32 | the lifetime of an ephemeral message, by default 86400s. |
Remarks
See : IsEphemeral
ErrorInfo
Get full details about delivery error of a chat message.
Declaration
public ErrorInfo ErrorInfo { get; }
Property Value
Type | Description |
---|---|
ErrorInfo | a ErrorInfo describing the details. |
ExternalBodyUrl
Linphone message can carry external body as defined by rfc2017.
Declaration
public string ExternalBodyUrl { get; set; }
Property Value
Type | Description |
---|---|
System.String | external body url or null if not present. |
FileTransferInformation
Get the file_transfer_information (used by call backs to recover informations during a rcs file transfer)
Declaration
public Content FileTransferInformation { get; }
Property Value
Type | Description |
---|---|
Content | a pointer to the Content structure or null if not present. |
ForwardInfo
Gets the forward info if available as a string.
Declaration
public string ForwardInfo { get; }
Property Value
Type | Description |
---|---|
System.String | the original sender of the message if it has been forwarded, null otherwise. |
FromAddress
Get origin of the message.
Declaration
public Address FromAddress { get; }
Property Value
Type | Description |
---|---|
Address | the Address of the sender. |
IsEphemeral
Returns wether the chat message is an ephemeral message or not.
An ephemeral message will automatically disappear from the recipient's screen after the message has been viewed.
Declaration
public bool IsEphemeral { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if it is an ephemeral message, false otherwise |
IsFileTransfer
Return whether or not a chat message is a file transfer.
Declaration
public bool IsFileTransfer { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Whether or not the message is a file transfer |
IsFileTransferInProgress
Gets whether or not a file is currently being downloaded or uploaded.
Declaration
public bool IsFileTransferInProgress { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if download or upload is in progress, false otherwise |
IsForward
Returns wether the chat message is a forward message or not.
Declaration
public bool IsForward { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if it is a forward message, false otherwise |
IsOutgoing
Returns wehther the message has been sent or received.
Declaration
public bool IsOutgoing { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if message has been sent, false if it has been received. |
IsRead
Returns wether the message has been read or not.
Declaration
public bool IsRead { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if message has been marked as read, false otherwise. |
IsSecured
Get if the message was encrypted when transfered.
Declaration
public bool IsSecured { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true if the message was encrypted when transfered, false otherwise. |
IsText
Return whether or not a chat message is a text.
Declaration
public bool IsText { get; }
Property Value
Type | Description |
---|---|
System.Boolean | Whether or not the message is a text |
Listener
Declaration
public ChatMessageListener Listener { get; }
Property Value
Type | Description |
---|---|
ChatMessageListener |
LocalAddress
Returns the local address the message was sent or received with.
Declaration
public Address LocalAddress { get; }
Property Value
Type | Description |
---|---|
Address | the Address of the local address used to send/receive this message. |
MessageId
Get the message identifier.
It is used to identify a message so that it can be notified as delivered and/or displayed.
Declaration
public string MessageId { get; }
Property Value
Type | Description |
---|---|
System.String | The message identifier. |
State
Get the state of the message.
Declaration
public ChatMessageState State { get; }
Property Value
Type | Description |
---|---|
ChatMessageState | the current ChatMessageState of the message. |
TextContent
Gets the text content if available as a string.
Declaration
public string TextContent { get; }
Property Value
Type | Description |
---|---|
System.String | the Content buffer if available in System Locale, null otherwise. |
Time
Get the time the message was sent.
Declaration
public long Time { get; }
Property Value
Type | Description |
---|---|
System.Int64 | the timestamp of when the message was sent. |
ToAddress
Get destination of the message.
Declaration
public Address ToAddress { get; }
Property Value
Type | Description |
---|---|
Address | the Address of the recipient. |
ToBeStored
Get if a chat message is to be stored.
Declaration
public bool ToBeStored { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Whether or not the message is to be stored |
Utf8Text
Get text part of this message.
Introduced in 01/07/2020
Declaration
public string Utf8Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | The text in UTF8 or null if no text. |
Methods
AddContent(Content)
Adds a content to the ChatMessage.
Declaration
public void AddContent(Content content)
Parameters
Type | Name | Description |
---|---|---|
Content | content | the Content object to add. |
AddCustomHeader(String, String)
Add custom headers to the message.
Declaration
public void AddCustomHeader(string headerName, string headerValue)
Parameters
Type | Name | Description |
---|---|---|
System.String | headerName | name of the header |
System.String | headerValue | header value |
AddFileContent(Content)
Adds a file content to the ChatMessage.
Declaration
public void AddFileContent(Content content)
Parameters
Type | Name | Description |
---|---|---|
Content | content | the Content object to add. |
AddTextContent(String)
Creates a Content of type PlainText with the given text as body.
Declaration
public void AddTextContent(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text in System Locale to add to the message. |
AddUtf8TextContent(String)
Creates a Content of type PlainText with the given text as body.
Introduced in 01/07/2020
Declaration
public void AddUtf8TextContent(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text in UTF8 to add to the message. |
CancelFileTransfer()
Cancel an ongoing file transfer attached to this message.
(upload or download)
Declaration
public void CancelFileTransfer()
DownloadContent(Content)
Start the download of the Content referenced in the ChatMessage from remote server.
Declaration
public bool DownloadContent(Content content)
Parameters
Type | Name | Description |
---|---|---|
Content | content | the Content object to download (must have the IsFileTransfer method return true). |
Returns
Type | Description |
---|---|
System.Boolean | false if there is an error, true otherwise. |
Finalize()
Declaration
protected void Finalize()
GetCustomHeader(String)
Retrieve a custom header value given its name.
Declaration
public string GetCustomHeader(string headerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | headerName | header name searched |
Returns
Type | Description |
---|---|
System.String | the custom header value or null if not found. |
GetParticipantsByImdnState(ChatMessageState)
Gets the list of participants for which the imdn state has reached the specified state and the time at which they did.
Declaration
public IEnumerable<ParticipantImdnState> GetParticipantsByImdnState(ChatMessageState state)
Parameters
Type | Name | Description |
---|---|---|
ChatMessageState | state | The LinphoneChatMessageState the imdn have reached (only use LinphoneChatMessageStateDelivered, LinphoneChatMessageStateDeliveredToUser, LinphoneChatMessageStateDisplayed and LinphoneChatMessageStateNotDelivered) |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<ParticipantImdnState> | The list of participants. |
HasTextContent()
Returns wether the chat message has a text content or not.
Declaration
public bool HasTextContent()
Returns
Type | Description |
---|---|
System.Boolean | true if it has one, false otherwise. |
PutChar(UInt32)
Fulfill a chat message char by char.
Message linked to a Real Time Text Call send char in realtime following RFC 4103/T.140 To commit a message, use linphone_chat_room_send_message
Declaration
public void PutChar(uint character)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | character | T.140 char |
RemoveContent(Content)
Removes a content from the ChatMessage.
Declaration
public void RemoveContent(Content content)
Parameters
Type | Name | Description |
---|---|---|
Content | content | the Content object to remove. |
RemoveCustomHeader(String)
Removes a custom header from the message.
Declaration
public void RemoveCustomHeader(string headerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | headerName | name of the header to remove |
Send()
Send a chat message.
Declaration
public void Send()