7#ifndef _NIM_SDK_CPP_TEAM_HELPER_H_
8#define _NIM_SDK_CPP_TEAM_HELPER_H_
28 TeamInfo(
const std::string& team_id,
const nim::NIMTeamType type) {
29 team_info_json_value_[nim::kNIMTeamInfoKeyID] = team_id;
30 team_info_json_value_[nim::kNIMTeamInfoKeyType] = type;
95 void SetTeamID(
const std::string&
id) { team_info_json_value_[nim::kNIMTeamInfoKeyID] = id; }
98 std::string
GetTeamID()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyID].asString(); }
101 void SetName(
const std::string& name) { team_info_json_value_[nim::kNIMTeamInfoKeyName] = name; }
104 std::string
GetName()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyName].asString(); }
107 void SetType(nim::NIMTeamType type) { team_info_json_value_[nim::kNIMTeamInfoKeyType] = type; }
110 nim::NIMTeamType
GetType()
const {
return (
NIMTeamType)team_info_json_value_[nim::kNIMTeamInfoKeyType].asUInt(); }
113 bool TypeIsValid()
const {
return team_info_json_value_.isMember(nim::kNIMTeamInfoKeyType); }
116 void SetOwnerID(
const std::string&
id) { team_info_json_value_[nim::kNIMTeamInfoKeyCreator] = id; }
119 std::string
GetOwnerID()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyCreator].asString(); }
122 team_info_json_value_[nim::kNIMTeamInfoKeyMemberMaxCount] = count;
123 team_info_json_value_[nim::kNIMTeamInfoKeyLevel] = count;
127 int GetMemberMaxCount()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyMemberMaxCount].asUInt(); }
129 void SetProperty(
const std::string& prop) { team_info_json_value_[nim::kNIMTeamInfoKeyProperty] = prop; }
132 std::string
GetProperty()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyProperty].asString(); }
135 void SetValid(
bool valid) { team_info_json_value_[nim::kNIMTeamInfoKeyValidFlag] = valid ? 1 : 0; }
138 bool IsValid()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyValidFlag].asUInt() == 1; }
141 void SetMemberCount(
int count) { team_info_json_value_[nim::kNIMTeamInfoKeyMemberCount] = count; }
144 int GetMemberCount()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyMemberCount].asUInt(); }
150 int64_t
GetMemberListTimetag()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyListTime].asUInt64(); }
153 void SetCreateTimetag(int64_t timetag) { team_info_json_value_[nim::kNIMTeamInfoKeyCreateTime] = timetag; }
156 int64_t
GetCreateTimetag()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyCreateTime].asUInt64(); }
159 void SetUpdateTimetag(int64_t timetag) { team_info_json_value_[nim::kNIMTeamInfoKeyUpdateTime] = timetag; }
162 int64_t
GetUpdateTimetag()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyUpdateTime].asUInt64(); }
165 void SetMemberValid(
bool valid) { team_info_json_value_[nim::kNIMTeamInfoKeyMemberValid] = valid ? 1 : 0; }
168 bool IsMemberValid()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyMemberValid].asUInt() == 1; }
171 void SetIntro(
const std::string& intro) { team_info_json_value_[nim::kNIMTeamInfoKeyIntro] = intro; }
174 std::string
GetIntro()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyIntro].asString(); }
177 void SetAnnouncement(
const std::string& announcement) { team_info_json_value_[nim::kNIMTeamInfoKeyAnnouncement] = announcement; }
180 std::string
GetAnnouncement()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyAnnouncement].asString(); }
183 void SetJoinMode(nim::NIMTeamJoinMode mode) { team_info_json_value_[nim::kNIMTeamInfoKeyJoinMode] = mode; }
201 void SetCustom(
const std::string& custom) { team_info_json_value_[nim::kNIMTeamInfoKeyCustom] = custom; }
204 std::string
GetCustom()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyCustom].asString(); }
207 void SetServerCustom(
const std::string& custom) { team_info_json_value_[nim::kNIMTeamInfoKeyServerCustom] = custom; }
210 std::string
GetServerCustom()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyServerCustom].asString(); }
213 void SetIcon(
const std::string& icon) { team_info_json_value_[nim::kNIMTeamInfoKeyIcon] = icon; }
216 std::string
GetIcon()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyIcon].asString(); }
250 if (team_info_json_value_.isMember(nim::kNIMTeamInfoKeyMuteAll) && team_info_json_value_[nim::kNIMTeamInfoKeyMuteAll].asUInt() == 1)
252 return (
NIMTeamMuteType)team_info_json_value_[nim::kNIMTeamInfoKeyMuteType].asUInt();
260 bool ExistValue(
const std::string& nim_team_info_key)
const {
return team_info_json_value_.isMember(nim_team_info_key); }
276 void SetLevel(
int level) { team_info_json_value_[nim::kNIMTeamInfoKeyLevel] = level; }
279 int GetLevel()
const {
return team_info_json_value_[nim::kNIMTeamInfoKeyLevel].asUInt(); }
289 TeamMemberProperty(
const std::string& team_id,
const std::string& accid,
const nim::NIMTeamUserType type) {
362 reader.
parse(follow_member, follow_member_array);
367 std::vector<std::string> follow_member;
368 for (
auto& it : follow_member_array) {
369 follow_member.push_back(it.asString());
371 return follow_member;
378 bool ExistValue(
const std::string& nim_team_user_key)
const {
return member_info_json_value_.isMember(nim_team_user_key); }
448 bool finished_{
false};
462 const std::string& team_id,
464 const std::string& team_event_json,
465 TeamEvent& team_event);
498 TeamMemberProperty& team_member_property);
515 std::list<TeamMemberProperty>& team_member_propertys);
Unserialize a JSON document into a Value.
Definition: reader.h:37
bool parse(const std::string &document, Value &root, bool collectComments=true)
Read a Value from a JSON document.
Definition: json_reader.cpp:97
Represents a JSON value.
Definition: value.h:196
@ arrayValue
array value (ordered list)
Definition: value.h:115
void ParseTeamEvent(int rescode, const std::string &team_id, const NIMNotificationId notification_id, const std::string &team_event_json, TeamEvent &team_event)
解析群组事件通知
Definition: nim_team_helper.cpp:11
bool ParseTeamInfosJson(const std::string &team_infos_json, std::list< TeamInfo > &team_infos)
解析群组信息
Definition: nim_team_helper.cpp:161
void ParseTeamMemberPropertyJson(const nim_cpp_wrapper_util::Json::Value &team_member_prop_json, TeamMemberProperty &team_member_property)
解析群成员信息
Definition: nim_team_helper.cpp:176
void ParseTeamInfoJson(const nim_cpp_wrapper_util::Json::Value &team_info_json, TeamInfo &team_info)
解析群组信息
Definition: nim_team_helper.cpp:118
TeamQueryOrder
Definition: nim_team_helper.h:422
@ kTeamQueryOrderDesc
按时间降序排列
Definition: nim_team_helper.h:424
@ kTeamQueryOrderAsc
按时间升序排列
Definition: nim_team_helper.h:426
bool ParseTeamMemberPropertysJson(const std::string &team_member_props_json, std::list< TeamMemberProperty > &team_member_propertys)
解析群成员信息
Definition: nim_team_helper.cpp:204
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
NIMNotificationId
Definition: nim_msglog_def.h:369
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
static const char * kNIMTeamUserKeyBits
long,群成员属性,位操作(NIMTeamBitsConfigMask)
Definition: nim_team_def.h:314
static const char * kNIMTeamInfoKeyType
int,群类型(NIMTeamType)
Definition: nim_team_def.h:225
static const char * kNIMTeamInfoKeyUpdateTime
long,群信息上次更新时间戳(毫秒),通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:243
NIMTeamBeInviteMode
Definition: nim_team_def.h:176
static const char * kNIMTeamUserKeyUpdateTime
long,群成员信息上次更新时间戳(毫秒),通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:320
static const char * kNIMTeamInfoKeyProperty
string,群性质,长度限制:6000字符
Definition: nim_team_def.h:233
static const char * kNIMTeamInfoKeyListTime
long,群列表时间戳(毫秒),通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:239
static const char * kNIMTeamInfoKeyMemberValid
int,群有效性标记位,客户端用,有效1,无效0,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:245
static const char * kNIMTeamInfoKeyCreator
string 群拥有者ID,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:227
static const char * kNIMTeamInfoKeyUpdateInfoMode
int, 谁可以修改群资料,属性本身只有群主管理员可以修改,默认kNIMTeamUpdateInfoModeManager(0)/kNIMTeamUpdateInfoModeEveryone(1)
Definition: nim_team_def.h:265
static const char * kNIMTeamUserKeyType
int,群成员类型(NIMTeamUserType),默认kNIMTeamUserTypeNomal(0)
Definition: nim_team_def.h:310
static const char * kNIMTeamInfoKeyLevel
int,■■已废弃■■ 群等级,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:229
NIMTeamType
Definition: nim_team_def.h:295
static const char * kNIMTeamUserKeyNick
string,群成员昵称
Definition: nim_team_def.h:312
static const char * kNIMTeamInfoKeyName
string,群名称
Definition: nim_team_def.h:223
NIMTeamMuteType
Definition: nim_team_def.h:275
@ kNIMTeamMuteTypeNomalMute
普通成员禁言
Definition: nim_team_def.h:279
static const char * kNIMTeamInfoKeyCustom
string, 第三方扩展字段(仅负责存储和透传)
Definition: nim_team_def.h:255
static const char * kNIMTeamInfoKeyBeInviteMode
int, 被邀请人同意方式,属性本身只有群主管理员可以修改,默认kNIMTeamBeInviteModeNeedAgree(0)/kNIMTeamBeInviteModeNotNeedAgree(1)
Definition: nim_team_def.h:261
static const char * kNIMTeamUserKeyID
string,群id,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:306
static const char * kNIMTeamUserKeyCustom
string,群成员自定义扩展字段,必须为可以解析为json的非格式化的字符串
Definition: nim_team_def.h:322
static const char * kNIMTeamInfoKeyJoinMode
int,入群模式(NIMTeamJoinMode),默认为kNIMTeamJoinModeNoAuth(0),不需要验证
Definition: nim_team_def.h:251
static const char * kNIMTeamInfoKeyID
string,群id,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:221
NIMTeamJoinMode
Definition: nim_team_def.h:346
static const char * kNIMTeamInfoKeyAnnouncement
string,群公告,长度限制:5000字符
Definition: nim_team_def.h:249
static const char * kNIMTeamUserKeyCreateTime
long,入群时间戳(毫秒),通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:318
NIMTeamUpdateCustomMode
Definition: nim_team_def.h:200
static const char * kNIMTeamUserKeyInvitorAccID
string,邀请者的accid 主动入群的时为空,尚未进行过初始化为" "
Definition: nim_team_def.h:326
static const char * kNIMTeamInfoKeyServerCustom
string, 第三方服务器扩展字段(该配置项只能通过服务器接口设置,对客户端只读)
Definition: nim_team_def.h:257
NIMTeamInviteMode
Definition: nim_team_def.h:184
static const char * kNIMTeamInfoKeyValidFlag
int,群有效性标记位,有效1,无效0,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:235
static const char * kNIMTeamUserKeyValidFlag
int,群成员有效性标记位,有效1,无效0,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:316
static const char * kNIMTeamInfoKeyIcon
string, 群头像,长度限制:1024字符
Definition: nim_team_def.h:259
static const char * kNIMTeamInfoKeyIntro
string,群介绍,长度限制:255字符
Definition: nim_team_def.h:247
static const char * kNIMTeamInfoKeyUpdateCustomMode
int, 谁可以更新群自定义属性,属性本身只有群主管理员可以修改,默认kNIMTeamUpdateCustomModeManager(0)/kNIMTeamUpdateCustomModeEveryon...
Definition: nim_team_def.h:267
static const char * kNIMTeamInfoKeyMuteType
NIMTeamMuteType, 群禁言0不禁言 1普通成员禁言 3全部禁言 包括群主 开发者可以通过设置该属性调整群禁言状态
Definition: nim_team_def.h:271
static const char * kNIMTeamInfoKeyCreateTime
long,群创建时间戳(毫秒),通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:241
NIMTeamUpdateInfoMode
Definition: nim_team_def.h:192
static const char * kNIMTeamUserKeyMute
int,是否被禁言,0-非禁言(默认),1-禁言
Definition: nim_team_def.h:324
static const char * kNIMTeamInfoKeyInviteMode
int, 谁可以邀请他人入群,属性本身只有群主管理员可以修改,默认kNIMTeamInviteModeManager(0)/kNIMTeamInviteModeEveryone(1)
Definition: nim_team_def.h:263
static const char * kNIMTeamUserKeyAccID
string,群成员id,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:308
static const char * kNIMTeamUserKeyFollowMember
string,特别关注列表
Definition: nim_team_def.h:328
static const char * kNIMTeamInfoKeyMemberCount
int,群成员数量,通常情况下由SDK维护,开发者作为只读无需设置
Definition: nim_team_def.h:237
static const char * kNIMTeamInfoKeyMuteAll
int, 群全员禁言标记 0:未禁言,1:禁言, 开发者只读 无法设置
Definition: nim_team_def.h:269
NIMResCode
Definition: public_defines.h:21
群组事件通知
Definition: nim_team_helper.h:397
TeamMemberProperty member_property_
群成员属性
Definition: nim_team_helper.h:413
std::string attach_
扩展字段,目前仅kick和invite事件可选
Definition: nim_team_helper.h:417
bool opt_
操作
Definition: nim_team_helper.h:415
std::string team_id_
群组ID
Definition: nim_team_helper.h:403
nim_cpp_wrapper_util::Json::Value src_data_
未解析过的原信息,目前仅支持群消息未读数相关事件
Definition: nim_team_helper.h:419
std::list< UserNameCard > namecards_
通知可能涉及到的群成员的用户名片
Definition: nim_team_helper.h:409
TeamInfo team_info_
通知可能涉及到的群信息
Definition: nim_team_helper.h:411
std::list< std::string > ids_
通知可能涉及到的群成员ID
Definition: nim_team_helper.h:405
std::list< std::string > invalid_ids_
通知可能涉及到的失效的群成员ID,比如邀请入群的成员的群数量超限导致当次邀请失败
Definition: nim_team_helper.h:407
NIMNotificationId notification_id_
通知类型ID
Definition: nim_team_helper.h:401
NIMResCode res_code_
错误码
Definition: nim_team_helper.h:399
群组信息
Definition: nim_team_helper.h:25
nim::NIMTeamType GetType() const
Definition: nim_team_helper.h:110
nim_cpp_wrapper_util::Json::Value ToJsonValue() const
获取JsonValue格式的数据
Definition: nim_team_helper.h:272
nim_cpp_wrapper_util::Json::Value team_info_json_value_
Definition: nim_team_helper.h:282
void SetServerCustom(const std::string &custom)
Definition: nim_team_helper.h:207
NIMTeamUpdateCustomMode GetUpdateCustomMode() const
Definition: nim_team_helper.h:242
void SetMute(NIMTeamMuteType mute_type)
Definition: nim_team_helper.h:246
TeamInfo(const std::string &team_id, const nim::NIMTeamType type)
Definition: nim_team_helper.h:28
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_team_helper.h:266
TeamInfo()
Definition: nim_team_helper.h:34
NIMTeamBeInviteMode GetBeInviteMode() const
Definition: nim_team_helper.h:222
void Update(const TeamInfo &new_info)
Definition: nim_team_helper.h:41
void operator=(const TeamInfo &new_info)
Definition: nim_team_helper.h:38
std::string GetTeamID() const
Definition: nim_team_helper.h:98
void SetMemberListTimetag(int64_t timetag)
Definition: nim_team_helper.h:147
void SetUpdateTimetag(int64_t timetag)
Definition: nim_team_helper.h:159
std::string GetOwnerID() const
Definition: nim_team_helper.h:119
std::string GetCustom() const
Definition: nim_team_helper.h:204
std::string GetIcon() const
Definition: nim_team_helper.h:216
void SetName(const std::string &name)
Definition: nim_team_helper.h:101
bool IsValid() const
Definition: nim_team_helper.h:138
int64_t GetUpdateTimetag() const
Definition: nim_team_helper.h:162
void SetCreateTimetag(int64_t timetag)
Definition: nim_team_helper.h:153
std::string GetServerCustom() const
Definition: nim_team_helper.h:210
void SetIntro(const std::string &intro)
Definition: nim_team_helper.h:171
void SetValid(bool valid)
Definition: nim_team_helper.h:135
int GetMemberCount() const
Definition: nim_team_helper.h:144
void SetUpdateInfoMode(NIMTeamUpdateInfoMode mode)
Definition: nim_team_helper.h:231
std::string GetAnnouncement() const
Definition: nim_team_helper.h:180
void SetMemberCount(int count)
Definition: nim_team_helper.h:141
void SetAnnouncement(const std::string &announcement)
Definition: nim_team_helper.h:177
int GetLevel() const
Definition: nim_team_helper.h:279
bool IsMemberValid() const
Definition: nim_team_helper.h:168
NIMTeamUpdateInfoMode GetUpdateInfoMode() const
Definition: nim_team_helper.h:234
bool ExistValue(const std::string &nim_team_info_key) const
群组信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_team_helper.h:260
int64_t GetMemberListTimetag() const
Definition: nim_team_helper.h:150
void SetType(nim::NIMTeamType type)
Definition: nim_team_helper.h:107
void SetCustom(const std::string &custom)
Definition: nim_team_helper.h:201
void SetProperty(const std::string &prop)
Definition: nim_team_helper.h:129
void SetMemberValid(bool valid)
Definition: nim_team_helper.h:165
void SetUpdateCustomMode(NIMTeamUpdateCustomMode mode)
Definition: nim_team_helper.h:239
NIMTeamMuteType GetMuteType() const
Definition: nim_team_helper.h:249
std::string GetProperty() const
Definition: nim_team_helper.h:132
bool TypeIsValid() const
Definition: nim_team_helper.h:113
void SetBeInviteMode(NIMTeamBeInviteMode mode)
Definition: nim_team_helper.h:219
nim::NIMTeamJoinMode GetJoinMode() const
Definition: nim_team_helper.h:186
std::string GetIntro() const
Definition: nim_team_helper.h:174
NIMTeamInviteMode GetInviteMode() const
Definition: nim_team_helper.h:228
std::string GetName() const
Definition: nim_team_helper.h:104
void SetLevel(int level)
Definition: nim_team_helper.h:276
void SetOwnerID(const std::string &id)
Definition: nim_team_helper.h:116
void SetInviteMode(NIMTeamInviteMode mode)
Definition: nim_team_helper.h:225
int64_t GetCreateTimetag() const
Definition: nim_team_helper.h:156
int GetMemberMaxCount() const
Definition: nim_team_helper.h:127
void SetTeamID(const std::string &id)
Definition: nim_team_helper.h:95
void SetIcon(const std::string &icon)
Definition: nim_team_helper.h:213
void SetJoinMode(nim::NIMTeamJoinMode mode)
Definition: nim_team_helper.h:183
void SetMemberMaxCount(int count)
Definition: nim_team_helper.h:121
群组成员信息
Definition: nim_team_helper.h:286
std::string GetCustom() const
Definition: nim_team_helper.h:356
std::string GetInvitorAccID() const
Definition: nim_team_helper.h:358
void SetCreateTimetag(int64_t timetag)
Definition: nim_team_helper.h:336
std::string GetAccountID() const
Definition: nim_team_helper.h:309
void SetUpdateTimetag(int64_t timetag)
Definition: nim_team_helper.h:342
nim::NIMTeamUserType GetUserType() const
Definition: nim_team_helper.h:315
void SetUserType(nim::NIMTeamUserType type)
Definition: nim_team_helper.h:312
void SetAccountID(const std::string &id)
Definition: nim_team_helper.h:306
nim_cpp_wrapper_util::Json::Value member_info_json_value_
Definition: nim_team_helper.h:393
int64_t GetCreateTimetag() const
Definition: nim_team_helper.h:339
void SetFollowMember(const std::string &follow_member)
Definition: nim_team_helper.h:359
void SetCustom(const std::string &custom)
Definition: nim_team_helper.h:354
void SetNick(const std::string &nick)
Definition: nim_team_helper.h:318
std::string GetNick() const
Definition: nim_team_helper.h:321
TeamMemberProperty(const std::string &team_id, const std::string &accid, const nim::NIMTeamUserType type)
Definition: nim_team_helper.h:289
std::vector< std::string > GetFollowMember() const
Definition: nim_team_helper.h:365
std::string GetTeamID() const
Definition: nim_team_helper.h:303
TeamMemberProperty()
Definition: nim_team_helper.h:296
bool IsValid() const
Definition: nim_team_helper.h:333
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_team_helper.h:384
void SetBits(int64_t bit)
Definition: nim_team_helper.h:324
int64_t GetUpdateTimetag() const
Definition: nim_team_helper.h:345
int64_t GetBits() const
Definition: nim_team_helper.h:327
bool ExistValue(const std::string &nim_team_user_key) const
群成员信息信息数据标记Key对应的数据是否有效(存在,非初始值状态)
Definition: nim_team_helper.h:378
void SetInvitorAccID(const std::string &invitor_accid)
Definition: nim_team_helper.h:357
void SetTeamID(const std::string &id)
Definition: nim_team_helper.h:300
bool IsMute() const
Definition: nim_team_helper.h:351
nim_cpp_wrapper_util::Json::Value ToJsonValue() const
获取member info json value
Definition: nim_team_helper.h:390
void SetMute(bool mute)
Definition: nim_team_helper.h:348
void SetValid(bool valid)
Definition: nim_team_helper.h:330
群成员检索参数
Definition: nim_team_helper.h:430
std::set< nim::NIMTeamUserType > role_types_
群成员类型列表
Definition: nim_team_helper.h:432
群成员搜索结果
Definition: nim_team_helper.h:442
std::list< TeamMemberProperty > team_member_propertys_
群成员信息列表
Definition: nim_team_helper.h:444