7#ifndef _NIM_SDK_CPP_FRIEND_HELPER_H_
8#define _NIM_SDK_CPP_FRIEND_HELPER_H_
23enum NIM_SDK_CPPWRAPPER_DLL_API FriendProfileKey {
41 kFriendProfileKeyAll = (1 << 7) - 1
47 : delete_alias_(
true) {}
63 , value_available_flag_(0) {}
73 , value_available_flag_(0) {
78 void SetAccId(
const std::string& accid) { accid_ = accid; }
81 std::string
GetAccId()
const {
return accid_; }
94 passive_relationship_ = flag;
139 server_expand_ = srv_ex;
163 bool ExistValue(FriendProfileKey key)
const {
return (value_available_flag_ & key) != 0; }
184 if (create_timetag_ > 0)
186 if (update_timetag_ > 0)
197 assert(profile.
accid_ == accid_);
198 if (profile.
accid_ != accid_)
210 bits_ = profile.
bits_;
288NIM_SDK_CPPWRAPPER_DLL_API
bool ParseFriendsProfile(
const std::string& friends_profile_json, std::list<FriendProfile>& profiles);
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 * 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:31
kFriendProfileKeyAlias
别称
Definition: nim_friend_helper.h:33
kFriendProfileKeyRelationship
主动好友关系
Definition: nim_friend_helper.h:27
kFriendProfileKeyBits
扩展项,int64
Definition: nim_friend_helper.h:35
kFriendProfileKeyNone
无数据
Definition: nim_friend_helper.h:25
kFriendProfileKeyServerEx
服务端扩展项,string 只读
Definition: nim_friend_helper.h:39
kFriendProfileKeyPassiveRelationship
被动好友关系
Definition: nim_friend_helper.h:29
kFriendProfileKeyEx
扩展项,json value
Definition: nim_friend_helper.h:37
NIM SDK 及 NIM ChatRoom SDK 公用头文件
删除好有拓展选项
Definition: nim_friend_helper.h:45
云信好友变更事件(请求添加)
Definition: nim_friend_helper.h:253
NIMVerifyType add_type_
验证类型
Definition: nim_friend_helper.h:257
std::string accid_
用户ID
Definition: nim_friend_helper.h:255
std::string msg_
附言
Definition: nim_friend_helper.h:259
std::string server_ex_
服务器下发的拓展字段,只有调用了服务器添加好友接口并且传递该字段时才会有内容
Definition: nim_friend_helper.h:261
云信好友变更事件
Definition: nim_friend_helper.h:245
NIMFriendChangeType type_
事件类型
Definition: nim_friend_helper.h:247
std::string content_
事件内容,根据事件类型通过提供的ParsexxxEvent接口(nim_cpp_friend.h)解析该内容
Definition: nim_friend_helper.h:249
云信好友变更事件(删除)
Definition: nim_friend_helper.h:265
std::string accid_
用户ID
Definition: nim_friend_helper.h:267
云信好友
Definition: nim_friend_helper.h:54
NIMFriendSource source_
好友来源
Definition: nim_friend_helper.h:227
std::string server_expand_
扩展数据
Definition: nim_friend_helper.h:237
NIMFriendFlag GetPassiveRelationship() const
Definition: nim_friend_helper.h:99
void SetSource(NIMFriendSource src)
Definition: nim_friend_helper.h:102
int64_t GetBits() const
Definition: nim_friend_helper.h:126
int64_t update_timetag_
好友更新时间戳(毫秒)
Definition: nim_friend_helper.h:241
std::string accid_
用户账号
Definition: nim_friend_helper.h:221
NIMFriendFlag GetRelationship() const
Definition: nim_friend_helper.h:90
void SetBits(int64_t bits)
Definition: nim_friend_helper.h:120
void Update(const FriendProfile &profile)
更新好友数据
Definition: nim_friend_helper.h:196
NIMFriendSource GetSource() const
Definition: nim_friend_helper.h:108
void SetPassiveRelationship(NIMFriendFlag flag)
Definition: nim_friend_helper.h:93
FriendProfile()
Definition: nim_friend_helper.h:56
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_friend_helper.h:169
void SetEx(const nim_cpp_wrapper_util::Json::Value &ex)
Definition: nim_friend_helper.h:129
bool ExistValue(FriendProfileKey key) const
好友信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_friend_helper.h:163
std::string GetAlias() const
Definition: nim_friend_helper.h:117
unsigned int value_available_flag_
好友数据有效性,结合好友Key使用
Definition: nim_friend_helper.h:235
void SetCreateTimetag(int64_t timetag)
Definition: nim_friend_helper.h:147
void SetUpdateTimetag(int64_t timetag)
Definition: nim_friend_helper.h:153
void SetServerEx(const std::string &srv_ex)
Definition: nim_friend_helper.h:138
FriendProfile(const std::string &accid)
Definition: nim_friend_helper.h:66
nim_cpp_wrapper_util::Json::Value expand_
扩展数据
Definition: nim_friend_helper.h:233
std::string alias_
好友别名
Definition: nim_friend_helper.h:229
NIMFriendFlag passive_relationship_
被动的好友关系
Definition: nim_friend_helper.h:225
int64_t bits_
扩展数据
Definition: nim_friend_helper.h:231
void SetAccId(const std::string &accid)
Definition: nim_friend_helper.h:78
NIMFriendFlag relationship_
主动的好友关系
Definition: nim_friend_helper.h:223
int64_t GetUpdateTimetag() const
Definition: nim_friend_helper.h:156
void SetRelationship(NIMFriendFlag flag)
Definition: nim_friend_helper.h:84
int64_t GetCreateTimetag() const
Definition: nim_friend_helper.h:150
nim_cpp_wrapper_util::Json::Value GetEx() const
Definition: nim_friend_helper.h:135
std::string GetServerEx() const
Definition: nim_friend_helper.h:144
std::string GetAccId() const
Definition: nim_friend_helper.h:81
void SetAlias(const std::string &alias)
Definition: nim_friend_helper.h:111
int64_t create_timetag_
好友创建时间戳(毫秒)
Definition: nim_friend_helper.h:239
云信好友变更事件(多端同步)
Definition: nim_friend_helper.h:277
std::list< FriendProfile > profiles_
用户信息列表
Definition: nim_friend_helper.h:279
云信好友变更事件(更新)
Definition: nim_friend_helper.h:271
FriendProfile profile_
用户信息
Definition: nim_friend_helper.h:273