AgoraChat SDK for Unity and Windows v1.4.0
Loading...
Searching...
No Matches
AgoraChat.ChatManager Class Reference
Inheritance diagram for AgoraChat.ChatManager:

Public Member Functions

bool DeleteConversation (string conversationId, bool deleteMessages=true)
void DownloadAttachment (string messageId, CallBack callback=null)
void DownloadThumbnail (string messageId, CallBack callback=null)
void FetchHistoryMessagesFromServer (string conversationId, ConversationType type=ConversationType.Chat, string startMessageId=null, int count=20, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< CursorResult< Message > > callback=null)
void FetchHistoryMessagesFromServerBy (string conversationId, ConversationType type=ConversationType.Chat, string cursor=null, int pageSize=10, FetchServerMessagesOption option=null, ValueCallBack< CursorResult< Message > > callback=null)
Conversation GetConversation (string conversationId, ConversationType type=ConversationType.Chat, bool createIfNeed=true)
Conversation GetThreadConversation (string threadId)
void GetConversationsFromServer (ValueCallBack< List< Conversation > > callback=null)
void GetConversationsFromServerWithCursor (bool pinOnly, string cursor="", int limit=20, ValueCallBack< CursorResult< Conversation > > callback=null)
void GetConversationsFromServerWithCursor (MarkType mark, string cursor="", int limit=20, ValueCallBack< CursorResult< Conversation > > callback=null)
int GetUnreadMessageCount ()
void GetMessageCount (ValueCallBack< int > callback=null)
void ImportMessages (List< Message > messages, CallBack callback=null)
List< ConversationLoadAllConversations ()
Message LoadMessage (string messageId)
bool MarkAllConversationsAsRead ()
void RecallMessage (string messageId, string ext, CallBack callback=null)
Message ResendMessage (string messageId, CallBack callback=null)
void SearchMsgFromDB (string keywords, long timestamp=0, int maxCount=20, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP, ValueCallBack< List< Message > > callback=null)
void SearchMsgFromDB (string keywords, long timestamp=0, int maxCount=20, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP, MessageSearchScope scope=MessageSearchScope.CONTENT, ValueCallBack< List< Message > > callback=null)
void SendConversationReadAck (string conversationId, CallBack callback=null)
void SendMessage (ref Message message, CallBack callback=null)
void SendMessageReadAck (string messageId, CallBack callback=null)
void SendReadAckForGroupMessage (string messageId, string ackContent, CallBack callback=null)
bool UpdateMessage (Message message)
void ModifyMessage (string messageId, MessageBody.TextBody body, ValueCallBack< Message > callback=null)
void ModifyMessage (string messageId, IMessageBody body=null, Dictionary< string, AttributeValue > attributes=null, ValueCallBack< Message > callback=null)
void RemoveMessagesBeforeTimestamp (long timeStamp, CallBack callback=null)
void DeleteConversationFromServer (string conversationId, ConversationType conversationType, bool isDeleteServerMessages, CallBack callback=null)
void FetchSupportLanguages (ValueCallBack< List< SupportLanguage > > callback=null)
void TranslateMessage (Message message, List< string > targetLanguages, ValueCallBack< Message > callback=null)
void FetchGroupReadAcks (string messageId, string groupId, int pageSize=20, string startAckId=null, ValueCallBack< CursorResult< GroupReadAck > > callback=null)
void ReportMessage (string messageId, string tag, string reason, CallBack callback=null)
void AddReaction (string messageId, string reaction, CallBack callback=null)
void RemoveReaction (string messageId, string reaction, CallBack callback=null)
void GetReactionList (List< string > messageIdList, MessageType chatType, string groupId, ValueCallBack< Dictionary< string, List< MessageReaction > > > callback=null)
void LoadConversationMessagesWithKeyword (string keywords, long timestamp=-1, string from=null, MessageSearchDirection direction=MessageSearchDirection.UP, MessageSearchScope scope=MessageSearchScope.CONTENT, ValueCallBack< Dictionary< string, List< string > > > callback=null)
void GetReactionDetail (string messageId, string reaction, string cursor=null, int pageSize=20, ValueCallBack< CursorResult< MessageReaction > > callback=null)
void GetConversationsFromServerWithPage (int pageNum, int pageSize, ValueCallBack< List< Conversation > > callback=null)
void RemoveMessagesFromServer (string conversationId, ConversationType conversationType, List< string > messageIdList, CallBack callback=null)
void RemoveMessagesFromServer (string conversationId, ConversationType conversationType, long timeStamp, CallBack callback=null)
void PinConversation (string conversationId, bool isPinned, CallBack callback=null)
void FetchCombineMessageDetail (Message msg, ValueCallBack< List< Message > > callback=null)
void MarkConversations (List< string > conversationIds, bool isMarked, MarkType mark, CallBack callback=null)
void DeleteAllMessagesAndConversations (bool clearServerData, CallBack callback=null)
void PinMessage (string messageId, bool isPinned, CallBack callback=null)
void GetPinnedMessagesFromServer (string conversationId, ValueCallBack< List< Message > > callback=null)
void LoadMessages (List< string > messageIdList, string conversationId, ValueCallBack< List< Message > > callback=null)
void AddChatManagerDelegate (IChatManagerDelegate chatManagerDelegate)
void RemoveChatManagerDelegate (IChatManagerDelegate chatManagerDelegate)

Member Function Documentation

◆ DeleteConversation()

bool AgoraChat.ChatManager.DeleteConversation ( string conversationId,
bool deleteMessages = true )

Deletes a conversation from the local database.

If you set deleteMessages to true, local historical messages will be deleted with the conversation.

Parameters
conversationIdThe conversation ID.
deleteMessagesWhether to delete local historical messages with the conversation.
  • true: Yes.
  • false: No.
Returns
Whether the conversation is successfully deleted:
  • true: Yes.
  • false: No.

◆ DownloadAttachment()

void AgoraChat.ChatManager.DownloadAttachment ( string messageId,
CallBack callback = null )

Downloads the message attachment.

You can also call this method if the attachment fails to be downloaded automatically.

Parameters
messageIdThe ID of the message with the attachment to be downloaded.
callbackThe download status callback. See CallBack.

◆ DownloadThumbnail()

void AgoraChat.ChatManager.DownloadThumbnail ( string messageId,
CallBack callback = null )

Downloads the message thumbnail.

You can also call this method if the message thumbnail fails to be downloaded automatically.

Parameters
messageIdThe ID of the message with the thumbnail to be downloaded.
callbackThe download status callback. See CallBack.

◆ FetchHistoryMessagesFromServer()

void AgoraChat.ChatManager.FetchHistoryMessagesFromServer ( string conversationId,
ConversationType type = ConversationType::Chat,
string startMessageId = null,
int count = 20,
MessageSearchDirection direction = MessageSearchDirection::UP,
ValueCallBack< CursorResult< Message > > callback = null )

Gets historical messages of the conversation from the server.

Historical messages of a conversation can also be obtained with pagination.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
typeThe conversation type. See ConversationType.
startMessageIdThe starting message ID for the query. If null is passed, the SDK gets messages in the reverse chronological order of when the server received the messages.
countThe number of messages that you expect to get on each page.
directionThe direction in which the message is fetched. MessageSearchDirection can be set with following:
  • UP: Gets messages before the timestamp of the specified message ID;
  • DOWN: Gets messages after the timestamp of the specified message ID.
callbackThe result callback. Returns the list of obtained messages.

◆ FetchHistoryMessagesFromServerBy()

void AgoraChat.ChatManager.FetchHistoryMessagesFromServerBy ( string conversationId,
ConversationType type = ConversationType::Chat,
string cursor = null,
int pageSize = 10,
FetchServerMessagesOption option = null,
ValueCallBack< CursorResult< Message > > callback = null )

Gets historical messages of a conversation from the server according to the parameter configuration class for pulling historical messages FetchServerMessagesOption.

Historical messages of a conversation can be obtained with pagination.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
typeThe conversation type. See ConversationType.
cursorThe cursor position from which to start querying data.
pageSizeThe number of messages that you expect to get on each page. The value range is [1,50].
optionThe parameter configuration class for pulling historical messages from the server. See FetchServerMessagesOption.
callbackThe result callback. The SDK returns the list of obtained messages.

◆ GetConversation()

Conversation AgoraChat.ChatManager.GetConversation ( string conversationId,
ConversationType type = ConversationType::Chat,
bool createIfNeed = true )

Gets the local conversation object.

The SDK wil return null if the conversation is not found.

Parameters
conversationIdThe conversation ID.
typeThe conversation type. See ConversationType.
createIfNeedWhether to automatically create a conversation if the conversation is not found.
  • true: Yes.
  • false: No.
Returns
The conversation found. Returns null if the conversation is not found.

◆ GetThreadConversation()

Conversation AgoraChat.ChatManager.GetThreadConversation ( string threadId)

Gets the local thread conversation object.

The SDK wil return null if the conversation is not found.

Parameters
threadIdThe thread ID.
Returns
The conversation found. Returns null if the conversation is not found.

◆ GetConversationsFromServer()

void AgoraChat.ChatManager.GetConversationsFromServer ( ValueCallBack< List< Conversation > > callback = null)

Gets all conversations from the server.

An empty list will be returned if no conversation is found.

Parameters
callbackThe list of obtained conversations. See ValueCallBack.

◆ GetConversationsFromServerWithCursor() [1/2]

void AgoraChat.ChatManager.GetConversationsFromServerWithCursor ( bool pinOnly,
string cursor = "",
int limit = 20,
ValueCallBack< CursorResult< Conversation > > callback = null )

Gets the conversations from the server.

Parameters
pingOnlyWhether to return pinned conversations only:
  • true: Yes. The SDK only returns pinned conversations in the reverse chronological order of their pinning.
  • false: No.
cursorThe position from which to start getting data.
limitThe number of conversations that you expect to get on each page. The value range is [1,50].
callbackThe list of obtained conversations. See ValueCallBack.

◆ GetConversationsFromServerWithCursor() [2/2]

void AgoraChat.ChatManager.GetConversationsFromServerWithCursor ( MarkType mark,
string cursor = "",
int limit = 20,
ValueCallBack< CursorResult< Conversation > > callback = null )

Gets the conversations from the server based on the conversation mark.

Parameters
markThe mark value used for searching.
cursorThe position from which to start getting data.
limitThe number of conversations that you expect to get on each page. The value range is [1,50].
callbackThe list of obtained conversations. See ValueCallBack.

◆ GetUnreadMessageCount()

int AgoraChat.ChatManager.GetUnreadMessageCount ( )

Gets the unread message count.

Returns
The count of unread messages.

◆ GetMessageCount()

void AgoraChat.ChatManager.GetMessageCount ( ValueCallBack< int > callback = null)

Gets the message count in DB.

Returns
The count of messages in DB.
Parameters
callbackReturns the total number of messages on success, -1 on failure. See ValueCallBack

◆ ImportMessages()

void AgoraChat.ChatManager.ImportMessages ( List< Message > messages,
CallBack callback = null )

Imports messages to the local database.

You can only import messages that you sent or received.

Parameters
messagesThe messages to be imported.
Returns
Whether messages are successfully imported to the local database.
  • true: Yes.
  • false: No.

◆ LoadAllConversations()

List< Conversation > AgoraChat.ChatManager.LoadAllConversations ( )

Loads all conversations from the local database into the memory.

To accelerate the loading, call this method immediately after the user is logged in.

Returns
The list of loaded conversations.

◆ LoadMessage()

Message AgoraChat.ChatManager.LoadMessage ( string messageId)

Loads a specified message from the local database into the memory.

Parameters
messageIdThe ID of the message to be loaded.
Returns
The loaded message object.

◆ MarkAllConversationsAsRead()

bool AgoraChat.ChatManager.MarkAllConversationsAsRead ( )

Marks all local conversations as read.

Returns
Whether all local conversations are marked as read.
  • true: Yes.
  • false: No.

◆ RecallMessage()

void AgoraChat.ChatManager.RecallMessage ( string messageId,
string ext,
CallBack callback = null )

Recalls the message.

This is an asynchronous method.

Parameters
messageThe ID of the message to be recalled.
extPrompt information when recalled the message.
callbackThe recall status callback. See CallBack.

◆ ResendMessage()

Message AgoraChat.ChatManager.ResendMessage ( string messageId,
CallBack callback = null )

Resends the message.[Deprecated]

This is an asynchronous method.

Parameters
messageThe ID of the message to be resent.
callbackThe resending status callback. See CallBack.
Returns
The message that is resent.

◆ SearchMsgFromDB() [1/2]

void AgoraChat.ChatManager.SearchMsgFromDB ( string keywords,
long timestamp = 0,
int maxCount = 20,
string from = null,
MessageSearchDirection direction = MessageSearchDirection::UP,
ValueCallBack< List< Message > > callback = null )

Retrieves local messages of a certain quantity.

Note If you want to query a great number of messages, pay attention to the memory consumption. A maximum number of 200 messages can be retrieved each time.

Parameters
keywordsThe keyword for query. The data format is String.
timestampThe starting Unix timestamp for query, which is in milliseconds. After this parameter is set, the SDK retrieves messages, starting from the specified one, according to the message search direction. If you set this parameter as a negative value, the SDK retrieves messages, starting from the current time, in the descending order of the the Unix timestamp included in them.
maxCountThe maximum number of messages to retrieve.
fromThe user ID of the message sender. If you do not set this parameter, the SDK ignores this parameter when retrieving messages.
directionThe query direction. See MessageSearchDirection.
callbackIf success, a list of original messages included in the combined message are returned; otherwise, an error is returned. See ValueCallBack.

◆ SearchMsgFromDB() [2/2]

void AgoraChat.ChatManager.SearchMsgFromDB ( string keywords,
long timestamp = 0,
int maxCount = 20,
string from = null,
MessageSearchDirection direction = MessageSearchDirection::UP,
MessageSearchScope scope = MessageSearchScope::CONTENT,
ValueCallBack< List< Message > > callback = null )

Queries local messages based on the message scope.

Note If you want to query a great number of messages, pay attention to the memory consumption. A maximum number of 200 messages can be retrieved each time.

Parameters
keywordsThe keyword for query. The data format is String.
timestampThe starting Unix timestamp for query, which is in milliseconds.
maxCountThe maximum number of messages to retrieve.
fromThe user ID of the message sender. If you do not set this parameter, the SDK ignores this parameter when retrieving messages.
directionThe query direction. See MessageSearchDirection.
scopeThe query direction. See MessageSearchScope.
callbackIf success, a list of original messages included in the combined message are returned; otherwise, an error is returned. See ValueCallBack.

◆ SendConversationReadAck()

void AgoraChat.ChatManager.SendConversationReadAck ( string conversationId,
CallBack callback = null )

Sends the conversation read receipt to the server.

After this method is called, the sever will set the message status from unread to read.

The SDK triggers the IChatManagerDelegate#OnConversationRead(string from, string to) callback on the message sender's client, notifying that the messages are read. This also applies to multi-device scenarios.

Parameters
conversationIdThe conversation ID.
callbackThe result callback. See CallBack.

◆ SendMessage()

void AgoraChat.ChatManager.SendMessage ( ref Message message,
CallBack callback = null )

Sends a message。

This is an asynchronous method.

For attachment messages such as voice or image, the SDK will automatically upload the attachment by default. See Options#ServerTransfer.

Parameters
msgThe message object to be sent. Ensure that you set this parameter.
callbackThe result callback. See CallBack.

◆ SendMessageReadAck()

void AgoraChat.ChatManager.SendMessageReadAck ( string messageId,
CallBack callback = null )

Sends the read receipt of a one-to-one message to the server.

After this method is called, the sever will set the message status from unread to read.

The SDK triggers the IChatManagerDelegate#OnMessagesRead(List<Message>) callback on the message sender's client, notifying that the messages are read. This also applies to multi-device scenarios.

Parameters
messageIdThe message ID.
callbackThe result callback. See CallBack.

◆ SendReadAckForGroupMessage()

void AgoraChat.ChatManager.SendReadAckForGroupMessage ( string messageId,
string ackContent,
CallBack callback = null )

Sends a read receipt for a group message to the server.

You can only call the method after setting Options#RequireAck(boolean) and Message#IsNeedGroupAck(boolean).

To send the read recipient for a one-to-one chat message to the server, call SendMessageReadAck(String).

To send the conversation read receipt to the server, call SendConversationReadAck(String).

Parameters
messageIdThe message ID.
ackContentThe content of the read receipt. The content is a self-defined string that can be used for specifying custom action/command.
callbackThe result callback. See{@ link CallBack}.

◆ UpdateMessage()

bool AgoraChat.ChatManager.UpdateMessage ( Message message)

Updates the local message.

After this method is called, messages in both the local memory and local database will be updated.

Parameters
messageThe message object to update.
Returns
Whether the local message is successfully updated.
  • true: Yes.
  • false: No.

◆ ModifyMessage() [1/2]

void AgoraChat.ChatManager.ModifyMessage ( string messageId,
MessageBody.TextBody body,
ValueCallBack< Message > callback = null )

Modifies a message.

After this method is called to modify a message, both the local message and the message on the server are modified.

This method can only modify a text message in one-to-one chats or group chats, but not in chat rooms.

Parameters
messageIdThe ID of the message to modify.
bodyThe modified message body.
callBackThe result callback. See CallBack().

◆ ModifyMessage() [2/2]

void AgoraChat.ChatManager.ModifyMessage ( string messageId,
IMessageBody body = null,
Dictionary< string, AttributeValue > attributes = null,
ValueCallBack< Message > callback = null )

Modifies a message both in the local storage and server.

  • Text and custom message: Both the message body body and extension information ext can be modified.
  • Image/voice/video/file/combined message: Only the message extension field ext can be modified.
  • Command message: This type of message cannot be modified.

Note that the message ID cannot be changed.

Parameters
messageIdThe ID of the message for modification.
bodyThe modified message body. You can only modify the body of a text message and a custom message. The value null indicates that the message body remains unchanged.
attributesThe modified message extension information. The new extension information will overwrite the previous. The value null indicates that the message extension information remains unchanged.
callbackThe completion block, which contains the error message if the method fails. If both body and attributes are null, the parameter error will be returned.

◆ RemoveMessagesBeforeTimestamp()

void AgoraChat.ChatManager.RemoveMessagesBeforeTimestamp ( long timeStamp,
CallBack callback = null )

Removes messages that are sent and received before the Unix timestamp from the local memory and database.

Parameters
timeStampThe starting Unix timestamp for removal.
callbackThe removal result callback. See CallBack.

◆ DeleteConversationFromServer()

void AgoraChat.ChatManager.DeleteConversationFromServer ( string conversationId,
ConversationType conversationType,
bool isDeleteServerMessages,
CallBack callback = null )

Deletes the specified conversation and its historical messages from the server.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
conversationTypeThe conversation type. See ConversationType.
isDeleteServerMessagesWhether to delete the historical messages with the conversation.
  • true: Yes.
  • false: No.
callbackCallback for whether the conversation is deleted. See CallBack.

◆ FetchSupportLanguages()

void AgoraChat.ChatManager.FetchSupportLanguages ( ValueCallBack< List< SupportLanguage > > callback = null)

获取翻译服务支持的语言。

Parameters
callBack完成的回调,详见 ValueCallBack()

~english Gets all languages supported by the translation service.

Parameters
callBackThe result callback. See ValueCallBack().

◆ TranslateMessage()

void AgoraChat.ChatManager.TranslateMessage ( Message message,
List< string > targetLanguages,
ValueCallBack< Message > callback = null )

Translates a message.

Parameters
messageThe message object.
languagesThe code list of the target languages.
callBackThe result callback. See CallBack().

◆ FetchGroupReadAcks()

void AgoraChat.ChatManager.FetchGroupReadAcks ( string messageId,
string groupId,
int pageSize = 20,
string startAckId = null,
ValueCallBack< CursorResult< GroupReadAck > > callback = null )

Uses the pagination to get read receipts for a group message from the server.

To send a read receipt for a group message, you can call SendReadAckForGroupMessage.

This is an asynchronous method.

Parameters
msgIdThe message ID.
groupIdThe group ID。
pageSizeThe number of read receipts for the group message that you expect to get on each page. The value range is [1,50].
startAckIdThe starting read receipt ID for query. After this parameter is set, the SDK retrieves read receipts, from the specified one, in the reverse chronological order of when the server receives them. If you set this parameter as null, the SDK will retrieve from the latest read receipt.
callBackThe result callback. If the call succeeds, the SDK executes ValueCallBack#onSuccess(Object); if the call fails, the SDK executes ValueCallBack#onError(int, String).

◆ ReportMessage()

void AgoraChat.ChatManager.ReportMessage ( string messageId,
string tag,
string reason,
CallBack callback = null )

Reports an inappropriate message.

