Go to the documentation of this file.
7 #ifndef _NIM_SDK_CPP_TEAM_HELPER_H_
8 #define _NIM_SDK_CPP_TEAM_HELPER_H_
16 #include "nim_define_include.h"
17 #include "nim_wrapper_util/nim_json_util.h"
27 TeamInfo(
const std::string& team_id,
const nim::NIMTeamType type) {
28 team_info_json_value_[nim::kNIMTeamInfoKeyID] = team_id;
29 team_info_json_value_[nim::kNIMTeamInfoKeyType] = type;
45 if (new_info.
ExistValue(kNIMTeamInfoKeyCreator))
48 SetLevel(new_info.GetLevel());
49 if (new_info.
ExistValue(kNIMTeamInfoKeyProperty))
53 if (new_info.
ExistValue(kNIMTeamInfoKeyAnnouncement))
55 if (new_info.
ExistValue(kNIMTeamInfoKeyJoinMode))
60 if (new_info.
ExistValue(kNIMTeamInfoKeyCustom))
64 if (new_info.
ExistValue(kNIMTeamInfoKeyBeInviteMode))
66 if (new_info.
ExistValue(kNIMTeamInfoKeyInviteMode))
68 if (new_info.
ExistValue(kNIMTeamInfoKeyUpdateInfoMode))
70 if (new_info.
ExistValue(kNIMTeamInfoKeyUpdateCustomMode))
74 if (new_info.
ExistValue(kNIMTeamInfoKeyValidFlag))
76 if (new_info.
ExistValue(kNIMTeamInfoKeyMemberValid))
78 if (new_info.
ExistValue(kNIMTeamInfoKeyMemberCount))
80 if (new_info.
ExistValue(kNIMTeamInfoKeyListTime))
82 if (new_info.
ExistValue(kNIMTeamInfoKeyCreateTime))
84 if (new_info.
ExistValue(kNIMTeamInfoKeyUpdateTime))
86 if (new_info.
ExistValue(kNIMTeamInfoKeyServerCustom))
94 void SetTeamID(
const std::string&
id) { team_info_json_value_[nim::kNIMTeamInfoKeyID] = id; }
97 std::string
GetTeamID()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyID].asString(); }
100 void SetName(
const std::string& name) { team_info_json_value_[nim::kNIMTeamInfoKeyName] = name; }
103 std::string
GetName()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyName].asString(); }
106 void SetType(nim::NIMTeamType type) { team_info_json_value_[nim::kNIMTeamInfoKeyType] = type; }
109 nim::NIMTeamType
GetType()
const {
return (NIMTeamType)team_info_json_value_[nim::kNIMTeamInfoKeyType].asUInt(); }
112 void SetOwnerID(
const std::string&
id) { team_info_json_value_[nim::kNIMTeamInfoKeyCreator] = id; }
115 std::string
GetOwnerID()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyCreator].asString(); }
118 team_info_json_value_[nim::kNIMTeamInfoKeyMemberMaxCount] = count;
119 team_info_json_value_[nim::kNIMTeamInfoKeyLevel] = count;
123 int GetMemberMaxCount()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyMemberMaxCount].asUInt(); }
125 void SetProperty(
const std::string& prop) { team_info_json_value_[nim::kNIMTeamInfoKeyProperty] = prop; }
128 std::string
GetProperty()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyProperty].asString(); }
131 void SetValid(
bool valid) { team_info_json_value_[nim::kNIMTeamInfoKeyValidFlag] = valid ? 1 : 0; }
134 bool IsValid()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyValidFlag].asUInt() == 1; }
137 void SetMemberCount(
int count) { team_info_json_value_[nim::kNIMTeamInfoKeyMemberCount] = count; }
140 int GetMemberCount()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyMemberCount].asUInt(); }
146 int64_t
GetMemberListTimetag()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyListTime].asUInt64(); }
149 void SetCreateTimetag(int64_t timetag) { team_info_json_value_[nim::kNIMTeamInfoKeyCreateTime] = timetag; }
152 int64_t
GetCreateTimetag()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyCreateTime].asUInt64(); }
155 void SetUpdateTimetag(int64_t timetag) { team_info_json_value_[nim::kNIMTeamInfoKeyUpdateTime] = timetag; }
158 int64_t
GetUpdateTimetag()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyUpdateTime].asUInt64(); }
161 void SetMemberValid(
bool valid) { team_info_json_value_[nim::kNIMTeamInfoKeyMemberValid] = valid ? 1 : 0; }
164 bool IsMemberValid()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyMemberValid].asUInt() == 1; }
167 void SetIntro(
const std::string& intro) { team_info_json_value_[nim::kNIMTeamInfoKeyIntro] = intro; }
170 std::string
GetIntro()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyIntro].asString(); }
173 void SetAnnouncement(
const std::string& announcement) { team_info_json_value_[nim::kNIMTeamInfoKeyAnnouncement] = announcement; }
176 std::string
GetAnnouncement()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyAnnouncement].asString(); }
179 void SetJoinMode(nim::NIMTeamJoinMode mode) { team_info_json_value_[nim::kNIMTeamInfoKeyJoinMode] = mode; }
182 nim::NIMTeamJoinMode
GetJoinMode()
const {
return (NIMTeamJoinMode)team_info_json_value_[nim::kNIMTeamInfoKeyJoinMode].asUInt(); }
197 void SetCustom(
const std::string& custom) { team_info_json_value_[nim::kNIMTeamInfoKeyCustom] = custom; }
200 std::string
GetCustom()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyCustom].asString(); }
203 void SetServerCustom(
const std::string& custom) { team_info_json_value_[nim::kNIMTeamInfoKeyServerCustom] = custom; }
206 std::string
GetServerCustom()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyServerCustom].asString(); }
209 void SetIcon(
const std::string& icon) { team_info_json_value_[nim::kNIMTeamInfoKeyIcon] = icon; }
212 std::string
GetIcon()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyIcon].asString(); }
215 void SetBeInviteMode(NIMTeamBeInviteMode mode) { team_info_json_value_[nim::kNIMTeamInfoKeyBeInviteMode] = mode; }
218 NIMTeamBeInviteMode
GetBeInviteMode()
const {
return (NIMTeamBeInviteMode)team_info_json_value_[nim::kNIMTeamInfoKeyBeInviteMode].asUInt(); }
221 void SetInviteMode(NIMTeamInviteMode mode) { team_info_json_value_[nim::kNIMTeamInfoKeyInviteMode] = mode; }
224 NIMTeamInviteMode
GetInviteMode()
const {
return (NIMTeamInviteMode)team_info_json_value_[nim::kNIMTeamInfoKeyInviteMode].asUInt(); }
227 void SetUpdateInfoMode(NIMTeamUpdateInfoMode mode) { team_info_json_value_[nim::kNIMTeamInfoKeyUpdateInfoMode] = mode; }
231 return (NIMTeamUpdateInfoMode)team_info_json_value_[nim::kNIMTeamInfoKeyUpdateInfoMode].asUInt();
235 void SetUpdateCustomMode(NIMTeamUpdateCustomMode mode) { team_info_json_value_[nim::kNIMTeamInfoKeyUpdateCustomMode] = mode; }
239 return (NIMTeamUpdateCustomMode)team_info_json_value_[nim::kNIMTeamInfoKeyUpdateCustomMode].asUInt();
242 void SetMute(NIMTeamMuteType mute_type) { team_info_json_value_[nim::kNIMTeamInfoKeyMuteType] = mute_type; }
246 if (team_info_json_value_.isMember(nim::kNIMTeamInfoKeyMuteAll) && team_info_json_value_[nim::kNIMTeamInfoKeyMuteAll].asUInt() == 1)
247 return kNIMTeamMuteTypeNomalMute;
248 return (NIMTeamMuteType)team_info_json_value_[nim::kNIMTeamInfoKeyMuteType].asUInt();
256 bool ExistValue(
const std::string& nim_team_info_key)
const {
return team_info_json_value_.isMember(nim_team_info_key); }
262 std::string
ToJsonString()
const {
return GetJsonStringWithNoStyled(team_info_json_value_); }
268 nim_cpp_wrapper_util::Json::Value
ToJsonValue()
const {
return team_info_json_value_; }
272 void SetLevel(
int level) { team_info_json_value_[nim::kNIMTeamInfoKeyLevel] = level; }
275 int GetLevel()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyLevel].asUInt(); }
278 nim_cpp_wrapper_util::Json::Value team_info_json_value_;
285 TeamMemberProperty(
const std::string& team_id,
const std::string& accid,
const nim::NIMTeamUserType type) {
286 member_info_json_value_[kNIMTeamUserKeyID] = team_id;
287 member_info_json_value_[kNIMTeamUserKeyAccID] = accid;
288 member_info_json_value_[kNIMTeamUserKeyType] = type;
296 void SetTeamID(
const std::string&
id) { member_info_json_value_[kNIMTeamUserKeyID] = id; }
299 std::string
GetTeamID()
const {
return member_info_json_value_[kNIMTeamUserKeyID].asString(); }
302 void SetAccountID(
const std::string&
id) { member_info_json_value_[kNIMTeamUserKeyAccID] = id; }
305 std::string
GetAccountID()
const {
return member_info_json_value_[kNIMTeamUserKeyAccID].asString(); }
308 void SetUserType(nim::NIMTeamUserType type) { member_info_json_value_[kNIMTeamUserKeyType] = type; }
311 nim::NIMTeamUserType
GetUserType()
const {
return (nim::NIMTeamUserType)member_info_json_value_[kNIMTeamUserKeyType].asUInt(); }
314 void SetNick(
const std::string& nick) { member_info_json_value_[kNIMTeamUserKeyNick] = nick; }
317 std::string
GetNick()
const {
return member_info_json_value_[kNIMTeamUserKeyNick].asString(); }
320 void SetBits(int64_t bit) { member_info_json_value_[kNIMTeamUserKeyBits] = bit; }
323 int64_t
GetBits()
const {
return member_info_json_value_[kNIMTeamUserKeyBits].asUInt64(); }
326 void SetValid(
bool valid) { member_info_json_value_[kNIMTeamUserKeyValidFlag] = valid ? 1 : 0; }
329 bool IsValid()
const {
return member_info_json_value_[kNIMTeamUserKeyValidFlag].asUInt() == 1; }
332 void SetCreateTimetag(int64_t timetag) { member_info_json_value_[kNIMTeamUserKeyCreateTime] = timetag; }
335 int64_t
GetCreateTimetag()
const {
return member_info_json_value_[kNIMTeamUserKeyCreateTime].asUInt64(); }
338 void SetUpdateTimetag(int64_t timetag) { member_info_json_value_[kNIMTeamUserKeyUpdateTime] = timetag; }
341 int64_t
GetUpdateTimetag()
const {
return member_info_json_value_[kNIMTeamUserKeyUpdateTime].asUInt64(); }
344 void SetMute(
bool mute) { member_info_json_value_[kNIMTeamUserKeyMute] = mute ? 1 : 0; }
347 bool IsMute()
const {
return member_info_json_value_[kNIMTeamUserKeyMute].asUInt() == 1; }
350 void SetCustom(
const std::string& custom) { member_info_json_value_[kNIMTeamUserKeyCustom] = custom; }
352 std::string
GetCustom()
const {
return member_info_json_value_[kNIMTeamUserKeyCustom].asString(); }
353 void SetInvitorAccID(
const std::string& invitor_accid) { member_info_json_value_[kNIMTeamUserKeyInvitorAccID] = invitor_accid; }
354 std::string GetInvitorAccID()
const {
return member_info_json_value_[kNIMTeamUserKeyInvitorAccID].asString(); }
360 bool ExistValue(
const std::string& nim_team_user_key)
const {
return member_info_json_value_.isMember(nim_team_user_key); }
366 std::string
ToJsonString()
const {
return GetJsonStringWithNoStyled(member_info_json_value_); }
372 nim_cpp_wrapper_util::Json::Value
ToJsonValue()
const {
return member_info_json_value_; }
375 nim_cpp_wrapper_util::Json::Value member_info_json_value_;
404 const std::string& team_id,
405 const NIMNotificationId notification_id,
406 const std::string& team_event_json,
415 NIM_SDK_CPPWRAPPER_DLL_API
void ParseTeamInfoJson(
const nim_cpp_wrapper_util::Json::Value& team_info_json,
TeamInfo& team_info);
431 NIM_SDK_CPPWRAPPER_DLL_API
bool ParseTeamInfosJson(
const std::string& team_infos_json, std::list<TeamInfo>& team_infos);
457 std::list<TeamMemberProperty>& team_member_propertys);
460 #endif //_NIM_SDK_CPP_TEAM_HELPER_H_
void SetUpdateTimetag(int64_t timetag)
Definition: nim_team_helper.h:338
bool IsMute() const
Definition: nim_team_helper.h:347
void SetUpdateTimetag(int64_t timetag)
Definition: nim_team_helper.h:155
群组信息
Definition: nim_team_helper.h:24
NIMNotificationId notification_id_
Definition: nim_team_helper.h:381
bool IsMemberValid() const
Definition: nim_team_helper.h:164
NIM_SDK_CPPWRAPPER_DLL_API bool ParseTeamMemberPropertysJson(const std::string &team_member_props_json, std::list< TeamMemberProperty > &team_member_propertys)
解析群成员信息
void SetMute(NIMTeamMuteType mute_type)
Definition: nim_team_helper.h:242
nim::NIMTeamUserType GetUserType() const
Definition: nim_team_helper.h:311
std::string team_id_
Definition: nim_team_helper.h:382
int64_t GetMemberListTimetag() const
Definition: nim_team_helper.h:146
群组成员信息
Definition: nim_team_helper.h:282
int64_t GetUpdateTimetag() const
Definition: nim_team_helper.h:341
void SetBits(int64_t bit)
Definition: nim_team_helper.h:320
void operator=(const TeamInfo &new_info)
Definition: nim_team_helper.h:37
nim_cpp_wrapper_util::Json::Value src_data_
Definition: nim_team_helper.h:390
void SetType(nim::NIMTeamType type)
Definition: nim_team_helper.h:106
void SetCreateTimetag(int64_t timetag)
Definition: nim_team_helper.h:332
int64_t GetUpdateTimetag() const
Definition: nim_team_helper.h:158
void SetNick(const std::string &nick)
Definition: nim_team_helper.h:314
void SetCreateTimetag(int64_t timetag)
Definition: nim_team_helper.h:149
std::string GetNick() const
Definition: nim_team_helper.h:317
int64_t GetBits() const
Definition: nim_team_helper.h:323
void SetJoinMode(nim::NIMTeamJoinMode mode)
Definition: nim_team_helper.h:179
int GetMemberCount() const
Definition: nim_team_helper.h:140
void SetServerCustom(const std::string &custom)
Definition: nim_team_helper.h:203
void SetMemberListTimetag(int64_t timetag)
Definition: nim_team_helper.h:143
void SetIcon(const std::string &icon)
Definition: nim_team_helper.h:209
void SetOwnerID(const std::string &id)
Definition: nim_team_helper.h:112
void SetMute(bool mute)
Definition: nim_team_helper.h:344
void SetProperty(const std::string &prop)
Definition: nim_team_helper.h:125
std::string GetAnnouncement() const
Definition: nim_team_helper.h:176
群组事件通知
Definition: nim_team_helper.h:379
void SetValid(bool valid)
Definition: nim_team_helper.h:131
void SetAnnouncement(const std::string &announcement)
Definition: nim_team_helper.h:173
void SetMemberMaxCount(int count)
Definition: nim_team_helper.h:117
TeamMemberProperty()
Definition: nim_team_helper.h:292
std::list< UserNameCard > namecards_
Definition: nim_team_helper.h:385
void SetUserType(nim::NIMTeamUserType type)
Definition: nim_team_helper.h:308
std::string GetAccountID() const
Definition: nim_team_helper.h:305
TeamInfo()
Definition: nim_team_helper.h:33
bool ExistValue(const std::string &nim_team_info_key) const
群组信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_team_helper.h:256
NIMTeamUpdateInfoMode GetUpdateInfoMode() const
Definition: nim_team_helper.h:230
NIMTeamMuteType GetMuteType() const
Definition: nim_team_helper.h:245
NIMTeamInviteMode GetInviteMode() const
Definition: nim_team_helper.h:224
nim::NIMTeamType GetType() const
Definition: nim_team_helper.h:109
int GetMemberMaxCount() const
Definition: nim_team_helper.h:123
NIM_SDK_CPPWRAPPER_DLL_API void ParseTeamEvent(int rescode, const std::string &team_id, const NIMNotificationId notification_id, const std::string &team_event_json, TeamEvent &team_event)
解析群组事件通知
void Update(const TeamInfo &new_info)
Definition: nim_team_helper.h:40
void SetUpdateInfoMode(NIMTeamUpdateInfoMode mode)
Definition: nim_team_helper.h:227
void SetTeamID(const std::string &id)
Definition: nim_team_helper.h:94
void SetUpdateCustomMode(NIMTeamUpdateCustomMode mode)
Definition: nim_team_helper.h:235
void SetTeamID(const std::string &id)
Definition: nim_team_helper.h:296
TeamMemberProperty member_property_
Definition: nim_team_helper.h:387
nim::NIMTeamJoinMode GetJoinMode() const
Definition: nim_team_helper.h:182
std::string GetServerCustom() const
Definition: nim_team_helper.h:206
std::string GetIcon() const
Definition: nim_team_helper.h:212
NIMResCode res_code_
Definition: nim_team_helper.h:380
nim_cpp_wrapper_util::Json::Value ToJsonValue() const
获取JsonValue格式的数据
Definition: nim_team_helper.h:268
std::string GetCustom() const
Definition: nim_team_helper.h:200
int64_t GetCreateTimetag() const
Definition: nim_team_helper.h:335
void SetCustom(const std::string &custom)
Definition: nim_team_helper.h:350
std::string GetIntro() const
Definition: nim_team_helper.h:170
void SetMemberValid(bool valid)
Definition: nim_team_helper.h:161
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_team_helper.h:366
NIMTeamBeInviteMode GetBeInviteMode() const
Definition: nim_team_helper.h:218
std::string GetProperty() const
Definition: nim_team_helper.h:128
NIMTeamUpdateCustomMode GetUpdateCustomMode() const
Definition: nim_team_helper.h:238
bool IsValid() const
Definition: nim_team_helper.h:329
void SetAccountID(const std::string &id)
Definition: nim_team_helper.h:302
std::list< std::string > ids_
Definition: nim_team_helper.h:383
bool ExistValue(const std::string &nim_team_user_key) const
群成员信息信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_team_helper.h:360
void SetCustom(const std::string &custom)
Definition: nim_team_helper.h:197
void SetBeInviteMode(NIMTeamBeInviteMode mode)
Definition: nim_team_helper.h:215
TeamInfo team_info_
Definition: nim_team_helper.h:386
std::string GetName() const
Definition: nim_team_helper.h:103
void SetInviteMode(NIMTeamInviteMode mode)
Definition: nim_team_helper.h:221
void SetIntro(const std::string &intro)
Definition: nim_team_helper.h:167
std::string GetTeamID() const
Definition: nim_team_helper.h:299
std::string GetOwnerID() const
Definition: nim_team_helper.h:115
NIM_SDK_CPPWRAPPER_DLL_API void ParseTeamMemberPropertyJson(const nim_cpp_wrapper_util::Json::Value &team_member_prop_json, TeamMemberProperty &team_member_property)
解析群成员信息
int64_t GetCreateTimetag() const
Definition: nim_team_helper.h:152
void SetValid(bool valid)
Definition: nim_team_helper.h:326
TeamMemberProperty(const std::string &team_id, const std::string &accid, const nim::NIMTeamUserType type)
Definition: nim_team_helper.h:285
std::list< std::string > invalid_ids_
Definition: nim_team_helper.h:384
std::string GetCustom() const
Definition: nim_team_helper.h:352
NIM_SDK_CPPWRAPPER_DLL_API void ParseTeamInfoJson(const nim_cpp_wrapper_util::Json::Value &team_info_json, TeamInfo &team_info)
解析群组信息
void SetName(const std::string &name)
Definition: nim_team_helper.h:100
nim_cpp_wrapper_util::Json::Value ToJsonValue() const
获取member info json value
Definition: nim_team_helper.h:372
void SetMemberCount(int count)
Definition: nim_team_helper.h:137
std::string GetTeamID() const
Definition: nim_team_helper.h:97
NIM_SDK_CPPWRAPPER_DLL_API bool ParseTeamInfosJson(const std::string &team_infos_json, std::list< TeamInfo > &team_infos)
解析群组信息
TeamInfo(const std::string &team_id, const nim::NIMTeamType type)
Definition: nim_team_helper.h:27
bool opt_
Definition: nim_team_helper.h:388
bool IsValid() const
Definition: nim_team_helper.h:134
std::string attach_
Definition: nim_team_helper.h:389
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_team_helper.h:262