NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim::Friend类 参考

NIM 好友相关接口 更多...

#include <nim_cpp_friend.h>

Public 类型

typedef std::function< void(const FriendChangeEvent &)> FriendChangeCallback
 好友信息变更通知回调模板
 
typedef std::function< void(NIMResCode res_code)> FriendOptCallback
 变更好友信息回调模板
 
typedef std::function< void(NIMResCode res_code, const std::list< nim::FriendProfile > &user_profile_list)> GetFriendsListCallback
 获取好友回调模板
 
typedef std::function< void(const std::string &accid, const nim::FriendProfile &user_profile)> GetFriendProfileCallback
 获取好友信息回调模板
 

静态 Public 成员函数

static void RegChangeCb (const FriendChangeCallback &cb, const std::string &json_extension="")
 
static bool Request (const std::string &accid, NIMVerifyType verify_type, const std::string &msg, const FriendOptCallback &cb, const std::string &json_extension="")
 
static bool Delete (const std::string &accid, const FriendOptCallback &cb, const std::string &json_extension="")
 
static bool DeleteEx (const std::string &accid, const DeleteFriendOption &option, const FriendOptCallback &cb)
 
static bool Update (const FriendProfile &friend_profile, const FriendOptCallback &cb, const std::string &json_extension="")
 
static void GetList (const GetFriendsListCallback &cb, const std::string &json_extension="")
 
static void GetFriendProfile (const std::string &accid, const GetFriendProfileCallback &cb, const std::string &json_extension="")
 
static bool ParseFriendAddEvent (const FriendChangeEvent &change_event, FriendAddEvent &out_event)
 
static bool ParseFriendDelEvent (const FriendChangeEvent &change_event, FriendDelEvent &out_event)
 
static bool ParseFriendProfileUpdateEvent (const FriendChangeEvent &change_event, FriendProfileUpdateEvent &out_event)
 
static bool ParseFriendProfileSyncEvent (const FriendChangeEvent &change_event, FriendProfileSyncEvent &out_event)
 
static void UnregFriendCb ()
 
static bool QueryFriendshipBlock (const std::string &accid, const std::string &json_extension="")
 
static bool QueryFriendListByKeyword (const std::string &keyword, const GetFriendsListCallback &cb, const std::string &json_extension="")
 

详细描述

NIM 好友相关接口

成员类型定义说明

◆ FriendChangeCallback

typedef std::function<void(const FriendChangeEvent&)> nim::Friend::FriendChangeCallback

好友信息变更通知回调模板

◆ FriendOptCallback

typedef std::function<void(NIMResCode res_code)> nim::Friend::FriendOptCallback

变更好友信息回调模板

◆ GetFriendProfileCallback

typedef std::function<void(const std::string& accid, const nim::FriendProfile& user_profile)> nim::Friend::GetFriendProfileCallback

获取好友信息回调模板

◆ GetFriendsListCallback

typedef std::function<void(NIMResCode res_code, const std::list<nim::FriendProfile>& user_profile_list)> nim::Friend::GetFriendsListCallback

获取好友回调模板

成员函数说明

◆ Delete()

static bool nim::Friend::Delete ( const std::string &  accid,
const FriendOptCallback cb,
const std::string &  json_extension = "" 
)
static

删除好友

参数
[in]accid对方帐号
[in]cb删除好友回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
bool 检查参数如果不符合要求则返回失败
注解
错误码 200:成功 404:用户不存在 500:未知错误

◆ DeleteEx()

static bool nim::Friend::DeleteEx ( const std::string &  accid,
const DeleteFriendOption option,
const FriendOptCallback cb 
)
static

删除好友

参数
[in]accid对方帐号
[in]option删除好友选项,目前仅有是否删除备注信息选项
[in]cb删除好友回调函数
返回
bool 检查参数如果不符合要求则返回失败
注解
错误码 200:成功 404:用户不存在 500:未知错误

◆ GetFriendProfile()

static void nim::Friend::GetFriendProfile ( const std::string &  accid,
const GetFriendProfileCallback cb,
const std::string &  json_extension = "" 
)
static

获取好友信息

参数
[in]accid对方帐号
[in]cb获取好友信息回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
void 无返回值

◆ GetList()

static void nim::Friend::GetList ( const GetFriendsListCallback cb,
const std::string &  json_extension = "" 
)
static

增量获取好友列表

参数
[in]cb获取好友列表回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
void 无返回值
注解
错误码 200:成功

◆ ParseFriendAddEvent()

static bool nim::Friend::ParseFriendAddEvent ( const FriendChangeEvent change_event,
FriendAddEvent out_event 
)
static

解析收到的好友添加请求通知

参数
[in]change_event好友添加请求通知
[out]out_event解析后结果
返回
bool 解析是否成功

◆ ParseFriendDelEvent()

static bool nim::Friend::ParseFriendDelEvent ( const FriendChangeEvent change_event,
FriendDelEvent out_event 
)
static

解析收到的好友删除通知

参数
[in]change_event好友删除通知
[out]out_event解析后结果
返回
bool 解析是否成功

◆ ParseFriendProfileSyncEvent()

static bool nim::Friend::ParseFriendProfileSyncEvent ( const FriendChangeEvent change_event,
FriendProfileSyncEvent out_event 
)
static

解析收到的好友简况同步通知

参数
[in]change_event好友简况同步通知
[out]out_event解析后结果
返回
bool 解析是否成功

◆ ParseFriendProfileUpdateEvent()

static bool nim::Friend::ParseFriendProfileUpdateEvent ( const FriendChangeEvent change_event,
FriendProfileUpdateEvent out_event 
)
static

解析收到的好友简况更新通知

参数
[in]change_event好友用户信息更新通知
[out]out_event解析后结果
返回
bool 解析是否成功

◆ QueryFriendListByKeyword()

static bool nim::Friend::QueryFriendListByKeyword ( const std::string &  keyword,
const GetFriendsListCallback cb,
const std::string &  json_extension = "" 
)
static

增量获取好友列表

参数
[in]keyword要查询的关键字
[in]cb获取好友列表回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
bool 返回 true 表示发送查询请求成功,返回 false 表示关键字为空
注解
错误码 200:成功

◆ QueryFriendshipBlock()

bool nim::Friend::QueryFriendshipBlock ( const std::string &  accid,
const std::string &  json_extension = "" 
)
static

在本地缓存数据中查询accid是否为自己的好友(同步接口,堵塞NIM内部线程,谨慎使用)

参数
[in]accid对方帐号
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
bool 当正向和反向好友关系都为好友时返回true

◆ RegChangeCb()

static void nim::Friend::RegChangeCb ( const FriendChangeCallback cb,
const std::string &  json_extension = "" 
)
static

(全局回调)统一注册好友变更通知回调函数(多端同步添加、删除、更新,好友列表同步)

参数
[in]cb好友变更通知回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
void 无返回值
注解
错误码 200:成功 404:用户不存在 500:未知错误

◆ Request()

static bool nim::Friend::Request ( const std::string &  accid,
NIMVerifyType  verify_type,
const std::string &  msg,
const FriendOptCallback cb,
const std::string &  json_extension = "" 
)
static

添加、验证好友

参数
[in]accid对方帐号
[in]verify_type好友验证类型
[in]msg接口扩展字段
[in]cb好友请求回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
bool 检查参数如果不符合要求则返回失败
注解
错误码 200:成功 404:用户不存在 500:未知错误

◆ UnregFriendCb()

void nim::Friend::UnregFriendCb ( )
static

反注册Friend提供的所有回调

返回
void 无返回值

◆ Update()

static bool nim::Friend::Update ( const FriendProfile friend_profile,
const FriendOptCallback cb,
const std::string &  json_extension = "" 
)
static

更新好友资料

参数
[in]friend_profile好友资料
[in]cb更新好友资料回调函数
[in]json_extensionjson扩展参数(备用,目前不需要)
返回
bool 检查参数如果不符合要求则返回失败
注解
错误码 200:成功 404:用户不存在 500:未知错误

该类的文档由以下文件生成: