Liblinphone
5.3.0
|
An chat message is the object that is sent or received through a ChatRoom. More...
#include <chat_message.hh>
Public Types | |
enum | Direction { Direction::Incoming = 0, Direction::Outgoing = 1 } |
Direction is used to indicate if a message is outgoing or incoming. More... | |
enum | State { State::Idle = 0, State::InProgress = 1, State::Delivered = 2, State::NotDelivered = 3, State::FileTransferError = 4, State::FileTransferDone = 5, State::DeliveredToUser = 6, State::Displayed = 7, State::FileTransferInProgress = 8 } |
State is used to notify if messages have been successfully delivered or not. More... | |
Public Member Functions | |
LINPHONECXX_PUBLIC | ChatMessage (void *ptr, bool takeRef=true) |
LINPHONECXX_PUBLIC _LinphoneChatMessage * | cPtr () |
LINPHONECXX_PUBLIC void | addListener (const std::shared_ptr< ChatMessageListener > &listener) |
Add an application listener to the ChatMessage instance. More... | |
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< ChatMessageListener > &listener) |
Remove a previously added listener from the ChatMessage instance. More... | |
LINPHONECXX_PUBLIC std::string | getAppdata () const |
Linphone message has an app-specific field that can store a text. More... | |
LINPHONECXX_PUBLIC void | setAppdata (const std::string &data) |
Linphone message has an app-specific field that can store a text. More... | |
LINPHONECXX_PUBLIC std::string | getCallId () const |
Gets the callId accociated with the message. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatRoom > | getChatRoom () const |
Returns the chatroom this message belongs to. More... | |
LINPHONECXX_PUBLIC std::string | getContentType () const |
Get the content type of a chat message. More... | |
LINPHONECXX_PUBLIC void | setContentType (const std::string &contentType) |
Set the content type of a chat message. More... | |
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::Content > > | getContents () const |
Returns the list of contents in the message. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const |
Returns back pointer to Core object. More... | |
LINPHONECXX_PUBLIC time_t | getEphemeralExpireTime () const |
Returns the real time at which an ephemeral message expires and will be deleted. More... | |
LINPHONECXX_PUBLIC long | getEphemeralLifetime () const |
Returns lifetime of an ephemeral message. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ErrorInfo > | getErrorInfo () const |
Get full details about delivery error of a chat message. More... | |
LINPHONECXX_PUBLIC std::string | getExternalBodyUrl () const |
Linphone message can carry external body as defined by rfc2017. More... | |
LINPHONECXX_PUBLIC void | setExternalBodyUrl (const std::string &externalBodyUrl) |
Linphone message can carry external body as defined by rfc2017. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Content > | getFileTransferInformation () const |
Get the file_transfer_information (used by call backs to recover informations during a rcs file transfer) More... | |
LINPHONECXX_PUBLIC std::string | getForwardInfo () const |
Gets the forward info if available as a string. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getFromAddress () const |
Get origin of the message. More... | |
LINPHONECXX_PUBLIC bool | isEphemeral () const |
Returns wether the chat message is an ephemeral message or not. More... | |
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool | isFileTransfer () const |
Return whether or not a chat message is a file transfer. More... | |
LINPHONECXX_PUBLIC bool | isFileTransferInProgress () const |
Gets whether or not a file is currently being downloaded or uploaded. More... | |
LINPHONECXX_PUBLIC bool | isForward () |
Returns wether the chat message is a forward message or not. More... | |
LINPHONECXX_PUBLIC bool | isOutgoing () const |
Returns wehther the message has been sent or received. More... | |
LINPHONECXX_PUBLIC bool | isRead () const |
Returns wether the message has been read or not. More... | |
LINPHONECXX_PUBLIC bool | isReply () |
Returns wether the chat message is a reply message or not. More... | |
LINPHONECXX_PUBLIC bool | isSecured () const |
Get if the message was encrypted when transfered. More... | |
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool | isText () const |
Return whether or not a chat message is a text. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getLocalAddress () const |
Returns the local address the message was sent or received with. More... | |
LINPHONECXX_PUBLIC std::string | getMessageId () const |
Get the message identifier. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ChatMessageReaction > | getOwnReaction () const |
Returns our own reaction for a given chat message, if any. More... | |
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ChatMessageReaction > > | getReactions () const |
Gets the list of reactions received for this chat message. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessage > | getReplyMessage () |
Returns the ChatMessage this message is a reply to. More... | |
LINPHONECXX_PUBLIC std::string | getReplyMessageId () |
Returns the ID of the message this is a reply to. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getReplyMessageSenderAddress () |
Returns the address of the sender of the message this is a reply to. More... | |
LINPHONECXX_PUBLIC State | getState () const |
Get the state of the message. More... | |
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string | getTextContent () const |
Gets the text content if available as a string. More... | |
LINPHONECXX_PUBLIC time_t | getTime () const |
Get the time the message was sent. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getToAddress () const |
Get destination of the message. More... | |
LINPHONECXX_PUBLIC bool | getToBeStored () const |
Get if a chat message is to be stored. More... | |
LINPHONECXX_PUBLIC void | setToBeStored (bool toBeStored) |
Set if a chat message is to be stored. More... | |
LINPHONECXX_PUBLIC std::string | getUtf8Text () const |
Get text part of this message. More... | |
LINPHONECXX_PUBLIC int | setUtf8Text (const std::string &text) |
Set a chat message text to be sent by linphone_chat_room_send_message. More... | |
LINPHONECXX_PUBLIC void | addContent (const std::shared_ptr< linphone::Content > &content) |
Adds a content to the ChatMessage. More... | |
LINPHONECXX_PUBLIC void | addCustomHeader (const std::string &headerName, const std::string &headerValue) |
Add custom headers to the message. More... | |
LINPHONECXX_PUBLIC void | addFileContent (const std::shared_ptr< linphone::Content > &content) |
Adds a file content to the ChatMessage. More... | |
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void | addTextContent (const std::string &text) |
Creates a Content of type PlainText with the given text as body. More... | |
LINPHONECXX_PUBLIC void | addUtf8TextContent (const std::string &text) |
Creates a Content of type PlainText with the given text as body. More... | |
LINPHONECXX_PUBLIC void | cancelFileTransfer () |
Cancel an ongoing file transfer attached to this message. More... | |
LINPHONECXX_PUBLIC std::shared_ptr< linphone::ChatMessageReaction > | createReaction (const std::string &utf8Reaction) |
Creates a emoji reaction for the given chat mesage. More... | |
LINPHONECXX_PUBLIC bool | downloadContent (const std::shared_ptr< linphone::Content > &content) |
Start the download of the Content referenced in the ChatMessage from remote server. More... | |
LINPHONECXX_PUBLIC std::string | getCustomHeader (const std::string &headerName) const |
Retrieve a custom header value given its name. More... | |
LINPHONECXX_PUBLIC std::list< std::shared_ptr< linphone::ParticipantImdnState > > | getParticipantsByImdnState (State state) const |
Gets the list of participants for which the imdn state has reached the specified state and the time at which they did. More... | |
LINPHONECXX_PUBLIC bool | hasConferenceInvitationContent () const |
Returns wether the chat message has a conference invitation content or not. More... | |
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool | hasTextContent () const |
Returns wether the chat message has a text content or not. More... | |
LINPHONECXX_PUBLIC linphone::Status | putChar (uint32_t character) |
Fulfill a chat message char by char. More... | |
LINPHONECXX_PUBLIC void | removeContent (const std::shared_ptr< linphone::Content > &content) |
Removes a content from the ChatMessage. More... | |
LINPHONECXX_PUBLIC void | removeCustomHeader (const std::string &headerName) |
Removes a custom header from the message. More... | |
LINPHONECXX_PUBLIC void | send () |
Send a chat message. | |
An chat message is the object that is sent or received through a ChatRoom.
To create a ChatMessage, use ChatRoom::createEmptyMessage(), then either add text using addUtf8TextContent() or a Content with file informations using addFileContent(). A valid Content for file transfer must contain a type and subtype, the name of the file and it's size. Finally call send() to send it. To send files through a ChatMessage, you need to have configured a file transfer server URL with Core::setFileTransferServer(). On the receiving side, either use downloadContent() to download received files or enable auto-download in the Core using Core::setMaxSizeForAutoDownloadIncomingFiles(), -1 disabling the feature and 0 always downloading files no matter it's size. Keep in mind a ChatMessage created by a ChatRoom::Backend::Basic ChatRoom can only contain one Content, either text or file.
|
strong |
Direction is used to indicate if a message is outgoing or incoming.
Enumerator | |
---|---|
Incoming | Incoming message. |
Outgoing | Outgoing message. |
|
strong |
State is used to notify if messages have been successfully delivered or not.
LINPHONECXX_PUBLIC void linphone::ChatMessage::addContent | ( | const std::shared_ptr< linphone::Content > & | content | ) |
Adds a content to the ChatMessage.
content | the Content object to add. |
LINPHONECXX_PUBLIC void linphone::ChatMessage::addCustomHeader | ( | const std::string & | headerName, |
const std::string & | headerValue | ||
) |
Add custom headers to the message.
headerName | name of the header |
headerValue | header value |
LINPHONECXX_PUBLIC void linphone::ChatMessage::addFileContent | ( | const std::shared_ptr< linphone::Content > & | content | ) |
Adds a file content to the ChatMessage.
content | the Content object to add. |
LINPHONECXX_PUBLIC void linphone::ChatMessage::addListener | ( | const std::shared_ptr< ChatMessageListener > & | listener | ) |
Add an application listener to the ChatMessage instance.
listener | the application listener |
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED void linphone::ChatMessage::addTextContent | ( | const std::string & | text | ) |
Creates a Content of type PlainText with the given text as body.
text | The text in System Locale to add to the message. |
LINPHONECXX_PUBLIC void linphone::ChatMessage::addUtf8TextContent | ( | const std::string & | text | ) |
Creates a Content of type PlainText with the given text as body.
Introduced in 01/07/2020
text | The text in UTF8 to add to the message. |
LINPHONECXX_PUBLIC void linphone::ChatMessage::cancelFileTransfer | ( | ) |
Cancel an ongoing file transfer attached to this message.
(upload or download)
LINPHONECXX_PUBLIC std::shared_ptr<linphone::ChatMessageReaction> linphone::ChatMessage::createReaction | ( | const std::string & | utf8Reaction | ) |
Creates a emoji reaction for the given chat mesage.
To send it, use ChatMessageReaction::send().
utf8Reaction | the emoji character(s) as UTF-8. |
LINPHONECXX_PUBLIC bool linphone::ChatMessage::downloadContent | ( | const std::shared_ptr< linphone::Content > & | content | ) |
Start the download of the Content referenced in the ChatMessage from remote server.
content | the Content object to download (must have the Content::isFileTransfer() method return true). |
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getAppdata | ( | ) | const |
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.
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getCallId | ( | ) | const |
Gets the callId accociated with the message.
LINPHONECXX_PUBLIC std::shared_ptr<linphone::ChatRoom> linphone::ChatMessage::getChatRoom | ( | ) | const |
Returns the chatroom this message belongs to.
LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::Content> > linphone::ChatMessage::getContents | ( | ) | const |
Returns the list of contents in the message.
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getContentType | ( | ) | const |
Get the content type of a chat message.
LINPHONECXX_PUBLIC std::shared_ptr<linphone::Core> linphone::ChatMessage::getCore | ( | ) | const |
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getCustomHeader | ( | const std::string & | headerName | ) | const |
Retrieve a custom header value given its name.
headerName | header name searched |
LINPHONECXX_PUBLIC time_t linphone::ChatMessage::getEphemeralExpireTime | ( | ) | const |
Returns the real time at which an ephemeral message expires and will be deleted.
LINPHONECXX_PUBLIC long linphone::ChatMessage::getEphemeralLifetime | ( | ) | const |
Returns lifetime of an ephemeral message.
The lifetime is the duration after which the ephemeral message will disappear once viewed.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::ErrorInfo> linphone::ChatMessage::getErrorInfo | ( | ) | const |
Get full details about delivery error of a chat message.
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getExternalBodyUrl | ( | ) | const |
Linphone message can carry external body as defined by rfc2017.
LINPHONECXX_PUBLIC std::shared_ptr<linphone::Content> linphone::ChatMessage::getFileTransferInformation | ( | ) | const |
Get the file_transfer_information (used by call backs to recover informations during a rcs file transfer)
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getForwardInfo | ( | ) | const |
Gets the forward info if available as a string.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::Address> linphone::ChatMessage::getFromAddress | ( | ) | const |
Get origin of the message.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::Address> linphone::ChatMessage::getLocalAddress | ( | ) | const |
Returns the local address the message was sent or received with.
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getMessageId | ( | ) | const |
Get the message identifier.
It is used to identify a message so that it can be notified as delivered and/or displayed.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::ChatMessageReaction> linphone::ChatMessage::getOwnReaction | ( | ) | const |
Returns our own reaction for a given chat message, if any.
LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::ParticipantImdnState> > linphone::ChatMessage::getParticipantsByImdnState | ( | State | state | ) | const |
Gets the list of participants for which the imdn state has reached the specified state and the time at which they did.
state | The LinphoneChatMessageState the imdn have reached (only use LinphoneChatMessageStateDelivered, LinphoneChatMessageStateDeliveredToUser, LinphoneChatMessageStateDisplayed and LinphoneChatMessageStateNotDelivered) |
LINPHONECXX_PUBLIC std::list<std::shared_ptr<linphone::ChatMessageReaction> > linphone::ChatMessage::getReactions | ( | ) | const |
Gets the list of reactions received for this chat message.
Warning: list is ordered by content of reaction message, not by received timestamp!
LINPHONECXX_PUBLIC std::shared_ptr<linphone::ChatMessage> linphone::ChatMessage::getReplyMessage | ( | ) |
Returns the ChatMessage this message is a reply to.
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getReplyMessageId | ( | ) |
Returns the ID of the message this is a reply to.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::Address> linphone::ChatMessage::getReplyMessageSenderAddress | ( | ) |
Returns the address of the sender of the message this is a reply to.
LINPHONECXX_PUBLIC State linphone::ChatMessage::getState | ( | ) | const |
Get the state of the message.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED std::string linphone::ChatMessage::getTextContent | ( | ) | const |
Gets the text content if available as a string.
LINPHONECXX_PUBLIC time_t linphone::ChatMessage::getTime | ( | ) | const |
Get the time the message was sent.
LINPHONECXX_PUBLIC std::shared_ptr<const linphone::Address> linphone::ChatMessage::getToAddress | ( | ) | const |
Get destination of the message.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::getToBeStored | ( | ) | const |
Get if a chat message is to be stored.
LINPHONECXX_PUBLIC std::string linphone::ChatMessage::getUtf8Text | ( | ) | const |
Get text part of this message.
Introduced in 01/07/2020
LINPHONECXX_PUBLIC bool linphone::ChatMessage::hasConferenceInvitationContent | ( | ) | const |
Returns wether the chat message has a conference invitation content or not.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool linphone::ChatMessage::hasTextContent | ( | ) | const |
Returns wether the chat message has a text content or not.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isEphemeral | ( | ) | const |
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.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool linphone::ChatMessage::isFileTransfer | ( | ) | const |
Return whether or not a chat message is a file transfer.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isFileTransferInProgress | ( | ) | const |
Gets whether or not a file is currently being downloaded or uploaded.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isForward | ( | ) |
Returns wether the chat message is a forward message or not.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isOutgoing | ( | ) | const |
Returns wehther the message has been sent or received.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isRead | ( | ) | const |
Returns wether the message has been read or not.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isReply | ( | ) |
Returns wether the chat message is a reply message or not.
LINPHONECXX_PUBLIC bool linphone::ChatMessage::isSecured | ( | ) | const |
Get if the message was encrypted when transfered.
LINPHONECXX_PUBLIC LINPHONECXX_DEPRECATED bool linphone::ChatMessage::isText | ( | ) | const |
Return whether or not a chat message is a text.
LINPHONECXX_PUBLIC linphone::Status linphone::ChatMessage::putChar | ( | uint32_t | character | ) |
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
character | T.140 char |
LINPHONECXX_PUBLIC void linphone::ChatMessage::removeContent | ( | const std::shared_ptr< linphone::Content > & | content | ) |
Removes a content from the ChatMessage.
content | the Content object to remove. |
LINPHONECXX_PUBLIC void linphone::ChatMessage::removeCustomHeader | ( | const std::string & | headerName | ) |
Removes a custom header from the message.
headerName | name of the header to remove |
LINPHONECXX_PUBLIC void linphone::ChatMessage::removeListener | ( | const std::shared_ptr< ChatMessageListener > & | listener | ) |
Remove a previously added listener from the ChatMessage instance.
listener | the application listener |
LINPHONECXX_PUBLIC void linphone::ChatMessage::setAppdata | ( | const std::string & | data | ) |
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. Invoking this function will attempt to update the message storage to reflect the change if it is enabled.
data | the data to store into the message. |
LINPHONECXX_PUBLIC void linphone::ChatMessage::setContentType | ( | const std::string & | contentType | ) |
Set the content type of a chat message.
This content type must match a content that is text representable, such as text/plain, text/html or image/svg+xml.
contentType | The new content type of the chat message |
LINPHONECXX_PUBLIC void linphone::ChatMessage::setExternalBodyUrl | ( | const std::string & | externalBodyUrl | ) |
Linphone message can carry external body as defined by rfc2017.
externalBodyUrl | ex: access-type=URL; URL="http://www.foo.com/file" |
LINPHONECXX_PUBLIC void linphone::ChatMessage::setToBeStored | ( | bool | toBeStored | ) |
Set if a chat message is to be stored.
This content type must match a content that is text representable, such as text/plain, text/html or image/svg+xml.
toBeStored | Whether or not the chat message is to be stored |
LINPHONECXX_PUBLIC int linphone::ChatMessage::setUtf8Text | ( | const std::string & | text | ) |
Set a chat message text to be sent by linphone_chat_room_send_message.
Introduced in 01/07/2020
text | The text in UTF8 to set. |