7#ifndef _NIM_SDK_CPP_FRIEND_HELPER_H_
8#define _NIM_SDK_CPP_FRIEND_HELPER_H_
40 kFriendProfileKeyAll = (1 << 7) - 1
46 : delete_alias_(
true) {}
62 , value_available_flag_(0) {}
72 , value_available_flag_(0) {
77 void SetAccId(
const std::string& accid) { accid_ = accid; }
80 std::string
GetAccId()
const {
return accid_; }
93 passive_relationship_ = flag;
138 server_expand_ = srv_ex;
162 bool ExistValue(FriendProfileKey key)
const {
return (value_available_flag_ & key) != 0; }
185 if (create_timetag_ > 0)
187 if (update_timetag_ > 0)
198 assert(profile.
accid_ == accid_);
199 if (profile.
accid_ != accid_)
210 bits_ = profile.
bits_;
Represents a JSON value.
Definition: value.h:196
bool ParseFriendsProfile(const std::string &friends_profile_json, std::list< FriendProfile > &profiles)
解析(多)好友信息
Definition: nim_friend_helper.cpp:10
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
bool ParseFriendProfile(const std::string &friend_profile_json, FriendProfile &profile)
解析(单个)好友信息
Definition: nim_friend_helper.cpp:26
NIMFriendChangeType
Definition: nim_friend_def.h:80
static const char * kNIMFriendServerEx
string, 服务端扩展字段,此字段客户端sdk只读,服务端api读写
Definition: nim_friend_def.h:42
static const char * kNIMFriendKeyAccid
string, 好友帐号
Definition: nim_friend_def.h:24
static const char * kNIMFriendKeySource
NIMFriendSource, 好友来源
Definition: nim_friend_def.h:30
static const char * kNIMFriendKeyAlias
string, 备注名
Definition: nim_friend_def.h:32
static const char * kNIMFriendKeyBits
long, 扩展字段,位运算型
Definition: nim_friend_def.h:34
static const char * kNIMFriendKeyEx
string, 扩展字段,必须为可以解析为json的非格式化的字符串
Definition: nim_friend_def.h:36
NIMFriendFlag
Definition: nim_friend_def.h:54
@ kNIMFriendFlagNotFriend
陌生人
Definition: nim_friend_def.h:56
static const char * kNIMFriendKeyBeFlag
NIMFriendFlag, 反向好友关系
Definition: nim_friend_def.h:28
NIMVerifyType
Definition: nim_friend_def.h:68
static const char * kNIMFriendKeyUpdateTime
long, 更新时间戳(ms)
Definition: nim_friend_def.h:40
static const char * kNIMFriendKeyCreateTime
long, 创建时间戳(ms)
Definition: nim_friend_def.h:38
NIMFriendSource
Definition: nim_friend_def.h:62
@ kNIMFriendSourceDefault
默认
Definition: nim_friend_def.h:64
static const char * kNIMFriendKeyFlag
NIMFriendFlag, 好友关系,修改时需要同步更新反向好友关系beflag
Definition: nim_friend_def.h:26
kFriendProfileKeySource
好友来源
Definition: nim_friend_helper.h:30
kFriendProfileKeyAlias
别称
Definition: nim_friend_helper.h:32
kFriendProfileKeyRelationship
主动好友关系
Definition: nim_friend_helper.h:26
kFriendProfileKeyBits
扩展项,int64
Definition: nim_friend_helper.h:34
kFriendProfileKeyNone
无数据
Definition: nim_friend_helper.h:24
kFriendProfileKeyServerEx
服务端扩展项,string 只读
Definition: nim_friend_helper.h:38
kFriendProfileKeyPassiveRelationship
被动好友关系
Definition: nim_friend_helper.h:28
kFriendProfileKeyEx
扩展项,json value
Definition: nim_friend_helper.h:36
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
#define true
Definition: stdbool.h:30
删除好有拓展选项
Definition: nim_friend_helper.h:44
DeleteFriendOption()
Definition: nim_friend_helper.h:45
bool delete_alias_
Definition: nim_friend_helper.h:49
云信好友变更事件(请求添加)
Definition: nim_friend_helper.h:255
NIMVerifyType add_type_
验证类型
Definition: nim_friend_helper.h:259
std::string accid_
用户ID
Definition: nim_friend_helper.h:257
std::string msg_
附言
Definition: nim_friend_helper.h:261
std::string server_ex_
服务器下发的拓展字段,只有调用了服务器添加好友接口并且传递该字段时才会有内容
Definition: nim_friend_helper.h:263
云信好友变更事件
Definition: nim_friend_helper.h:247
NIMFriendChangeType type_
事件类型
Definition: nim_friend_helper.h:249
std::string content_
事件内容,根据事件类型通过提供的ParsexxxEvent接口(nim_cpp_friend.h)解析该内容
Definition: nim_friend_helper.h:251
云信好友变更事件(删除)
Definition: nim_friend_helper.h:267
std::string accid_
用户ID
Definition: nim_friend_helper.h:269
云信好友
Definition: nim_friend_helper.h:53
NIMFriendSource source_
好友来源
Definition: nim_friend_helper.h:229
std::string server_expand_
扩展数据
Definition: nim_friend_helper.h:239
NIMFriendFlag GetPassiveRelationship() const
Definition: nim_friend_helper.h:98
void SetSource(NIMFriendSource src)
Definition: nim_friend_helper.h:101
int64_t GetBits() const
Definition: nim_friend_helper.h:125
int64_t update_timetag_
好友更新时间戳(毫秒)
Definition: nim_friend_helper.h:243
std::string accid_
用户账号
Definition: nim_friend_helper.h:223
NIMFriendFlag GetRelationship() const
Definition: nim_friend_helper.h:89
void SetBits(int64_t bits)
Definition: nim_friend_helper.h:119
void Update(const FriendProfile &profile)
更新好友数据
Definition: nim_friend_helper.h:197
NIMFriendSource GetSource() const
Definition: nim_friend_helper.h:107
void SetPassiveRelationship(NIMFriendFlag flag)
Definition: nim_friend_helper.h:92
FriendProfile()
Definition: nim_friend_helper.h:55
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_friend_helper.h:168
void SetEx(const nim_cpp_wrapper_util::Json::Value &ex)
Definition: nim_friend_helper.h:128
bool ExistValue(FriendProfileKey key) const
好友信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_friend_helper.h:162
std::string GetAlias() const
Definition: nim_friend_helper.h:116
unsigned int value_available_flag_
好友数据有效性,结合好友Key使用
Definition: nim_friend_helper.h:237
void SetCreateTimetag(int64_t timetag)
Definition: nim_friend_helper.h:146
void SetUpdateTimetag(int64_t timetag)
Definition: nim_friend_helper.h:152
void SetServerEx(const std::string &srv_ex)
Definition: nim_friend_helper.h:137
FriendProfile(const std::string &accid)
Definition: nim_friend_helper.h:65
nim_cpp_wrapper_util::Json::Value expand_
扩展数据
Definition: nim_friend_helper.h:235
std::string alias_
好友别名
Definition: nim_friend_helper.h:231
NIMFriendFlag passive_relationship_
被动的好友关系
Definition: nim_friend_helper.h:227
int64_t bits_
扩展数据
Definition: nim_friend_helper.h:233
void SetAccId(const std::string &accid)
Definition: nim_friend_helper.h:77
NIMFriendFlag relationship_
主动的好友关系
Definition: nim_friend_helper.h:225
int64_t GetUpdateTimetag() const
Definition: nim_friend_helper.h:155
void SetRelationship(NIMFriendFlag flag)
Definition: nim_friend_helper.h:83
int64_t GetCreateTimetag() const
Definition: nim_friend_helper.h:149
nim_cpp_wrapper_util::Json::Value GetEx() const
Definition: nim_friend_helper.h:134
std::string GetServerEx() const
Definition: nim_friend_helper.h:143
std::string GetAccId() const
Definition: nim_friend_helper.h:80
void SetAlias(const std::string &alias)
Definition: nim_friend_helper.h:110
int64_t create_timetag_
好友创建时间戳(毫秒)
Definition: nim_friend_helper.h:241
云信好友变更事件(多端同步)
Definition: nim_friend_helper.h:279
std::list< FriendProfile > profiles_
用户信息列表
Definition: nim_friend_helper.h:281
云信好友变更事件(更新)
Definition: nim_friend_helper.h:273
FriendProfile profile_
用户信息
Definition: nim_friend_helper.h:275