Go to the documentation of this file.
7 #ifndef _NIM_SDK_CPP_FRIEND_HELPER_H_
8 #define _NIM_SDK_CPP_FRIEND_HELPER_H_
13 #include "nim_define_include.h"
15 #include "nim_wrapper_util/nim_json_util.h"
16 #include "public_defines.h"
23 enum NIM_SDK_CPPWRAPPER_DLL_API FriendProfileKey {
32 kFriendProfileKeyAll = (1 << 7) - 1
38 : delete_alias_(
true) {}
48 : relationship_(kNIMFriendFlagNotFriend)
49 , passive_relationship_(kNIMFriendFlagNotFriend)
50 , source_(kNIMFriendSourceDefault)
54 , value_available_flag_(0) {}
58 : relationship_(kNIMFriendFlagNotFriend)
59 , passive_relationship_(kNIMFriendFlagNotFriend)
60 , source_(kNIMFriendSourceDefault)
64 , value_available_flag_(0) {
69 void SetAccId(
const std::string& accid) { accid_ = accid; }
72 std::string
GetAccId()
const {
return accid_; }
85 passive_relationship_ = flag;
99 NIMFriendSource
GetSource()
const {
return source_; }
120 void SetEx(
const nim_cpp_wrapper_util::Json::Value& ex) {
126 nim_cpp_wrapper_util::Json::Value
GetEx()
const {
return expand_; }
130 server_expand_ = srv_ex;
154 bool ExistValue(FriendProfileKey key)
const {
return (value_available_flag_ & key) != 0; }
161 nim_cpp_wrapper_util::Json::Value friend_profile_json;
162 friend_profile_json[kNIMFriendKeyAccid] = accid_;
164 friend_profile_json[kNIMFriendKeyFlag] = relationship_;
166 friend_profile_json[kNIMFriendKeyBeFlag] = passive_relationship_;
168 friend_profile_json[kNIMFriendKeySource] = source_;
170 friend_profile_json[kNIMFriendKeyAlias] = alias_;
172 friend_profile_json[kNIMFriendKeyBits] = bits_;
174 friend_profile_json[kNIMFriendKeyEx] = GetJsonStringWithNoStyled(expand_);
175 if (create_timetag_ > 0)
176 friend_profile_json[kNIMFriendKeyCreateTime] = create_timetag_;
177 if (update_timetag_ > 0)
178 friend_profile_json[kNIMFriendKeyUpdateTime] = update_timetag_;
179 return GetJsonStringWithNoStyled(friend_profile_json);
188 assert(profile.accid_ == accid_);
189 if (profile.accid_ != accid_)
193 relationship_ = profile.relationship_;
195 passive_relationship_ = profile.passive_relationship_;
197 source_ = profile.source_;
199 alias_ = profile.alias_;
201 bits_ = profile.bits_;
203 expand_ = profile.expand_;
204 if (profile.create_timetag_ > 0)
205 create_timetag_ = profile.create_timetag_;
206 if (profile.update_timetag_ > 0)
207 update_timetag_ = profile.update_timetag_;
212 NIMFriendFlag relationship_;
213 NIMFriendFlag passive_relationship_;
214 NIMFriendSource source_;
217 nim_cpp_wrapper_util::Json::Value expand_;
218 unsigned int value_available_flag_;
219 std::string server_expand_;
221 int64_t create_timetag_;
222 int64_t update_timetag_;
260 NIM_SDK_CPPWRAPPER_DLL_API
bool ParseFriendsProfile(
const std::string& friends_profile_json, std::list<FriendProfile>& profiles);
279 #endif //_NIM_SDK_CPP_FRIEND_HELPER_H_
云信好友变更事件(删除)
Definition: nim_friend_helper.h:240
kFriendProfileKeyNone
Definition: nim_friend_helper.h:24
云信好友
Definition: nim_friend_helper.h:45
bool ExistValue(FriendProfileKey key) const
好友信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_friend_helper.h:154
void SetSource(NIMFriendSource src)
Definition: nim_friend_helper.h:93
NIMFriendChangeType type_
Definition: nim_friend_helper.h:227
kFriendProfileKeyEx
Definition: nim_friend_helper.h:30
kFriendProfileKeySource
Definition: nim_friend_helper.h:27
void SetRelationship(NIMFriendFlag flag)
Definition: nim_friend_helper.h:75
NIM_SDK_CPPWRAPPER_DLL_API bool ParseFriendProfile(const std::string &friend_profile_json, FriendProfile &profile)
解析(单个)好友信息
void Update(const FriendProfile &profile)
更新好友数据
Definition: nim_friend_helper.h:187
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_friend_helper.h:160
nim_cpp_wrapper_util::Json::Value GetEx() const
Definition: nim_friend_helper.h:126
kFriendProfileKeyPassiveRelationship
Definition: nim_friend_helper.h:26
void SetServerEx(const std::string &srv_ex)
Definition: nim_friend_helper.h:129
FriendProfile()
Definition: nim_friend_helper.h:47
std::string content_
Definition: nim_friend_helper.h:228
std::string msg_
Definition: nim_friend_helper.h:235
std::string server_ex_
Definition: nim_friend_helper.h:236
std::string GetAlias() const
Definition: nim_friend_helper.h:108
int64_t GetUpdateTimetag() const
Definition: nim_friend_helper.h:147
删除好有拓展选项
Definition: nim_friend_helper.h:36
void SetAlias(const std::string &alias)
Definition: nim_friend_helper.h:102
void SetEx(const nim_cpp_wrapper_util::Json::Value &ex)
Definition: nim_friend_helper.h:120
kFriendProfileKeyBits
Definition: nim_friend_helper.h:29
int64_t GetCreateTimetag() const
Definition: nim_friend_helper.h:141
云信好友变更事件(更新)
Definition: nim_friend_helper.h:245
云信好友变更事件(请求添加)
Definition: nim_friend_helper.h:232
NIMFriendFlag GetPassiveRelationship() const
Definition: nim_friend_helper.h:90
std::string GetServerEx() const
Definition: nim_friend_helper.h:135
云信好友变更事件(多端同步)
Definition: nim_friend_helper.h:250
kFriendProfileKeyRelationship
Definition: nim_friend_helper.h:25
std::string accid_
Definition: nim_friend_helper.h:241
NIMVerifyType add_type_
Definition: nim_friend_helper.h:234
void SetBits(int64_t bits)
Definition: nim_friend_helper.h:111
NIMFriendFlag GetRelationship() const
Definition: nim_friend_helper.h:81
NIMFriendSource GetSource() const
Definition: nim_friend_helper.h:99
kFriendProfileKeyAlias
Definition: nim_friend_helper.h:28
std::string accid_
Definition: nim_friend_helper.h:233
NIM_SDK_CPPWRAPPER_DLL_API bool ParseFriendsProfile(const std::string &friends_profile_json, std::list< FriendProfile > &profiles)
解析(多)好友信息
kFriendProfileKeyServerEx
Definition: nim_friend_helper.h:31
void SetCreateTimetag(int64_t timetag)
Definition: nim_friend_helper.h:138
void SetUpdateTimetag(int64_t timetag)
Definition: nim_friend_helper.h:144
std::string GetAccId() const
Definition: nim_friend_helper.h:72
void SetPassiveRelationship(NIMFriendFlag flag)
Definition: nim_friend_helper.h:84
FriendProfile profile_
Definition: nim_friend_helper.h:246
std::list< FriendProfile > profiles_
Definition: nim_friend_helper.h:251
int64_t GetBits() const
Definition: nim_friend_helper.h:117
void SetAccId(const std::string &accid)
Definition: nim_friend_helper.h:69
FriendProfile(const std::string &accid)
Definition: nim_friend_helper.h:57
云信好友变更事件
Definition: nim_friend_helper.h:226