Definition of V2TIMMessage.
Public Member Functions | |
bool | IsRead () const |
bool | IsPeerRead () const |
V2TIMMessage () | |
V2TIMMessage (const V2TIMMessage &) | |
V2TIMMessage & | operator= (const V2TIMMessage &) |
~V2TIMMessage () override | |
V2TIMMessage | ( | ) |
V2TIMMessage | ( | const V2TIMMessage & | ) |
|
override |
bool IsRead | ( | ) | const |
Whether the message is read by the current user.
bool IsPeerRead | ( | ) | const |
Whether the message is read by the peer party (valid only for one-to-one messages) The condition for this field to be true is that the message timestamp <= the time when the peer marked conversation as read
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 you have not pulled the friend information or are not a friend, nil is returned.
V2TIMString nameCard |
For a group message, nameCard is the group name card of the sender.
V2TIMString faceURL |
Sender's profile photo URL.
V2TIMString groupID |
For a group message, groupID is the message receiving group ID. Otherwise, groupID is null.
V2TIMString userID |
For a one-to-one message, userID is the conversation user ID. Otherwise, userID is null. Suppose you are chatting with userA, regardless of whether it is a message sent to userA by yourself or a message sent to yourself by userA, the userID here is userA.
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 cannot be guaranteed to be strictly incremented and unique.
uint64_t random |
Random number of the message.
V2TIMMessageStatus status |
Message sending status.
bool supportMessageExtension |
Whether to support message extension (supported only in 6.7 and later versions)
AVChatRoom message do not support this feature.
You need to go to the IM console to enable this feature.
You need to buy Flagship Edition to use this feature.
bool isSelf |
Whether the message sender is the current user.
bool needReadReceipt |
Whether a read receipt is required
This feature for group chats is supported in 6.1 and later version. And you need to go to the IM console to enable this feature for specific group type.
This feature for one-to-one chats is supported in 6.2 and later version.
You need to buy Flagship Edition to use this feature for both group and one-to-one chats.
bool isBroadcastMessage |
Whether the message is a kind of broadcast message Only supported in AVChatRoom Only supported in 6.5 and later versions and need to buy Flagship Edition
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 localCustomData |
Local custom message data (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled)
int localCustomInt |
Local custom message data (saved locally, will not be sent to the peer end, and will become invalid after the app is uninstalled and reinstalled)
V2TIMBuffer cloudCustomData |
Cloud custom data (saved in the cloud, will be sent to the peer end, and can still be pulled after the app is uninstalled and reinstalled)
bool isExcludedFromUnreadCount |
Whether the message is excluded from the conversation unread message count. false (default): included in the unread message count of the conversation; true: excluded from the conversation unread message count
Supported only in 5.3.425 and later versions. Meeting group does not support this field by default.
bool isExcludedFromLastMessage |
Whether the message is excluded from the conversation lastMessage. false (default): included in the conversation lastMessage; true: excluded from the conversation lastMessage Supported only in 5.4.666 and later versions.
bool isExcludedFromContentModeration |
Specify Whether the current message will be excluded from content moderation (including [Local moderation] and [Cloud moderation]). Its default value is false. Valid only after the [Local Moderation] or [Cloud Moderation] function is activated. [Local moderation] please refer to document local moderation function. [Cloud moderation] please refer to document cloud moderation function Supported only in 7.1 and later versions.
bool hasRiskContent |
Whether the current message is identified as risk message (supported only in 7.4 and later versions) Only messages containing sound and video are supported. It will take effect after you enabling the [Cloud Moderation] feauture, [Cloud Moderation] please refer to document cloud moderation function. If you send a risky sound or video message, you will receive the onRecvMessageModified callback with this field being set to true after the cloud moderation.
V2TIMOfflinePushInfo offlinePushInfo |
Offline push information of the message.
V2TIMUserFullInfo revokerInfo |
Revoker's info (supported only in imsdk 7.4 and later versions) Valid only for revoked message
V2TIMString revokeReason |
Revoke reason (supported only in imsdk 7.4 and later versions) Valid only for revoked message
bool isRead |
This field is only used internally by the SDK. If you want to know whether the message is read by the current user, please use IsRead()
bool isPeerRead |
This field is only used internally by the SDK. If you want to know whether the message is read by the peer party, please use IsPeerRead()
|
inherited |