#import <EMConversation.h>
The chat conversation class.
◆ appendMessage:error:
Inserts a message to the end of a conversation in local database.
To insert the message correctly, ensure that the conversation ID of the message is the same as that of the conversation.
After a message is inserted, the SDK will automatically update attributes of the conversation, including latestMessage
.
- Parameters
-
aMessage | The message instance. |
pError | The error information if the method fails: Error. |
◆ deleteAllMessages:
- (void) deleteAllMessages: |
|
(EMError **_Nullable) |
pError |
|
Deletes all the messages in the conversation from the memory and local database.
- Parameters
-
pError | The error information if the method fails: Error. |
◆ deleteMessageWithId:error:
- (void) deleteMessageWithId: |
|
(NSString *_Nonnull) |
aMessageId |
error: |
|
(EMError **_Nullable) |
pError |
|
|
| |
Deletes a message from the local database.
- Parameters
-
aMessageId | The ID of the message to be deleted. |
pError | The error information if the method fails: Error. |
◆ insertMessage:error:
Inserts a message to a conversation in the local database.
To insert the message correctly, ensure that the conversation ID of the message is the same as that of the conversation.
The message is inserted based on timestamp and the SDK will automatically update attributes of the conversation, including latestMessage
.
- Parameters
-
aMessage | The message instance. |
pError | The error information if the method fails: Error. |
◆ lastReceivedMessage
Gets the last received message.
- Returns
- The message instance.
◆ removeMessagesFromServerWithTimeStamp:completion:
- (void) removeMessagesFromServerWithTimeStamp: |
|
(NSTimeInterval) |
beforeTimeStamp |
completion: |
|
(void(^)(EMError *_Nullable aError)) |
aCompletionBlock |
|
|
| |
Removes messages from the conversation by message ID.
This method deletes messages from both local storage and server.
- Parameters
-
messageIds | The message timestamp in millisecond. Messages with the timestamp smaller than the specified one will be removed from the current conversation. |
completion | The completion block, which contains the error message if the method fails. |
◆ removeMessagesStart:to:
- (EMError *_Nullable) removeMessagesStart: |
|
(NSInteger) |
aStartTimestamp |
to: |
|
(NSInteger) |
aEndTimestamp |
|
|
| |
Deletes messages sent or received in a certain period from the local database.
- Parameters
-
aStartTimestamp | The starting UNIX timestamp for message deletion. The unit is millisecond. |
aEndTimestamp | The end UNIX timestamp for message deletion. The unit is millisecond. |
- Returns
- EMError Whether the message deletion succeeds:
- If the operation succeeds, the SDK returns
nil
.
- If the operation fails, the SDK returns the failure reason such as the parameter error or database operation failure.
◆ updateMessageChange:error:
- (void) updateMessageChange: |
|
(EMChatMessage *_Nonnull) |
aMessage |
error: |
|
(EMError **_Nullable) |
pError |
|
|
| |
Updates a message in the local database.
After you update a message, the message ID remains unchanged and the SDK automatically updates attributes of the conversation, like latestMessage
.
- Parameters
-
aMessage | The message to be updated. |
pError | The error information if the method fails: Error. |
◆ conversationId
- (NSString*) conversationId |
|
readnonatomiccopy |
The conversation ID.
- One-to-one chat: The conversation ID is the user ID of the peer user.
- Group chat: The conversation ID is the group ID.
- Chat room: The conversation ID is the chat room ID.
◆ ext
The conversation extension attribute.
This attribute is not available for thread conversations.
◆ isChatThread
Whether the conversation is a thread conversation:
◆ isPinned
Whether the conversation is pinned:
◆ latestMessage
The latest message in the conversation.
◆ messagesCount
The message count in the conversation.
◆ pinnedTime
The UNIX timestamp when the conversation is pinned. The unit is millisecond. This value is 0
when the conversation is not pinned.
◆ type
- (EMConversationType) type |
|
readnonatomicassign |
◆ unreadMessagesCount
- (int) unreadMessagesCount |
|
readnonatomicassign |
The number of unread messages in the conversation.
The documentation for this class was generated from the following file: