Chat SDK for Unity and Windows v1.2.0
Public 成员函数 | 所有成员列表
AgoraChat.ContactManager类 参考
类 AgoraChat.ContactManager 继承关系图:

Public 成员函数

void AddContact (string userId, string reason=null, CallBack callback=null)
 
void DeleteContact (string userId, bool keepConversation=false, CallBack callback=null)
 
void GetAllContactsFromServer (ValueCallBack< List< string > > callback=null)
 
List< string > GetAllContactsFromDB ()
 
void AddUserToBlockList (string userId, CallBack callback=null)
 
void RemoveUserFromBlockList (string userId, CallBack callback=null)
 
void GetBlockListFromServer (ValueCallBack< List< string > > callback=null)
 
List< string > GetBlockListFromDB ()
 
void AcceptInvitation (string userId, CallBack callback=null)
 
void DeclineInvitation (string userId, CallBack callback=null)
 
void GetSelfIdsOnOtherPlatform (ValueCallBack< List< string > > callback=null)
 
void AddContactManagerDelegate (IContactManagerDelegate contactManagerDelegate)
 
void RemoveContactManagerDelegate (IContactManagerDelegate contactManagerDelegate)
 

详细描述

联系人管理类,用于添加、查询和删除联系人。

成员函数说明

◆ AddContact()

void AgoraChat.ContactManager.AddContact ( string  userId,
string  reason = null,
CallBack  callback = null 
)

添加好友。

异步方法。

参数
userId要添加为好友的用户 ID。
reason添加好友的原因,即邀请消息。该参数可选,可设置为 null 或 ""。
callback结果回调,详见 CallBack

◆ DeleteContact()

void AgoraChat.ContactManager.DeleteContact ( string  userId,
bool  keepConversation = false,
CallBack  callback = null 
)

删除联系人及其相关的会话。

异步方法。

参数
userId要删除的联系人的用户 ID。
keepConversation是否保留要删除的联系人的会话。
  • true:是;
  • (默认)false:否。
callback结果回调,详见 CallBack

◆ GetAllContactsFromServer()

void AgoraChat.ContactManager.GetAllContactsFromServer ( ValueCallBack< List< string > >  callback = null)

从服务器获取联系人列表。

异步方法。

参数
callback结果回调。成功则返回联系人列表,失败返回错误信息,详见 ValueCallBack

◆ GetAllContactsFromDB()

List< string > AgoraChat.ContactManager.GetAllContactsFromDB ( )

从本地数据库获取联系人列表。

返回
调用成功会返回好友列表,失败返回空列表。

◆ AddUserToBlockList()

void AgoraChat.ContactManager.AddUserToBlockList ( string  userId,
CallBack  callback = null 
)

将指定用户加入黑名单。 你可以向黑名单中用户发消息,但是接收不到对方发送的消息。

异步方法。

参数
userId要加入黑名单的用户的用户 ID。
callback结果回调,详见 CallBack

◆ RemoveUserFromBlockList()

void AgoraChat.ContactManager.RemoveUserFromBlockList ( string  userId,
CallBack  callback = null 
)

将指定用户移除黑名单。

异步方法。

参数
userId要在黑名单中移除的用户 ID。
callback结果回调,详见 CallBack

◆ GetBlockListFromServer()

void AgoraChat.ContactManager.GetBlockListFromServer ( ValueCallBack< List< string > >  callback = null)

从服务器获取黑名单列表。

异步方法。

参数
callback结果回调。调用成功则返回黑名单列表,失败返回错误信息。详见 ValueCallBack

◆ GetBlockListFromDB()

List< string > AgoraChat.ContactManager.GetBlockListFromDB ( )

从本地获取黑名单列表。

返回
The blocklist.

◆ AcceptInvitation()

void AgoraChat.ContactManager.AcceptInvitation ( string  userId,
CallBack  callback = null 
)

接受加好友的邀请。

异步方法。

参数
userId发起好友邀请的用户 ID。
callback结果回调,详见 CallBack

◆ DeclineInvitation()

void AgoraChat.ContactManager.DeclineInvitation ( string  userId,
CallBack  callback = null 
)

拒绝加好友的邀请。

异步方法。

参数
userId发起好友邀请的用户 ID。
callback该方法完成的回调,详见 CallBack

◆ GetSelfIdsOnOtherPlatform()

void AgoraChat.ContactManager.GetSelfIdsOnOtherPlatform ( ValueCallBack< List< string > >  callback = null)

获取登录用户在其他登录设备上唯一 ID。

该 ID 由 user ID + "/" + resource 组成。

异步方法。

参数
callback该方法完成的回调。调用成功会返回用户在其他登录设备上的 ID;失败则返回错误信息。详见 ValueCallBack

◆ AddContactManagerDelegate()

void AgoraChat.ContactManager.AddContactManagerDelegate ( IContactManagerDelegate  contactManagerDelegate)

注册联系人监听器。

参数
contactManagerDelegate要注册的联系人监听器,继承自 IContactManagerDelegate

◆ RemoveContactManagerDelegate()

void AgoraChat.ContactManager.RemoveContactManagerDelegate ( IContactManagerDelegate  contactManagerDelegate)

移除联系人监听器。

参数
contactManagerDelegate要移除的联系人监听器,继承自 IContactManagerDelegate