floo::BMXMessage#
Message
#include <bmx_message.h>
Inherits from BMXBaseObject
Public Types#
| Name | |
|---|---|
| enum class | DeliveryStatus { New, Delivering, Deliveried, Failed, Recalled} Messaging state |
| enum class | MessageType { Single, Group, System} Message type |
| enum class | ContentType { Text, Image, Voice, Video, File, Location, Command, Forward} Type of message content |
| enum class | DeliveryQos { AtLastOnce, AtMostOnce, ExactlyOnce} Messaging quality |
Public Functions#
| Name | |
|---|---|
| virtual | ~BMXMessage() Destructor |
| int64_t | msgId() Message unique ID |
| int64_t | clientMsgId() Message client ID, only exists on message sender-side |
| int64_t | fromId() Message sender ID |
| int64_t | toId() Message receiver ID |
| MessageType | type() Message type |
| int64_t | conversationId() Conversation ID that message belongs to |
| DeliveryStatus | deliveryStatus() Messaging state |
| void | setDeliveryStatus(DeliveryStatus ) Set messaging state |
| int64_t | serverTimestamp() Message timestamp (when received by server-side) |
| void | setServerTimestamp(int64_t ) Set message timestamp (when received by server-side) |
| int64_t | clientTimestamp() Local timestamp (local time when message created or received) |
| void | setClientTimestamp(int64_t ) Set message local timestamp |
| bool | isPlayed() Whether voice or video message has been played, valid only for received audio/video messages |
| void | setIsPlayed(bool ) Set whether a voice or video message has been played, valid only for received audio or video messages |
| bool | isPlayAcked() Means whether playback acknowledgement received for sender, and whether playback acknowledgement sent for receiver |
| void | setIsPlayAcked(bool ) Set playback acknowledgement |
| bool | isReceiveMsg() Message whether to receive |
| void | setIsReceiveMsg(bool ) Message to set receiving condition |
| bool | isRead() Message read or unread mark |
| void | setIsRead(bool ) Message read or unread mark |
| bool | isReadAcked() Show sender whether read acknowledgement received, and show receiver whether message read acknowledgement sent |
| void | setIsReadAcked(bool ) Set read acknowledgement |
| bool | isDeliveryAcked() Show sender whether message has been delivered to the other party, and show receiver whether message delivered acknowledgement has been sent |
| void | setIsDeliveryAcked(bool ) Set delivery acknowledgement |
| const std::string & | content() Message text content |
| void | setContent(const std::string & content) Message text content |
| ContentType | contentType() Message content type, attachment-type with attachment, text-type with no attachment |
| BMXMessageAttachmentPtr | attachment() Message attachment, BMXMessage owns the attachment and is responsible for releasing it |
| BMXMessageConfigPtr | config() Message settings |
| void | setConfig(BMXMessageConfigPtr ) Set message config information |
| const JSON & | extension() Message extension information |
| void | setExtension(const JSON & ) Set message extension information |
| DeliveryQos | deliveryQos() QOS of messaging |
| void | setDeliveryQos(DeliveryQos qos) Set QOS of messaging |
| const std::string & | senderName() Display name of message sender |
| void | setSenderName(const std::string & senderName) Set display name of message sender |
| int | groupAckCount() AckCount of read group messages |
| void | setGroupAckCount(int count) Set groupAckCount of read messages (an SDK internal calling interface that shall not be called by upper layer) |
| int | groupAckUnreadCount() AckCount of unread group messages |
| void | setGroupAckUnreadCount(int count) Set groupAckCount of unread messages (an SDK internal calling interface that shall not be called by upper layer) |
| bool | groupAckReadAll() Whether all group messages are read |
| int | groupPlayAckCount() AckCount of played group messages (valid only for messages with audio/video attachment) |
| void | setGroupPlayAckCount(int count) Set groupAckCount of played messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment) |
| int | groupPlayAckUnreadCount() AckCount of unplayed group messages (valid only for messages with audio/video attachment) |
| void | setGroupPlayAckUnreadCount(int count) Set groupAckCount of unplayed messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment) |
| bool | groupPlayAckReadAll() Whether all group messages have been played |
| void | setPriority(int priority) Set message diffusion priority, default 0. 0 means diffusion, and the smaller the number, the more diffused. |
| int | priority() Message diffusion priority |
| void | setPushMessageMode(bool ) Set whether the message is a push. |
| bool | isPushMessage() Whether the message is a push |
| BMXMessagePtr | createMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content) Create a text message |
| BMXMessagePtr | createMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, BMXMessageAttachmentPtr attachment) Create a sent-attachment message |
| BMXMessagePtr | createCommandMessage(int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content) Create a sent command message (command message holds command information in a content field or an extension field) |
| BMXMessagePtr | createMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content, int64_t serverTimestamp) Create a received message |
| BMXMessagePtr | createMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, BMXMessageAttachmentPtr attachment, int64_t serverTimestamp) Create a received message |
| BMXMessagePtr | createCommandMessage(int64_t msgId, int64_t from, int64_t to, MessageType type, int64_t conversationId, const std::string & content, int64_t serverTimestamp) Create a received command message (command message holds command information in a content field or an extension field) |
| BMXMessagePtr | createForwardMessage(BMXMessagePtr msg, int64_t from, int64_t to, MessageType type, int64_t conversationId) Create a forwarding message |
Public Types Documentation#
enum DeliveryStatus#
| Enumerator | Value | Description |
|---|---|---|
| New | Newly created message | |
| Delivering | Message delivering | |
| Deliveried | Message delivered | |
| Failed | Message delivery failed | |
| Recalled | Message delivery canceled |
Message delivery status
enum MessageType#
| Enumerator | Value | Description |
|---|---|---|
| Single | Single chat message | |
| Group | Group chat message | |
| System | System message |
Message type
enum ContentType#
| Enumerator | Value | Description |
|---|---|---|
| Text | Text message | |
| Image | Image message | |
| Voice | Voice message | |
| Video | Video clip message | |
| File | File message | |
| Location | Location message | |
| Command | Command message | |
| Forward | Forward message |
Message content type
enum DeliveryQos#
| Enumerator | Value | Description |
|---|---|---|
| AtLastOnce | Deliver at least once | |
| AtMostOnce | Deliver at most once | |
| ExactlyOnce | Deliver only once |
Message delivery QoS
Public Functions Documentation#
function ~BMXMessage#
virtual ~BMXMessage()
Destructor
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="~BMXMessage" %}{% endlanying_code_snippet %}
function msgId#
int64_t msgId()
Message unique ID
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="msgId" %}{% endlanying_code_snippet %}
function clientMsgId#
int64_t clientMsgId()
Message client ID, only exists on message sender-side
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="clientMsgId" %}{% endlanying_code_snippet %}
function fromId#
int64_t fromId()
Message sender ID
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="fromId" %}{% endlanying_code_snippet %}
function toId#
int64_t toId()
Message receiver ID
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="toId" %}{% endlanying_code_snippet %}
function type#
MessageType type()
Message type
Return: MessageType
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="type" %}{% endlanying_code_snippet %}
function conversationId#
int64_t conversationId()
Conversation ID that message belongs to
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="conversationId" %}{% endlanying_code_snippet %}
function deliveryStatus#
DeliveryStatus deliveryStatus()
Message delivery status
Return: DeliveryStatus
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="deliveryStatus" %}{% endlanying_code_snippet %}
function setDeliveryStatus#
void setDeliveryStatus(
DeliveryStatus
)
Set messaging state
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setDeliveryStatus" %}{% endlanying_code_snippet %}
function serverTimestamp#
int64_t serverTimestamp()
Message timestamp (when received by server-side)
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="serverTimestamp" %}{% endlanying_code_snippet %}
function setServerTimestamp#
void setServerTimestamp(
int64_t
)
Set message timestamp (when received by server-side)
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setServerTimestamp" %}{% endlanying_code_snippet %}
function clientTimestamp#
int64_t clientTimestamp()
Local timestamp (local time when message created or received)
Return: int64_t
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="clientTimestamp" %}{% endlanying_code_snippet %}
function setClientTimestamp#
void setClientTimestamp(
int64_t
)
Set message local timestamp
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setClientTimestamp" %}{% endlanying_code_snippet %}
function isPlayed#
bool isPlayed()
Whether voice or video message has been played, valid only for received audio/video messages
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isPlayed" %}{% endlanying_code_snippet %}
function setIsPlayed#
void setIsPlayed(
bool
)
Set whether a voice or video message has been played, valid only for received audio or video messages
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsPlayed" %}{% endlanying_code_snippet %}
function isPlayAcked#
bool isPlayAcked()
Means whether playback acknowledgement received for sender, and whether playback acknowledgement sent for receiver
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isPlayAcked" %}{% endlanying_code_snippet %}
function setIsPlayAcked#
void setIsPlayAcked(
bool
)
Set playback acknowledgement
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsPlayAcked" %}{% endlanying_code_snippet %}
function isReceiveMsg#
bool isReceiveMsg()
Message whether to receive
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isReceiveMsg" %}{% endlanying_code_snippet %}
function setIsReceiveMsg#
void setIsReceiveMsg(
bool
)
Message to set receiving condition
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsReceiveMsg" %}{% endlanying_code_snippet %}
function isRead#
bool isRead()
Message read or unread mark
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isRead" %}{% endlanying_code_snippet %}
function setIsRead#
void setIsRead(
bool
)
Message read or unread mark
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsRead" %}{% endlanying_code_snippet %}
function isReadAcked#
bool isReadAcked()
Show sender whether read acknowledgement received, and show receiver whether message read acknowledgement sent
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isReadAcked" %}{% endlanying_code_snippet %}
function setIsReadAcked#
void setIsReadAcked(
bool
)
Set read acknowledgement
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsReadAcked" %}{% endlanying_code_snippet %}
function isDeliveryAcked#
bool isDeliveryAcked()
Show sender whether message has been delivered to the other party, and show receiver whether message delivered acknowledgement has been sent
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isDeliveryAcked" %}{% endlanying_code_snippet %}
function setIsDeliveryAcked#
void setIsDeliveryAcked(
bool
)
Set delivery acknowledgement
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setIsDeliveryAcked" %}{% endlanying_code_snippet %}
function content#
const std::string & content()
Message text content
Return: std::string
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="content" %}{% endlanying_code_snippet %}
function setContent#
void setContent(
const std::string & content
)
Message text content
Parameters:
- content Message text content
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setContent" %}{% endlanying_code_snippet %}
function contentType#
ContentType contentType()
Message content type, attachment-type with attachment, text-type with no attachment
Return: ContentType
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="contentType" %}{% endlanying_code_snippet %}
function attachment#
BMXMessageAttachmentPtr attachment()
Message attachment, BMXMessage owns the attachment and is responsible for releasing it
Return: BMXMessageAttachmentPtr
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="attachment" %}{% endlanying_code_snippet %}
function config#
BMXMessageConfigPtr config()
Message settings
Return: JSON(std::string)
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="config" %}{% endlanying_code_snippet %}
function setConfig#
void setConfig(
BMXMessageConfigPtr
)
Set message config information
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setConfig" %}{% endlanying_code_snippet %}
function extension#
const JSON & extension()
Message extension information
Return: JSON(std::string)
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="extension" %}{% endlanying_code_snippet %}
function setExtension#
void setExtension(
const JSON &
)
Set message extension information
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setExtension" %}{% endlanying_code_snippet %}
function deliveryQos#
DeliveryQos deliveryQos()
QOS of messaging
Return: DeliveryQos
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="deliveryQos" %}{% endlanying_code_snippet %}
function setDeliveryQos#
void setDeliveryQos(
DeliveryQos qos
)
Set QOS of messaging
Parameters:
- qos QOS of messaging
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setDeliveryQos" %}{% endlanying_code_snippet %}
function senderName#
const std::string & senderName()
Display name of message sender
Return: std::string
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="senderName" %}{% endlanying_code_snippet %}
function setSenderName#
void setSenderName(
const std::string & senderName
)
Set display name of message sender
Parameters:
- senderName Message text content
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setSenderName" %}{% endlanying_code_snippet %}
function groupAckCount#
int groupAckCount()
AckCount of read group messages
Return: int
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupAckCount" %}{% endlanying_code_snippet %}
function setGroupAckCount#
void setGroupAckCount(
int count
)
Set groupAckCount of read messages (an SDK internal calling interface that shall not be called by upper layer)
Parameters:
- count Set the number of read group messages
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupAckCount" %}{% endlanying_code_snippet %}
function groupAckUnreadCount#
int groupAckUnreadCount()
AckCount of unread group messages
Return: int
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupAckUnreadCount" %}{% endlanying_code_snippet %}
function setGroupAckUnreadCount#
void setGroupAckUnreadCount(
int count
)
Set groupAckCount of unread messages (an SDK internal calling interface that shall not be called by upper layer)
Parameters:
- count Set the number of unread group messages
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupAckUnreadCount" %}{% endlanying_code_snippet %}
function groupAckReadAll#
bool groupAckReadAll()
Whether all group messages are read
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupAckReadAll" %}{% endlanying_code_snippet %}
function groupPlayAckCount#
int groupPlayAckCount()
AckCount of played group messages (valid only for messages with audio/video attachment)
Return: int
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupPlayAckCount" %}{% endlanying_code_snippet %}
function setGroupPlayAckCount#
void setGroupPlayAckCount(
int count
)
Set groupAckCount of played messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)
Parameters:
- count Set the number of read group messages
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupPlayAckCount" %}{% endlanying_code_snippet %}
function groupPlayAckUnreadCount#
int groupPlayAckUnreadCount()
AckCount of unplayed group messages (valid only for messages with audio/video attachment)
Return: int
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupPlayAckUnreadCount" %}{% endlanying_code_snippet %}
function setGroupPlayAckUnreadCount#
void setGroupPlayAckUnreadCount(
int count
)
Set groupAckCount of unplayed messages (an SDK internal calling interface that shall not be called by upper layer) (valid only for messages with audio/video attachment)
Parameters:
- count Set the number of unplayed group messages
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setGroupPlayAckUnreadCount" %}{% endlanying_code_snippet %}
function groupPlayAckReadAll#
bool groupPlayAckReadAll()
Whether all group messages have been played
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="groupPlayAckReadAll" %}{% endlanying_code_snippet %}
function setPriority#
void setPriority(
int priority
)
Set message diffusion priority, default 0. 0 means diffusion, and the smaller the number, the more diffused.
Parameters:
- priority Set the number of unread group messages
Value range 0-10. The default level of messages sent by ordinary users in chatroom is 5, which can be discarded. Admin level defaults to 0 and will not be discarded. Other values can be set according to business.
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setPriority" %}{% endlanying_code_snippet %}
function priority#
int priority()
Message diffusion priority
Return: int
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="priority" %}{% endlanying_code_snippet %}
function setPushMessageMode#
void setPushMessageMode(
bool
)
Set whether the message is a push.
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="setPushMessageMode" %}{% endlanying_code_snippet %}
function isPushMessage#
bool isPushMessage()
Whether the message is a push
Return: bool
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="isPushMessage" %}{% endlanying_code_snippet %}
function createMessage#
static BMXMessagePtr createMessage(
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId,
const std::string & content
)
Create a text message
Parameters:
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
- content Message content
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}
function createMessage#
static BMXMessagePtr createMessage(
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId,
BMXMessageAttachmentPtr attachment
)
Create a sent-attachment message
Parameters:
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
- attachment Attachment
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}
function createCommandMessage#
static BMXMessagePtr createCommandMessage(
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId,
const std::string & content
)
Create a sent command message (command message holds command information in a content field or an extension field)
Parameters:
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
- content Message content
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createCommandMessage" %}{% endlanying_code_snippet %}
function createMessage#
static BMXMessagePtr createMessage(
int64_t msgId,
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId,
const std::string & content,
int64_t serverTimestamp
)
Create a received message
Parameters:
- msgId Message id
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
- content Message content
- serverTimestamp Server timestamp
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}
function createMessage#
static BMXMessagePtr createMessage(
int64_t msgId,
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId,
BMXMessageAttachmentPtr attachment,
int64_t serverTimestamp
)
Create a received message
Parameters:
- msgId Message id
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
- attachment Attachment
- serverTimestamp Server timestamp
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createMessage" %}{% endlanying_code_snippet %}
function createCommandMessage#
static BMXMessagePtr createCommandMessage(
int64_t msgId,
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId,
const std::string & content,
int64_t serverTimestamp
)
Create a received command message (command message holds command information in a content field or an extension field)
Parameters:
- msgId Message id
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
- content Message content
- serverTimestamp Server timestamp
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createCommandMessage" %}{% endlanying_code_snippet %}
function createForwardMessage#
static BMXMessagePtr createForwardMessage(
BMXMessagePtr msg,
int64_t from,
int64_t to,
MessageType type,
int64_t conversationId
)
Create a forwarding message
Parameters:
- msg Message to forward
- from Message sender
- to Message receiver
- type Message type
- conversationId Conversation id
Example:
{% lanying_code_snippet repo="lanying-im-embedded",class="BMXMessage",function="createForwardMessage" %}{% endlanying_code_snippet %}
Updated on 2022-01-26 at 17:20:40 +0800