Definition of V2TIMMessage.
Public Member Functions | |
bool | IsRead () const |
bool | IsPeerRead () const |
V2TIMBuffer | GetLocalCustomData () const |
void | SetLocalCustomData (const V2TIMBuffer &localCustomData, V2TIMCallback *callback) |
int | GetLocalCustomInt () const |
void | SetLocalCustomInt (int localCustomInt, V2TIMCallback *callback) |
V2TIMMessage () | |
V2TIMMessage (const V2TIMMessage &) | |
V2TIMMessage & | operator= (const V2TIMMessage &) |
~V2TIMMessage () override | |
V2TIMMessage | ( | ) |
V2TIMMessage | ( | const V2TIMMessage & | ) |
|
override |
bool IsRead | ( | ) | const |
Whether the message has been read by the current user.
bool IsPeerRead | ( | ) | const |
Whether the message was read by the other user(valid only for one-to-one messages). True will be returned if the message timestamp is equal to or smaller than the timestamp when the other user marked the message as read.
V2TIMBuffer GetLocalCustomData | ( | ) | const |
Get custom message data. The data is saved locally and will not be sent. It will be lost after the app is reinstalled.
void SetLocalCustomData | ( | const V2TIMBuffer & | localCustomData, |
V2TIMCallback * | callback | ||
) |
Set custom message data. The data is saved locally and will not be sent. It will be lost after the app is reinstalled.
int GetLocalCustomInt | ( | ) | const |
Get custom message data. The data is saved locally and will not be sent. It will be lost after the app is reinstalled.
void SetLocalCustomInt | ( | int | localCustomInt, |
V2TIMCallback * | callback | ||
) |
Set custom message data, which can be used to mark whether a voice or video message is played. The data is saved locally will not be sent. It will be lost after the app is reinstalled.
V2TIMMessage& operator= | ( | const V2TIMMessage & | ) |
V2TIMString msgID |
Message ID.
int64_t timestamp |
UTC timestamp of the message.
V2TIMString sender |
Sender's userID.
V2TIMString nickName |
Sender's nickname.
V2TIMString friendRemark |
Sender's friend remark. If friend information has not been pulled or the user is not a friend, null will be returned.
V2TIMString nameCard |
Get the message sender's alias in the group (valid for group messages)
V2TIMString faceURL |
Sender's profile photo URL.
V2TIMString groupID |
Get the groupID. If the message is not a group message, null will be returned.
V2TIMString userID |
Get the ID of the other user for one-to-one messages (whether sent by the local or remote user). For group messages, null will be returned.
uint64_t seq |
Sequence number of the message Message sequence numbers in group chats are generated in the cloud and are strictly incremented and unique within the group. Message sequence numbers in one-to-one chats are generated locally and are not necessarily strictly incremented or unique.
uint64_t random |
Random number of the message.
V2TIMMessageStatus status |
Message sending status.
bool supportMessageExtension |
Set whether to enable message extension (supported only in Chat Premium 6.7 and later versions)
You need to configure message extension in the Chat console first. AVChatRoom groups do not support this feature.
You need to buy Premium Edition to use this feature.
bool isSelf |
Whether the message sender is the current user.
bool needReadReceipt |
Set whether to enable read receipts
For group chats, read receipts are supported in 6.1 and later versions. You need to go to the Chat console to set the group types that support the feature first.
For one-to-one chats, the feature is supported in 6.2 and later versions.
The feature is only available in the Premium Edition.
bool isBroadcastMessage |
Whether the message is a broadcast message (supported only for AVChatRoom groups in Chat Premium v6.5 or later)
V2TIMMessagePriority priority |
Message priority (only V2TIMMessage received by onRecvNewMessage is valid)
V2TIMStringVector groupAtUserList |
UserID list of users who has been @ in the group message.
V2TIMElemVector elemList |
V2TIMElem list
It is recommended to store only one elem in a message. When receiving this message, call elemList[0] to get this elem. The sample code is as follows: if (1 == message.elemList.Size()) { V2TIMElem *elem = message.elemList[0]; switch (elem->elemType) { case V2TIM_ELEM_TYPE_TEXT: V2TIMTextElem *textElem = static_cast<V2TIMTextElem *>(elem); break; case V2TIM_ELEM_TYPE_CUSTOM: V2TIMCustomElem *customElem = static_cast<V2TIMCustomElem *>(elem); break; case V2TIM_ELEM_TYPE_FACE: V2TIMFaceElem *faceElem = static_cast<V2TIMFaceElem *>(elem); break; case V2TIM_ELEM_TYPE_LOCATION: V2TIMLocationElem *locationElem = static_cast<V2TIMLocationElem *>(elem); break; default: break; } }
If a message has multiple elems, traverse the elemList list to get all elem elements,the sample code is as follows: for (size_t i = 0; i < message.elemList.Size(); ++i) { V2TIMElem *elem = message.elemList[i]; switch (elem->elemType) { case V2TIM_ELEM_TYPE_TEXT: V2TIMTextElem *textElem = static_cast<V2TIMTextElem *>(elem); break; case V2TIM_ELEM_TYPE_CUSTOM: V2TIMCustomElem *customElem = static_cast<V2TIMCustomElem *>(elem); break; case V2TIM_ELEM_TYPE_FACE: V2TIMFaceElem *faceElem = static_cast<V2TIMFaceElem *>(elem); break; case V2TIM_ELEM_TYPE_LOCATION: V2TIMLocationElem *locationElem = static_cast<V2TIMLocationElem *>(elem); break; default: break; } }
If your message requires multiple elems, you can call elemList.PushBack to add a new elem after creating the Message object. Here is the sample code to create a message object with two elements. V2TIMCustomElem *customElem = new V2TIMCustomElem(); customElem->data = buffer; V2TIMMessage message = messageManager.CreateTextMessage("text"); message.elemList.PushBack(customElem);
V2TIMBuffer cloudCustomData |
Cloud custom data. The data is saved in the cloud and will be sent. It can be pulled even after the app is reinstalled.
bool isExcludedFromUnreadCount |
Set or get whether to exclude the message from the unread message count. false (default): included in the unread message count; true: excluded from the unread message count
Supported only in 5.3.425 and later versions and not supported by meeting groups by default
bool isExcludedFromLastMessage |
Set whether to skip the message when determining the conversation's lastMessage. false (default): do not skip; true: skip Supported only in 5.4.666 and later versions.
bool isExcludedFromContentModeration |
Set whether to exclude the current message from content moderation (cloud moderation). The default value is false. Works only if cloud moderation is enabled. Supported only in 7.1 and later versions.
V2TIMString customModerationConfigurationID |
Message custom moderation configuration ID(supported in 7.8 and later versions and valid only if cloud moderation is enabled) You can go to the console (On-cloud moderation -> Moderation configuration -> Custom configuration -> Add custom configuration) to get the configuration ID.
bool hasRiskContent |
Whether the current message is identified as risk message (supported only in 7.4 and later versions) This feature is only supported for voice and video messages. This API works only if cloud moderation is enabled. If a voice or video message sent is non-compliant, the onRecvMessageModified callback will be triggered, and the "hasRiskContent()" field in the callback message will be "true".
bool disableCloudMessagePreHook |
Whether to disable the cloud message hook before sending(supported only in imsdk 8.1 and later versions)
bool disableCloudMessagePostHook |
Whether to disable the cloud message hook after sending(supported only in imsdk 8.1 and later versions)
V2TIMOfflinePushInfo offlinePushInfo |
Offline push information of the message.
V2TIMUserFullInfo revokerInfo |
Get the recaller's info (supported only in 7.4 and later versions) Valid only for recalled messages
V2TIMString revokeReason |
Get the reason for recalling the message (supported only in 7.4 and later versions) Valid only for recalled messages
V2TIMGroupMemberInfo pinnerInfo |
Pinner's info (supported only in imsdk 8.0 and later versions) This field is only present in the pinned messages obtained through the GetPinnedGroupMessageList API.
|
inherited |