Parameters
messageIdThe ID of the message to report.
tagThe tag of the inappropriate message. You need to type a custom tag, like porn or ad.
reasonThe reporting reason. You need to type a specific reason.
callBackThe result callback,see CallBack().

◆ AddReaction()

void AgoraChat.ChatManager.AddReaction ( string messageId,
string reaction,
CallBack callback = null )

Adds a Reaction.

This is an asynchronous method.

Parameters
messageIdThe message ID.
reactionThe message Reaction.
callbackThe result callback which contains the error information if the method fails.

◆ RemoveReaction()

void AgoraChat.ChatManager.RemoveReaction ( string messageId,
string reaction,
CallBack callback = null )

Deletes a Reaction.

This is an asynchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction content.
callbackThe result callback which contains the error information if the method fails.

◆ GetReactionList()

void AgoraChat.ChatManager.GetReactionList ( List< string > messageIdList,
MessageType chatType,
string groupId,
ValueCallBack< Dictionary< string, List< MessageReaction > > > callback = null )

Gets the list of Reactions.

This is an asynchronous method.

Parameters
messageIdListThe message ID.
chatTypeThe chat type. Only one-to-one chat (ConversationType.Chat and group chat (ConversationType.Group) are allowed.
groupIdThe group ID, which is valid only when the chat type is group chat.
callbackThe result callback, which contains the Reaction list under the specified message ID(The user list of EMMessageReaction is the summary data, which only contains the information of the first three users).

◆ LoadConversationMessagesWithKeyword()

void AgoraChat.ChatManager.LoadConversationMessagesWithKeyword ( string keywords,
long timestamp = -1,
string from = null,
MessageSearchDirection direction = MessageSearchDirection::UP,
MessageSearchScope scope = MessageSearchScope::CONTENT,
ValueCallBack< Dictionary< string, List< string > > > callback = null )

Loads messages with the specified keyword from the local database, returning a dictionary containing conversation IDs and message ID arrays. The SDK returns messages in chronological order.

This is an asynchronous method.

Parameters
keywordsThe keyword for message search. If you set this parameter as null, the SDK ignores this parameter when retrieving messages.
timestampThe Unix timestamp threshold for message search. The unit is millisecond. If you set this parameter as a negative value, the SDK loads messages from the latest one.
fromThe sender of the message. If you set this parameter as null, the SDK ignores this parameter when retrieving messages.
directionThe message search direction. See MessageSearchDirection.
  • UP: The SDK retrieves messages in the descending order of the timestamp included in them.
  • DOWN:The SDK retrieves messages in the ascending order of the timestamp included in them.
scopeThe message search scope. See MessageSearchScope.
callbackThe result callback, which contains the conversation IDs and corresponding message ID lists.

◆ GetReactionDetail()

void AgoraChat.ChatManager.GetReactionDetail ( string messageId,
string reaction,
string cursor = null,
int pageSize = 20,
ValueCallBack< CursorResult< MessageReaction > > callback = null )

Gets the Reaction details.

This is an asynchronous method.

Parameters
messageIdThe message ID.
reactionThe Reaction content.
cursorThe query cursor.
pageSizeThe number of Reactions you expect to get on each page.
callbackThe result callback, which contains the reaction list obtained from the server and the cursor for the next query. Returns null if all the data is fetched.

◆ GetConversationsFromServerWithPage()

void AgoraChat.ChatManager.GetConversationsFromServerWithPage ( int pageNum,
int pageSize,
ValueCallBack< List< Conversation > > callback = null )

Gets the conversations from the server.

An empty list will be returned if no conversation is found.

Parameters
pageNumThe current page number.
pageSizeThe number of conversations to get on each page.
callbackThe list of obtained conversations. See ValueCallBack.

◆ RemoveMessagesFromServer() [1/2]

void AgoraChat.ChatManager.RemoveMessagesFromServer ( string conversationId,
ConversationType conversationType,
List< string > messageIdList,
CallBack callback = null )

Removes messages in a conversation (from both local storage and the server).

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
conversationTypeThe conversation type. See ConversationType.
messageIdListThe list of IDs of messages to be removed.
callbackCallback for the operation. See CallBack.

◆ RemoveMessagesFromServer() [2/2]

void AgoraChat.ChatManager.RemoveMessagesFromServer ( string conversationId,
ConversationType conversationType,
long timeStamp,
CallBack callback = null )

Removes messages in a conversation (from both local storage and the server).

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
conversationTypeThe conversation type. See ConversationType.
timeStampThe specified Unix timestamp in milliseconds. Messages with a timestamp before the specified one will be removed from the conversation.
callbackCallback for the operation. See CallBack.

◆ PinConversation()

void AgoraChat.ChatManager.PinConversation ( string conversationId,
bool isPinned,
CallBack callback = null )

Sets whether to pin a conversation.

This is an asynchronous method.

Parameters
conversationIdThe conversation ID.
isPinnedWhether to pin the conversation:
  • true: Yes.
  • false: No.
callbackCallback for the operation. See CallBack.

◆ FetchCombineMessageDetail()

void AgoraChat.ChatManager.FetchCombineMessageDetail ( Message msg,
ValueCallBack< List< Message > > callback = null )

Gets and parses the combined message.

Parameters
msgThe combined message to get and parse.
callbackIf success, a list of original messages included in the combined message are returned; otherwise, an error is returned. See ValueCallBack.

◆ MarkConversations()

void AgoraChat.ChatManager.MarkConversations ( List< string > conversationIds,
bool isMarked,
MarkType mark,
CallBack callback = null )

Marks or unmarks conversations.

This is an asynchronous method.

This method marks conversations both locally and on the server.

Parameters
conversationIdsThe list of conversation IDs.
isMarkedWhether to add or remove the mark for the conversations.
  • true: add.
  • false: remove.
markThe conversation mark to add or remove.
callbackCallback for the operation. See CallBack.

◆ DeleteAllMessagesAndConversations()

void AgoraChat.ChatManager.DeleteAllMessagesAndConversations ( bool clearServerData,
CallBack callback = null )

Clears all conversations and all messages in them.

This is an asynchronous method.

Parameters
clearServerDataWhether to clear all conversations and all messages in them on the server.
  • true:Yes. All conversations and all messages in them will be cleared on the server side. The current user cannot retrieve messages and conversations from the server, while this has no impact on other users.
  • (Default) false:No. All local conversations and all messages in them will be cleared, while those on the server remain.
    Parameters
    callbackCallback for the operation. See CallBack.

◆ PinMessage()

void AgoraChat.ChatManager.PinMessage ( string messageId,
bool isPinned,
CallBack callback = null )

Pins or unpins a message.

This is an asynchronous method.

Parameters
messageIdThe message ID to be pinned or unpinned.
isPinnedWhether to pin the message:
  • true: pin.
  • false: unpin.
callbackCallback for the operation. See CallBack.

◆ GetPinnedMessagesFromServer()

void AgoraChat.ChatManager.GetPinnedMessagesFromServer ( string conversationId,
ValueCallBack< List< Message > > callback = null )

Gets the list of pinned messages in the conversation from the server.

Parameters
msgThe conversation ID.
callbackIf success, the list of pined messages in the conversation are returned; otherwise, an error is returned. See ValueCallBack.

◆ LoadMessages()

void AgoraChat.ChatManager.LoadMessages ( List< string > messageIdList,
string conversationId,
ValueCallBack< List< Message > > callback = null )

Gets messages with the specified IDs from the local database. A maximum of 20 messages can be retrieved at a time, and the returned messages are sorted in reverse chronological order.

Parameters
messageIdListThe message ID list.
conversationIdThe conversation ID which messages in.
callbackIf success, the list of messages are returned; otherwise, an error is returned. See ValueCallBack.

◆ AddChatManagerDelegate()

void AgoraChat.ChatManager.AddChatManagerDelegate ( IChatManagerDelegate chatManagerDelegate)

Adds a chat manager listener.

Parameters
chatManagerDelegateThe chat manager listener to add. It is inherited from IChatManagerDelegate.

◆ RemoveChatManagerDelegate()

void AgoraChat.ChatManager.RemoveChatManagerDelegate ( IChatManagerDelegate chatManagerDelegate)

移除聊天管理器的监听器。

Parameters
chatManagerDelegate要移除的聊天管理器的监听器,继承自 IChatManagerDelegate

~english Removes a chat manager listener.

Parameters
chatManagerDelegateThe chat manager listener to remove. It is inherited from IChatManagerDelegate.