Class ChatMessage
A Linphone.ChatMessage represents an instant message that can be send or received through a Linphone.ChatRoom.
To create a Linphone.ChatMessage, use
Linphone.ChatRoom.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 SIP call-id 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 Linphone.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 Linphone.Content. |
ContentType
Gets 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 Linphone.Core object.
Declaration
public Core Core { get; }
Property Value
| Type | Description |
|---|---|
| Core | the Linphone.Core object associated with this message. |
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
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 0 (disabled). |
Remarks
ErrorInfo
Gets full details about delivery error of a chat message.
Declaration
public ErrorInfo ErrorInfo { get; }
Property Value
| Type | Description |
|---|---|
| ErrorInfo | a Linphone.ErrorInfo describing the details. |
ExternalBodyUrl
Messages 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
Gets the file transfer information (used by callbacks to recover informations during a rcs file transfer)
Declaration
public Content FileTransferInformation { get; }
Property Value
| Type | Description |
|---|---|
| Content | a pointer to the Linphone.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
Gets origin of the message.
Declaration
public Address FromAddress { get; }
Property Value
| Type | Description |
|---|---|
| Address | the Linphone.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. |
IsReply
Returns wether the chat message is a reply message or not.
Declaration
public bool IsReply { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if it is a reply message, false otherwise |
IsSecured
Gets if the message was end-to-end encrypted when transferred.
Declaration
public bool IsSecured { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if the message was end-to-end encrypted when transferred, 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; set; }
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 Linphone.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. |
OwnReaction
Returns our own reaction for a given chat message, if any.
Declaration
public ChatMessageReaction OwnReaction { get; }
Property Value
| Type | Description |
|---|---|
| ChatMessageReaction | Our own Linphone.ChatMessageReaction for that message if any, null otherwise. |
PeerAddress
Returns the peer (remote) address of the message.
Declaration
public Address PeerAddress { get; }
Property Value
| Type | Description |
|---|---|
| Address | the Linphone.Address of the peer address used to send/receive this message. |
Reactions
Gets the list of reactions received for this chat message.
Warning: list is ordered by content of reaction message, not by received timestamp!
Declaration
public IEnumerable<ChatMessageReaction> Reactions { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<ChatMessageReaction> | The sorted list of reaction if any. |
ReplyMessage
Returns the Linphone.ChatMessage this message is a reply to.
Declaration
public ChatMessage ReplyMessage { get; }
Property Value
| Type | Description |
|---|---|
| ChatMessage | the original message Linphone.ChatMessage. |
ReplyMessageId
Returns the ID of the message this is a reply to.
Declaration
public string ReplyMessageId { get; }
Property Value
| Type | Description |
|---|---|
| System.String | the original message id. |
ReplyMessageSenderAddress
Returns the address of the sender of the message this is a reply to.
Declaration
public Address ReplyMessageSenderAddress { get; }
Property Value
| Type | Description |
|---|---|
| Address | the original message sender Linphone.Address. |
State
Gets the state of the message.
Declaration
public ChatMessageState State { get; }
Property Value
| Type | Description |
|---|---|
| ChatMessageState | the current Linphone.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 Linphone.Content buffer if available in System Locale, null otherwise. |
Time
Gets 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
Gets destination of the message.
Declaration
public Address ToAddress { get; }
Property Value
| Type | Description |
|---|---|
| Address | the Linphone.Address of the recipient. |
ToBeStored
Gets 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
Gets text part of this message.
Declaration
public string Utf8Text { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The text as UTF8 characters 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 Linphone.Content object to add. |
AddCustomHeader(String, String)
Adds 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 Linphone.Content object to add. |
AddTextContent(String)
Creates a Linphone.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 Linphone.Content of type text/plain with the provided string, and attach it to the message.
Declaration
public void AddUtf8TextContent(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to add to the message. |
CancelFileTransfer()
Cancels an ongoing file transfer attached to this message (upload or download).
Declaration
public void CancelFileTransfer()
CreateReaction(String)
Creates a emoji reaction for the given chat mesage.
To send it, use Linphone.ChatMessageReaction.Send().
Declaration
public ChatMessageReaction CreateReaction(string utf8Reaction)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | utf8Reaction | the emoji character(s) as UTF-8. |
Returns
| Type | Description |
|---|---|
| ChatMessageReaction | a Linphone.ChatMessageReaction object. |
DownloadContent(Content)
Starts the download of the Linphone.Content referenced in the Linphone.ChatMessage from remote server.
Declaration
public bool DownloadContent(Content content)
Parameters
| Type | Name | Description |
|---|---|---|
| Content | content | the Linphone.Content object to download (must have the Linphone.Content.IsFileTransfer() method return true). |
Returns
| Type | Description |
|---|---|
| System.Boolean | false if there is an error, true otherwise. |
DownloadContents()
Starts the download of all the Linphone.Content objects representing file transfers included in the message ( Linphone.Content.IsFileTransfer() method returns true).
Declaration
public bool DownloadContents()
Returns
| Type | Description |
|---|---|
| System.Boolean | false if there is an error, true otherwise. |
GetCustomHeader(String)
Retrieves 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. |
HasConferenceInvitationContent()
Returns wether the chat message has a conference invitation content or not.
Declaration
public bool HasConferenceInvitationContent()
Returns
| Type | Description |
|---|---|
| System.Boolean | true if it has one, false otherwise. |
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. |
MarkAsRead()
Marks the message as read.
Only triggers LinphoneChatRoomCbsChatRoomReadCb if it was the last unread message.
Declaration
public void MarkAsRead()
PutChar(UInt32)
Fulfills a chat message character by character and send the character immediately as real-time text (RFC4103 / T.140) or as Baudot tones.
The method used to send the character depends on if real-time text is enabled
or not. If it is, real-time text is of course used, otherwise Baudot will be
used if it is enabled in the Linphone.Core (see
Declaration
public void PutChar(uint character)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | character | The character to send (T.140 char for real-time text). |
RemoveContent(Content)
Removes a content from the ChatMessage.
Declaration
public void RemoveContent(Content content)
Parameters
| Type | Name | Description |
|---|---|---|
| Content | content | the Linphone.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()
Sends a chat message.
Declaration
public void Send()