NIM SDK API  8.5.0
nim_chatroom_helper.h
Go to the documentation of this file.
1 
7 #ifndef _NIM_CHATROOM_SDK_CPP_HELPER_H_
8 #define _NIM_CHATROOM_SDK_CPP_HELPER_H_
9 
10 #include <algorithm>
11 #include <functional>
12 #include <list>
13 #include <map>
14 #include <string>
15 #include <utility>
16 #include <vector>
17 #if !defined(_WIN32) && !defined(WIN32)
18 #include <pthread.h>
19 #endif
20 #include "nim_chatroom_def_include.h"
22 #include "nim_wrapper_util/nim_json_util.h"
23 
28 namespace nim_chatroom {
29 
31 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomEnterInfo {
37  void SetNick(const std::string& nick) { values_[kNIMChatRoomEnterKeyNick] = nick; }
38 
44  void SetAvatar(const std::string& avatar) { values_[kNIMChatRoomEnterKeyAvatar] = avatar; }
45 
51  void SetExt(const nim_cpp_wrapper_util::Json::Value& ext) { values_[kNIMChatRoomEnterKeyExt] = nim::GetJsonStringWithNoStyled(ext); }
52 
58  void SetNotifyExt(const nim_cpp_wrapper_util::Json::Value& notify_ext) {
59  values_[kNIMChatRoomEnterKeyNotifyExt] = nim::GetJsonStringWithNoStyled(notify_ext);
60  }
61 
67  void SetLoginTag(const std::list<std::string>& login_tags) {
68  for (auto& tag : login_tags) {
69  values_[kNIMChatRoomEnterLoginTags].append(tag);
70  }
71  }
72 
78  void SetNotifyTags(const std::string& expression) { values_[kNIMChatRoomEnterNotifyTags] = expression; }
79 
84  std::string ToJsonString() const { return values_.empty() ? "" : nim::GetJsonStringWithNoStyled(values_); }
85 
86 private:
87  nim_cpp_wrapper_util::Json::Value values_;
88 };
89 
90 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomIndependentEnterInfo {
91  std::list<std::string> address_;
92  std::string app_data_file_;
94  std::string app_key_;
95  std::string accid_;
96  std::string token_;
97  std::list<std::string> login_tags_;
98  std::string notify_tags_;
100  ChatRoomIndependentEnterInfo() { sdk_log_level_ = 5; }
101 
106  std::string ToJsonString() const {
107  nim_cpp_wrapper_util::Json::Value values;
108  nim_cpp_wrapper_util::Json::FastWriter fw;
109  std::string addr_str;
110  nim::StrListToJsonString(address_, addr_str);
111  values[kNIMChatRoomEnterKeyAddress] = addr_str;
112  std::string login_tags;
113  nim::StrListToJsonString(login_tags_, login_tags);
114  values[kNIMChatRoomEnterLoginTags] = login_tags;
115  values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
116  values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
117  values[kNIMChatRoomEnterKeyAppKey] = app_key_;
118  values[kNIMChatRoomEnterKeyAccID] = accid_;
119  values[kNIMChatRoomEnterKeyToken] = token_;
120  values[kNIMChatRoomEnterNotifyTags] = notify_tags_;
121  return fw.write(values);
122  }
123 };
124 
125 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomAnoymityEnterInfo {
126  std::list<std::string> address_;
127  std::string
132  std::string app_key_;
133  bool random_id_;
134  std::list<std::string> login_tags_;
135  std::string notify_tags_;
138  sdk_log_level_ = 5;
139  random_id_ = false;
140  }
141 
146  std::string ToJsonString() const {
147  nim_cpp_wrapper_util::Json::Value values;
148  nim_cpp_wrapper_util::Json::FastWriter fw;
149  std::string addr_str;
150  nim::StrListToJsonString(address_, addr_str);
151  values[kNIMChatRoomEnterKeyAddress] = addr_str;
152  std::string login_tags;
153  nim::StrListToJsonString(login_tags_, login_tags);
154  values[kNIMChatRoomEnterLoginTags] = login_tags;
155  values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
156  values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
157  values[kNIMChatRoomEnterKeyAppKey] = app_key_;
158  values[kNIMChatRoomEnterKeyRandomID] = random_id_ ? 1 : 0;
159  values[kNIMChatRoomEnterNotifyTags] = notify_tags_;
160  return fw.write(values);
161  }
162 };
163 
165 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomInfo {
166  int64_t id_;
167  std::string name_;
168  std::string announcement_;
169  std::string broadcast_url_;
170  std::string creator_id_;
172  std::string ext_;
174  int mute_all_;
178  : id_(0)
179  , valid_flag_(0)
180  , mute_all_(0)
181  , queuelevel(1) {}
182 
188  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& values) {
189  id_ = values[kNIMChatRoomInfoKeyID].asUInt64();
190  name_ = values[kNIMChatRoomInfoKeyName].asString();
191  announcement_ = values[kNIMChatRoomInfoKeyAnnouncement].asString();
192  broadcast_url_ = values[kNIMChatRoomInfoKeyBroadcastUrl].asString();
193  creator_id_ = values[kNIMChatRoomInfoKeyCreatorID].asString();
194  valid_flag_ = values[kNIMChatRoomInfoKeyValidFlag].asUInt();
195  ext_ = values[kNIMChatRoomInfoKeyExt].asString();
196  online_count_ = values[kNIMChatRoomInfoKeyOnlineCount].asUInt();
197  mute_all_ = values[kNIMChatRoomInfoKeyMuteAll].asUInt();
198  queuelevel = values[kNIMChatRoomInfoKeyQueuelevel].asInt();
199  }
200 
205  std::string ToJsonString() const {
206  nim_cpp_wrapper_util::Json::Value values;
207  values[kNIMChatRoomInfoKeyID] = id_;
208  values[kNIMChatRoomInfoKeyName] = name_;
209  values[kNIMChatRoomInfoKeyAnnouncement] = announcement_;
210  values[kNIMChatRoomInfoKeyBroadcastUrl] = broadcast_url_;
211  values[kNIMChatRoomInfoKeyCreatorID] = creator_id_;
212  values[kNIMChatRoomInfoKeyValidFlag] = valid_flag_;
213  values[kNIMChatRoomInfoKeyExt] = ext_;
214  values[kNIMChatRoomInfoKeyOnlineCount] = online_count_;
215  values[kNIMChatRoomInfoKeyMuteAll] = mute_all_;
216  values[kNIMChatRoomInfoKeyQueuelevel] = queuelevel;
217  return nim::GetJsonStringWithNoStyled(values);
218  }
219 };
220 
222 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomNotification {
223  NIMChatRoomNotificationId id_;
224  std::string ext_;
225  std::string operator_id_;
226  std::string operator_nick_;
227  std::list<std::string> target_nick_;
228  std::list<std::string> target_ids_;
231  bool muted_;
232  bool temp_muted_;
233  std::string queue_change_;
237  : temp_mute_duration_(0)
238  , muted_(false)
239  , temp_muted_(false) {}
240 
246  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& values) {
247  id_ = (NIMChatRoomNotificationId)values[kChatRoomNotificationKeyID].asUInt();
248  ext_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyExt].asString();
249  operator_id_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyOpt].asString();
250  operator_nick_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyOptNick].asString();
251  nim::JsonStrArrayToList(values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTargetNick], target_nick_);
252  nim::JsonStrArrayToList(values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTarget], target_ids_);
253  if (id_ == kNIMChatRoomNotificationIdMemberTempMute || id_ == kNIMChatRoomNotificationIdMemberTempUnMute)
254  temp_mute_duration_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTempMuteDuration].asInt64();
255  if (id_ == kNIMChatRoomNotificationIdMemberIn) {
256  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyMuteFlag))
257  muted_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyMuteFlag].asUInt() == 1;
258  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyTempMutedFlag))
259  temp_muted_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTempMutedFlag].asUInt() == 1;
260  temp_mute_duration_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyMemberInTempMutedDuration].asInt64();
261  }
262  if (id_ == kNIMChatRoomNotificationIdQueueChanged) {
263  queue_change_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyQueueChange].asString();
264  }
265  if (id_ == kNIMChatRoomNotificationIdQueueBatchChanged) {
266  queue_change_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyQueueChange].asString();
267  }
268  }
269 
270  std::string ToJsonString() const {
271  nim_cpp_wrapper_util::Json::Value values;
272  values[kNIMChatRoomInfoKeyID] = id_;
273  values[kChatRoomNotificationDataKeyExt] = ext_;
274  values[kChatRoomNotificationDataKeyOpt] = operator_id_;
275  values[kChatRoomNotificationDataKeyOptNick] = operator_nick_;
276  for (const auto& nick : target_nick_) {
277  values[kChatRoomNotificationDataKeyTargetNick].append(nick);
278  }
279  for (const auto& id : target_ids_) {
280  values[kChatRoomNotificationDataKeyTarget].append(id);
281  }
282  values[kChatRoomNotificationDataKeyTempMuteDuration] = temp_mute_duration_;
283  values[kChatRoomNotificationDataKeyMuteFlag] = muted_;
284  values[kChatRoomNotificationDataKeyTempMutedFlag] = temp_muted_;
285  values[kChatRoomNotificationDataKeyQueueChange] = queue_change_;
286  return nim::GetJsonStringWithNoStyled(values);
287  }
288 };
289 
291 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueChangedNotification {
292  std::string type_;
293  std::string key_;
294  std::string value_;
301  void ParseFromNotification(const ChatRoomNotification& notification) {
302  nim_cpp_wrapper_util::Json::Value values;
303  nim_cpp_wrapper_util::Json::Reader reader;
304  if (reader.parse(notification.queue_change_, values) && values.isObject()) {
305  type_ = values[kNIMChatRoomNotificationQueueChangedKeyType].asString();
306  key_ = values[kNIMChatRoomNotificationQueueChangedKeyKey].asString();
307  value_ = values[kNIMChatRoomNotificationQueueChangedKeyValue].asString();
308  }
309  }
310 };
313 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueBatchChangedNotification {
314  std::string type_;
315  std::string key_;
316  std::string value_;
317  std::map<std::string, std::string> changed_values_;
324  void ParseFromNotification(const ChatRoomNotification& notification) {
325  nim_cpp_wrapper_util::Json::Value values;
326  nim_cpp_wrapper_util::Json::Reader reader;
327  if (reader.parse(notification.queue_change_, values) && values.isObject()) {
328  type_ = values[kNIMChatRoomNotificationQueueBatchChangedKeyType].asString();
329  if (values.isMember(kNIMChatRoomNotificationQueueBatchChangedKeyKey))
330  key_ = values[kNIMChatRoomNotificationQueueBatchChangedKeyKey].asString();
331  if (values.isMember(kNIMChatRoomNotificationQueueBatchChangedKeyValue))
332  value_ = values[kNIMChatRoomNotificationQueueBatchChangedKeyValue].asString();
333  if (values.isMember(kNIMChatRoomNotificationQueueBatchChangedKeyObject)) {
334  auto members_name = values[kNIMChatRoomNotificationQueueBatchChangedKeyObject].getMemberNames();
335  auto it = members_name.begin();
336  while (it != members_name.end()) {
337  changed_values_.insert(std::make_pair(*it, values[kNIMChatRoomNotificationQueueBatchChangedKeyObject][*it].asString()));
338  it++;
339  }
340  }
341  }
342  }
343 };
344 
346 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomMessageSetting {
348  std::string ext_;
350  std::string anti_spam_content_;
352  std::string anti_spam_bizid_;
356  std::string yidun_anti_cheating_;
357  std::string env_config_;
360  : resend_flag_(false)
361  , anti_spam_enable_(false)
362  , history_save_(true)
363  , anti_spam_bizid_("")
364  , anti_spam_using_yidun_(1)
365  , high_priority_(0)
366  , yidun_anti_cheating_("") {}
367 
373  void ToJsonValue(nim_cpp_wrapper_util::Json::Value& message) const {
374  message[kNIMChatRoomMsgKeyResendFlag] = resend_flag_ ? 1 : 0;
375  message[kNIMChatRoomMsgKeyExt] = ext_;
376  message[kNIMChatRoomMsgKeyAntiSpamEnable] = anti_spam_enable_ ? 1 : 0;
377  message[kNIMChatRoomMsgKeyAntiSpamContent] = anti_spam_content_;
378  if (!anti_spam_bizid_.empty())
379  message[kNIMChatRoomMsgKeyAntiSpamBizId] = anti_spam_bizid_;
380  message[kNIMChatRoomMsgKeyHistorySave] = history_save_ ? 1 : 0;
381  message[kNIMChatRoomMsgKeyAntiSpamUsingYiDun] = anti_spam_using_yidun_;
382  if (!yidun_anti_cheating_.empty())
383  message[kNIMChatRoomMsgKeyYiDunAntiCheating] = yidun_anti_cheating_;
384  if (!env_config_.empty())
385  message[kNIMChatRoomMsgKeyEnvConfig] = env_config_;
386  }
387 
393  void ParseMessageSetting(const nim_cpp_wrapper_util::Json::Value& message) {
394  resend_flag_ = message[kNIMChatRoomMsgKeyResendFlag].asUInt() == 1;
395  ext_ = message[kNIMChatRoomMsgKeyExt].asString();
396  if (message.isMember(kNIMChatRoomMsgKeyAntiSpamEnable))
397  anti_spam_enable_ = message[kNIMChatRoomMsgKeyAntiSpamEnable].asInt() == 1;
398  anti_spam_content_ = message[kNIMChatRoomMsgKeyAntiSpamContent].asString();
399  high_priority_ = message[kNIMChatRoomMsgKeyHighPriorityFlag].asInt();
400  if (message.isMember(kNIMChatRoomMsgKeyYiDunAntiCheating))
401  yidun_anti_cheating_ = message[kNIMChatRoomMsgKeyYiDunAntiCheating].asString();
402  if (message.isMember(kNIMChatRoomMsgKeyEnvConfig))
403  env_config_ = message[kNIMChatRoomMsgKeyEnvConfig].asString();
404  }
405 };
406 
408 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomMessage {
409 public:
410  int64_t room_id_;
411  std::string from_id_;
412  int64_t timetag_;
413  NIMChatRoomClientType from_client_type_;
414  std::string from_nick_;
415  std::string from_avatar_;
416  std::string from_ext_;
417  // v7.8 <--
419  // --> v7.8
420  // v8.4.0 <--
421  std::string notify_tags_;
422  // --> v8.4.0
423 
424 public:
425  NIMChatRoomMsgType msg_type_;
426  std::string msg_attach_;
427  std::string client_msg_id_;
428  std::string msg_body_;
430  // v7.8 <--
431  int32_t sub_type_;
432  // --> v7.8
433 public:
434  std::string local_res_path_;
435  std::string local_res_id_;
439  : room_id_(-1)
440  , from_client_type_(kNIMChatRoomClientTypeDefault)
441  , timetag_(0)
442  , third_party_callback_ext_("")
443  , sub_type_(0) {}
444 
450  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& values) {
451  room_id_ = values[kNIMChatRoomMsgKeyRoomID].asUInt64();
452  from_id_ = values[kNIMChatRoomMsgKeyFromAccount].asString();
453  timetag_ = values[kNIMChatRoomMsgKeyTime].asUInt64();
454  from_client_type_ = (NIMChatRoomClientType)values[kNIMChatRoomMsgKeyFromClientType].asUInt();
455  from_nick_ = values[kNIMChatRoomMsgKeyFromNick].asString();
456  from_avatar_ = values[kNIMChatRoomMsgKeyFromAvatar].asString();
457  from_ext_ = values[kNIMChatRoomMsgKeyFromExt].asString();
458  msg_type_ = (NIMChatRoomMsgType)values[kNIMChatRoomMsgKeyType].asUInt();
459  msg_attach_ = values[kNIMChatRoomMsgKeyAttach].asString();
460  client_msg_id_ = values[kNIMChatRoomMsgKeyClientMsgid].asString();
461  local_res_path_ = values[kNIMChatRoomMsgKeyLocalFilePath].asString();
462  local_res_id_ = values[kNIMChatRoomMsgKeyLocalResId].asString();
463  msg_body_ = values[kNIMChatRoomMsgKeyBody].asString();
464  msg_setting_.ParseMessageSetting(values);
465  if (values.isMember(kNIMChatRoomMsgKeyThirdPartyCBEXT))
466  third_party_callback_ext_ = values[kNIMChatRoomMsgKeyThirdPartyCBEXT].asString();
467  if (values.isMember(kNIMChatRoomMsgKeySubType))
468  sub_type_ = values[kNIMChatRoomMsgKeySubType].asInt();
469  if (values.isMember(kNIMChatRoomMsgKeyNotifyTags))
470  notify_tags_ = values[kNIMChatRoomMsgKeyNotifyTags].asString();
471  }
472 
477  std::string ToJsonString() const {
478  nim_cpp_wrapper_util::Json::Value values;
479  values[kNIMChatRoomMsgKeyType] = msg_type_;
480  values[kNIMChatRoomMsgKeyAttach] = msg_attach_;
481  values[kNIMChatRoomMsgKeyClientMsgid] = client_msg_id_;
482  values[kNIMChatRoomMsgKeyLocalFilePath] = local_res_path_;
483  values[kNIMChatRoomMsgKeyLocalResId] = local_res_id_;
484  values[kNIMChatRoomMsgKeyBody] = msg_body_;
485  values[kNIMChatRoomMsgKeyThirdPartyCBEXT] = third_party_callback_ext_;
486  values[kNIMChatRoomMsgKeySubType] = sub_type_;
487  msg_setting_.ToJsonValue(values);
488  return nim::GetJsonStringWithNoStyled(values);
489  }
490 };
491 
493 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomGetMembersParameters {
494  NIMChatRoomGetMemberType type_;
496  int limit_;
500  : timestamp_offset_(0)
501  , limit_(0) {}
502 
507  std::string ToJsonString() const {
508  nim_cpp_wrapper_util::Json::Value values;
509  values[kNIMChatRoomGetMembersKeyType] = type_;
510  values[kNIMChatRoomGetMembersKeyOffset] = timestamp_offset_;
511  values[kNIMChatRoomGetMembersKeyLimit] = limit_;
512  return nim::GetJsonStringWithNoStyled(values);
513  }
514 };
515 
517 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomGetMembersByTagParameters {
518  std::string tag_;
520  int limit_;
524  : timestamp_offset_(0)
525  , limit_(0) {}
526 
531  std::string ToJsonString() const {
532  nim_cpp_wrapper_util::Json::Value values;
533  values[kNIMChatRoomGetMembersKeyTag] = tag_;
534  values[kNIMChatRoomGetMembersKeyOffset] = timestamp_offset_;
535  values[kNIMChatRoomGetMembersKeyLimit] = limit_;
536  return nim::GetJsonStringWithNoStyled(values);
537  }
538 };
539 
541 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomGetMsgHistoryParameters {
542  int64_t start_timetag_;
543  int limit_;
544  bool reverse_;
545  std::vector<NIMChatRoomMsgType> msg_types_;
548  : start_timetag_(0)
549  , limit_(0)
550  , reverse_(false) {
551  if (kMsg_Types_List.empty()) {
552  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeText);
553  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeImage);
554  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeAudio);
555  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeVideo);
556  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeLocation);
557  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeNotification);
558  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeFile);
559  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeRobot);
560  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeTips);
561  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeCustom);
562  }
563  msg_types_.assign(kMsg_Types_List.begin(), kMsg_Types_List.end());
564  }
565  // 考虑到兼容以前版本,只提供删除类型接口,如果所有类型都被删除,会添加Unknown类型以区别之前的版本
566  void RemoveMessageType(NIMChatRoomMsgType type) {
567  auto it = std::find_if(msg_types_.begin(), msg_types_.end(), [&](const NIMChatRoomMsgType& item) { return item == type; });
568  if (it != msg_types_.end())
569  msg_types_.erase(it);
570  if (msg_types_.empty())
571  msg_types_.emplace_back(kNIMChatRoomMsgTypeUnknown);
572  }
577  std::string ToJsonString() const {
578  nim_cpp_wrapper_util::Json::Value values;
579  values[kNIMChatRoomGetMsgHistoryKeyStartTime] = start_timetag_;
580  values[kNIMChatRoomGetMsgHistoryKeyLimit] = limit_;
581  values[kNIMChatRoomGetMsgHistoryKeyReverse] = reverse_;
582  auto it = msg_types_.begin();
583  while (it != msg_types_.end()) {
584  values[kNIMChatRoomGetMsgHistoryKeyMsgtypes].append(nim_cpp_wrapper_util::Json::Value(*it));
585  it++;
586  }
587  return nim::GetJsonStringWithNoStyled(values);
588  }
589 
590 private:
591  static std::vector<NIMChatRoomMsgType> kMsg_Types_List;
592 };
593 
595 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomSetMemberAttributeParameters {
596  std::string account_id_;
597  NIMChatRoomMemberAttribute attribute_;
598  bool opt_;
599  std::string notify_ext_;
603  : level_(0) {}
604 
609  std::string ToJsonString() const {
610  nim_cpp_wrapper_util::Json::Value values;
611  values[kNIMChatRoomSetMemberAttributeKeyAccoutID] = account_id_;
612  values[kNIMChatRoomSetMemberAttributeKeyAttribute] = attribute_;
613  values[kNIMChatRoomSetMemberAttributeKeyOpt] = opt_;
614  values[kNIMChatRoomSetMemberAttributeKeyNotifyExt] = notify_ext_;
615  return nim::GetJsonStringWithNoStyled(values);
616  }
617 
618 private:
619  int level_;
620 };
621 
623 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomMemberInfo {
624  int64_t room_id_;
625  std::string account_id_;
626  std::string tags_;
627  int type_;
628  int level_;
629  std::string nick_;
630  std::string avatar_;
631  std::string ext_;
632  std::string notify_tags_;
633  NIMChatRoomOnlineState state_;
634  NIMChatRoomGuestFlag guest_flag_;
635  int64_t enter_timetag_;
637  bool is_muted_;
638  bool is_valid_;
639  int64_t update_timetag_;
640  bool temp_muted_;
644  : room_id_(0)
645  , type_(-2)
646  , level_(0)
647  , state_(kNIMChatRoomOnlineStateOffline)
648  , guest_flag_(kNIMChatRoomGuestFlagGuest)
649  , enter_timetag_(0)
650  , is_blacklist_(false)
651  , is_muted_(false)
652  , is_valid_(false)
653  , update_timetag_(0)
654  , temp_muted_(false)
655  , temp_muted_duration_(0) {}
656 
658  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& value) {
659  if (value.isMember(kNIMChatRoomMemberInfoKeyRoomID))
660  room_id_ = value[kNIMChatRoomMemberInfoKeyRoomID].asUInt64();
661  if (value.isMember(kNIMChatRoomMemberInfoKeyAccID))
662  account_id_ = value[kNIMChatRoomMemberInfoKeyAccID].asString();
663  if (value.isMember(kNIMChatRoomMemberInfoKeyType))
664  type_ = value[kNIMChatRoomMemberInfoKeyType].asInt();
665  if (value.isMember(kNIMChatRoomMemberInfoKeyLevel))
666  level_ = value[kNIMChatRoomMemberInfoKeyLevel].asInt();
667  if (value.isMember(kNIMChatRoomMemberInfoKeyNick))
668  nick_ = value[kNIMChatRoomMemberInfoKeyNick].asString();
669  if (value.isMember(kNIMChatRoomMemberInfoKeyAvatar))
670  avatar_ = value[kNIMChatRoomMemberInfoKeyAvatar].asString();
671  if (value.isMember(kNIMChatRoomMemberInfoKeyExt))
672  ext_ = value[kNIMChatRoomMemberInfoKeyExt].asString();
673  if (value.isMember(kNIMChatRoomMemberInfoKeyOnlineState))
674  state_ = (NIMChatRoomOnlineState)value[kNIMChatRoomMemberInfoKeyOnlineState].asInt();
675  if (value.isMember(kNIMChatRoomMemberInfoKeyGuestFlag))
676  guest_flag_ = (NIMChatRoomGuestFlag)value[kNIMChatRoomMemberInfoKeyGuestFlag].asInt();
677  if (value.isMember(kNIMChatRoomMemberInfoKeyEnterTimetag))
678  enter_timetag_ = value[kNIMChatRoomMemberInfoKeyEnterTimetag].asUInt64();
679  if (value.isMember(kNIMChatRoomMemberInfoKeyBlacklist))
680  is_blacklist_ = value[kNIMChatRoomMemberInfoKeyBlacklist].asInt() == 1;
681  if (value.isMember(kNIMChatRoomMemberInfoKeyMuted))
682  is_muted_ = value[kNIMChatRoomMemberInfoKeyMuted].asInt() == 1;
683  if (value.isMember(kNIMChatRoomMemberInfoKeyValid))
684  is_valid_ = value[kNIMChatRoomMemberInfoKeyValid].asInt() == 1;
685  if (value.isMember(kNIMChatRoomMemberInfoKeyUpdateTimetag))
686  update_timetag_ = value[kNIMChatRoomMemberInfoKeyUpdateTimetag].asUInt64();
687  if (value.isMember(kNIMChatRoomMemberInfoKeyTempMute))
688  temp_muted_ = value[kNIMChatRoomMemberInfoKeyTempMute].asInt() == 1;
689  if (value.isMember(kNIMChatRoomMemberInfoKeyTempMuteRestDuration))
690  temp_muted_duration_ = value[kNIMChatRoomMemberInfoKeyTempMuteRestDuration].asInt64();
691  if (value.isMember(kNIMChatRoomMemberInfoKeyTag))
692  tags_ = value[kNIMChatRoomMemberInfoKeyTag].asString();
693  if (value.isMember(kNIMChatRoomMemberInfoKeyNotifyTags))
694  notify_tags_ = value[kNIMChatRoomMemberInfoKeyNotifyTags].asString();
695  }
696 
701  std::string ToJsonString() const {
702  nim_cpp_wrapper_util::Json::Value values;
703  values[kNIMChatRoomMemberInfoKeyRoomID] = room_id_;
704  values[kNIMChatRoomMemberInfoKeyAccID] = account_id_;
705  values[kNIMChatRoomMemberInfoKeyType] = type_;
706  values[kNIMChatRoomMemberInfoKeyLevel] = level_;
707  values[kNIMChatRoomMemberInfoKeyNick] = nick_;
708  values[kNIMChatRoomMemberInfoKeyAvatar] = avatar_;
709  values[kNIMChatRoomMemberInfoKeyExt] = ext_;
710  values[kNIMChatRoomMemberInfoKeyOnlineState] = state_;
711  values[kNIMChatRoomMemberInfoKeyGuestFlag] = guest_flag_;
712  values[kNIMChatRoomMemberInfoKeyEnterTimetag] = enter_timetag_;
713  values[kNIMChatRoomMemberInfoKeyBlacklist] = is_blacklist_ ? 1 : 0;
714  values[kNIMChatRoomMemberInfoKeyMuted] = is_muted_ ? 1 : 0;
715  values[kNIMChatRoomMemberInfoKeyValid] = is_valid_ ? 1 : 0;
716  values[kNIMChatRoomMemberInfoKeyUpdateTimetag] = update_timetag_;
717  values[kNIMChatRoomMemberInfoKeyTempMute] = temp_muted_ ? 1 : 0;
718  values[kNIMChatRoomMemberInfoKeyTempMuteRestDuration] = temp_muted_duration_;
719  return nim::GetJsonStringWithNoStyled(values);
720  }
721 };
722 
724 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueElement {
725  std::string key_;
726  std::string value_;
727 };
728 
730 typedef std::list<ChatRoomQueueElement> ChatRoomQueue;
731 
733 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API NIMChatRoomExitReasonInfo {
734  std::string notify_ext_;
735  NIMChatRoomExitReason code_;
736  operator NIMChatRoomExitReason() const { return code_; }
737 };
738 
740 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool operator==(const NIMChatRoomExitReasonInfo& info, NIMChatRoomExitReason code);
741 
749 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomEnterCallbackResultInfo(const std::string& result,
750  ChatRoomInfo& room_info,
751  ChatRoomMemberInfo& my_info);
752 
759 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMemberInfos(const std::string& infos_json_str, std::list<ChatRoomMemberInfo>& infos);
760 
767 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMsgs(const std::string& msgs_json_str, std::list<ChatRoomMessage>& msgs);
768 
770 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API RobotInfo {
771 public:
773  void SetAccid(const std::string& accid) { robot_info_[kNIMRobotInfoKeyAccid] = accid; }
774 
776  std::string GetAccid() const { return robot_info_[kNIMRobotInfoKeyAccid].asString(); }
777 
779  void SetName(const std::string& name) { robot_info_[kNIMRobotInfoKeyName] = name; }
780 
782  std::string GetName() const { return robot_info_[kNIMRobotInfoKeyName].asString(); }
783 
785  void SetIcon(const std::string& icon) { robot_info_[kNIMRobotInfoKeyIcon] = icon; }
786 
788  std::string GetIcon() const { return robot_info_[kNIMRobotInfoKeyIcon].asString(); }
789 
791  void SetIntro(const std::string& intro) { robot_info_[kNIMRobotInfoKeyIntro] = intro; }
792 
794  std::string GetIntro() const { return robot_info_[kNIMRobotInfoKeyIntro].asString(); }
795 
797  void SetRobotID(const std::string& id) { robot_info_[kNIMRobotInfoKeyRobotId] = id; }
798 
800  std::string GetRobotID() const { return robot_info_[kNIMRobotInfoKeyRobotId].asString(); }
801 
803  void SetCreateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyCreateTime] = time; }
804 
806  uint64_t GetCreateTime() const { return robot_info_[kNIMRobotInfoKeyCreateTime].asUInt64(); }
807 
809  void SetUpdateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyUpdateTime] = time; }
810 
812  uint64_t GetUpdateTime() const { return robot_info_[kNIMRobotInfoKeyUpdateTime].asUInt64(); }
813 
814 private:
815  nim_cpp_wrapper_util::Json::Value robot_info_;
816 };
817 
819 typedef std::list<RobotInfo> RobotInfos;
820 
827 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfosStringToRobotInfos(const std::string& infos_json, RobotInfos& infos);
828 
835 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfoStringToRobotInfo(const std::string& info_json, RobotInfo& info);
836 
837 typedef ChatRoomQueueElement ChatRoomMember;
839 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomBatchMembers {
840  std::map<std::string, std::string> members_values_;
842  ChatRoomBatchMembers() { members_values_.clear(); }
843  explicit ChatRoomBatchMembers(const std::map<std::string, std::string>& members)
844  : members_values_(members) {}
845 
846  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& json_str) { assert(false); }
847 
852  std::string ToJsonString() const {
853  nim_cpp_wrapper_util::Json::Value values;
854  int i = 0;
855  for (auto it = members_values_.begin(); it != members_values_.end(); ++it) {
856  values[i][kNIMChatRoomQueueElementKey] = it->first.c_str();
857  values[i][kNIMChatRoomQueueElementValue] = it->second.c_str();
858  i++;
859  }
860  return nim::GetJsonStringWithNoStyled(values);
861  }
862 };
863 
870 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseBatchInfosStringToNotMembers(const std::string& infos_json, std::list<std::string>& lst_members);
871 
872 } // namespace nim_chatroom
873 
874 #endif //_NIM_CHATROOM_SDK_CPP_HELPER_H_
nim_chatroom::ChatRoomNotification::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室通知
Definition: nim_chatroom_helper.h:246
nim_chatroom::ChatRoomQueueElement::value_
std::string value_
Definition: nim_chatroom_helper.h:726
nim_chatroom::ParseBatchInfosStringToNotMembers
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseBatchInfosStringToNotMembers(const std::string &infos_json, std::list< std::string > &lst_members)
解析成员列表
nim_chatroom::ChatRoomEnterInfo::SetExt
void SetExt(const nim_cpp_wrapper_util::Json::Value &ext)
设置聊天室可用的扩展字段,选填
Definition: nim_chatroom_helper.h:51
nim_chatroom::ChatRoomSetMemberAttributeParameters::ChatRoomSetMemberAttributeParameters
ChatRoomSetMemberAttributeParameters()
Definition: nim_chatroom_helper.h:602
nim_chatroom::ChatRoomAnoymityEnterInfo::app_data_file_
std::string app_data_file_
Definition: nim_chatroom_helper.h:128
nim_chatroom::ChatRoomQueueChangedNotification
聊天室队列通知内容
Definition: nim_chatroom_helper.h:291
nim_chatroom::ParseRobotInfosStringToRobotInfos
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfosStringToRobotInfos(const std::string &infos_json, RobotInfos &infos)
解析机器人信息
nim_chatroom::ChatRoomMessage::room_id_
int64_t room_id_
Definition: nim_chatroom_helper.h:410
nim_chatroom::NIMChatRoomExitReasonInfo::code_
NIMChatRoomExitReason code_
Definition: nim_chatroom_helper.h:735
nim_chatroom::ChatRoomIndependentEnterInfo::app_data_file_
std::string app_data_file_
Definition: nim_chatroom_helper.h:92
nim_chatroom::ChatRoomGetMsgHistoryParameters::start_timetag_
int64_t start_timetag_
Definition: nim_chatroom_helper.h:542
nim_chatroom::ParseChatRoomMsgs
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMsgs(const std::string &msgs_json_str, std::list< ChatRoomMessage > &msgs)
解析聊天室成员信息
nim_chatroom::ChatRoomMessageSetting::ChatRoomMessageSetting
ChatRoomMessageSetting()
Definition: nim_chatroom_helper.h:359
nim_chatroom::ChatRoomGetMembersByTagParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:531
nim_chatroom::ChatRoomAnoymityEnterInfo::random_id_
bool random_id_
Definition: nim_chatroom_helper.h:133
nim_chatroom_sdk_cpp_wrapper.h
定义导出宏
nim_chatroom::ChatRoomIndependentEnterInfo::address_
std::list< std::string > address_
Definition: nim_chatroom_helper.h:91
nim_chatroom::ChatRoomMemberInfo::enter_timetag_
int64_t enter_timetag_
Definition: nim_chatroom_helper.h:635
nim_chatroom::ChatRoomSetMemberAttributeParameters::opt_
bool opt_
Definition: nim_chatroom_helper.h:598
nim_chatroom::RobotInfo::GetCreateTime
uint64_t GetCreateTime() const
Definition: nim_chatroom_helper.h:806
nim_chatroom::ChatRoomNotification::temp_mute_duration_
int64_t temp_mute_duration_
Definition: nim_chatroom_helper.h:229
nim_chatroom
聊天室
nim_chatroom::ChatRoomIndependentEnterInfo::sdk_log_level_
int sdk_log_level_
Definition: nim_chatroom_helper.h:93
nim_chatroom::RobotInfo::GetAccid
std::string GetAccid() const
Definition: nim_chatroom_helper.h:776
nim_chatroom::ChatRoomIndependentEnterInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:106
nim_chatroom::ChatRoomNotification::operator_id_
std::string operator_id_
Definition: nim_chatroom_helper.h:225
nim_chatroom::ChatRoomGetMembersParameters::type_
NIMChatRoomGetMemberType type_
Definition: nim_chatroom_helper.h:494
nim_chatroom::ChatRoomAnoymityEnterInfo::login_tags_
std::list< std::string > login_tags_
Definition: nim_chatroom_helper.h:134
nim_chatroom::ChatRoomInfo::id_
int64_t id_
Definition: nim_chatroom_helper.h:166
nim_chatroom::RobotInfo
机器人信息
Definition: nim_chatroom_helper.h:770
nim_chatroom::RobotInfo::GetRobotID
std::string GetRobotID() const
Definition: nim_chatroom_helper.h:800
nim_chatroom::ChatRoomMessageSetting::history_save_
bool history_save_
Definition: nim_chatroom_helper.h:351
nim_chatroom::ChatRoomGetMsgHistoryParameters
获取聊天室消息历史参数
Definition: nim_chatroom_helper.h:541
nim_chatroom::ChatRoomMessage::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:477
nim_chatroom::ChatRoomMemberInfo::ChatRoomMemberInfo
ChatRoomMemberInfo()
Definition: nim_chatroom_helper.h:643
nim_chatroom::ChatRoomMemberInfo::guest_flag_
NIMChatRoomGuestFlag guest_flag_
Definition: nim_chatroom_helper.h:634
nim_chatroom::ChatRoomMemberInfo::is_muted_
bool is_muted_
Definition: nim_chatroom_helper.h:637
nim_chatroom::ChatRoomMemberInfo::tags_
std::string tags_
Definition: nim_chatroom_helper.h:626
nim_chatroom::ChatRoomGetMsgHistoryParameters::msg_types_
std::vector< NIMChatRoomMsgType > msg_types_
Definition: nim_chatroom_helper.h:545
nim_chatroom::ChatRoomGetMembersByTagParameters::ChatRoomGetMembersByTagParameters
ChatRoomGetMembersByTagParameters()
Definition: nim_chatroom_helper.h:523
nim_chatroom::ChatRoomMessage::local_res_path_
std::string local_res_path_
Definition: nim_chatroom_helper.h:434
nim_chatroom::ChatRoomInfo::announcement_
std::string announcement_
Definition: nim_chatroom_helper.h:168
nim_chatroom::ChatRoomGetMembersByTagParameters
根据 tag 获取聊天室成员参数
Definition: nim_chatroom_helper.h:517
nim_chatroom::ChatRoomGetMsgHistoryParameters::ChatRoomGetMsgHistoryParameters
ChatRoomGetMsgHistoryParameters()
Definition: nim_chatroom_helper.h:547
nim_chatroom::ChatRoomMessageSetting
聊天室消息属性设置
Definition: nim_chatroom_helper.h:346
nim_chatroom::ChatRoomMessageSetting::anti_spam_enable_
bool anti_spam_enable_
Definition: nim_chatroom_helper.h:349
nim_chatroom::ChatRoomMessage::timetag_
int64_t timetag_
Definition: nim_chatroom_helper.h:412
nim_chatroom::ChatRoomIndependentEnterInfo::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:98
nim_chatroom::ChatRoomMessageSetting::ToJsonValue
void ToJsonValue(nim_cpp_wrapper_util::Json::Value &message) const
组装Json Value字符串
Definition: nim_chatroom_helper.h:373
nim_chatroom::ChatRoomEnterInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:84
nim_chatroom::ChatRoomMessage::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室消息
Definition: nim_chatroom_helper.h:450
nim_chatroom::ChatRoomMemberInfo::state_
NIMChatRoomOnlineState state_
Definition: nim_chatroom_helper.h:633
nim_chatroom::ChatRoomGetMembersParameters::timestamp_offset_
int64_t timestamp_offset_
Definition: nim_chatroom_helper.h:495
nim_chatroom::ChatRoomSetMemberAttributeParameters::attribute_
NIMChatRoomMemberAttribute attribute_
Definition: nim_chatroom_helper.h:597
nim_chatroom::ChatRoomMemberInfo::temp_muted_
bool temp_muted_
Definition: nim_chatroom_helper.h:640
nim_chatroom::ChatRoomIndependentEnterInfo::login_tags_
std::list< std::string > login_tags_
Definition: nim_chatroom_helper.h:97
nim_chatroom::ChatRoomMessageSetting::anti_spam_content_
std::string anti_spam_content_
Definition: nim_chatroom_helper.h:350
nim_chatroom::ChatRoomGetMsgHistoryParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:577
nim_chatroom::NIMChatRoomExitReasonInfo
聊天室退出时的信息
Definition: nim_chatroom_helper.h:733
nim_chatroom::ChatRoomInfo::queuelevel
int queuelevel
Definition: nim_chatroom_helper.h:175
nim_chatroom::ChatRoomMemberInfo::is_valid_
bool is_valid_
Definition: nim_chatroom_helper.h:638
nim_chatroom::ChatRoomNotification::operator_nick_
std::string operator_nick_
Definition: nim_chatroom_helper.h:226
nim_chatroom::operator==
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool operator==(const NIMChatRoomExitReasonInfo &info, NIMChatRoomExitReason code)
nim_chatroom::ChatRoomInfo::name_
std::string name_
Definition: nim_chatroom_helper.h:167
nim_chatroom::ChatRoomMessageSetting::ParseMessageSetting
void ParseMessageSetting(const nim_cpp_wrapper_util::Json::Value &message)
从Json Value解析出消息属性设置
Definition: nim_chatroom_helper.h:393
nim_chatroom::ChatRoomBatchMembers::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:852
nim_chatroom::ChatRoomInfo::valid_flag_
int valid_flag_
Definition: nim_chatroom_helper.h:171
nim_chatroom::ChatRoomQueueElement
聊天室麦序队列元素
Definition: nim_chatroom_helper.h:724
nim_chatroom::ChatRoomQueueBatchChangedNotification::ParseFromNotification
void ParseFromNotification(const ChatRoomNotification &notification)
从聊天室通知中解析得到队列变更具体内容
Definition: nim_chatroom_helper.h:324
nim_chatroom::ChatRoomMemberInfo::account_id_
std::string account_id_
Definition: nim_chatroom_helper.h:625
nim_chatroom::ChatRoomAnoymityEnterInfo::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:135
nim_chatroom::ChatRoomMessage::msg_setting_
ChatRoomMessageSetting msg_setting_
Definition: nim_chatroom_helper.h:429
nim_chatroom::ParseChatRoomEnterCallbackResultInfo
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomEnterCallbackResultInfo(const std::string &result, ChatRoomInfo &room_info, ChatRoomMemberInfo &my_info)
解析聊天室登录结果
nim_chatroom::ChatRoomInfo::mute_all_
int mute_all_
Definition: nim_chatroom_helper.h:174
nim_chatroom::ChatRoomMemberInfo::nick_
std::string nick_
Definition: nim_chatroom_helper.h:629
nim_chatroom::ChatRoomMemberInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:701
nim_chatroom::ChatRoomInfo::ChatRoomInfo
ChatRoomInfo()
Definition: nim_chatroom_helper.h:177
nim_chatroom::ChatRoomNotification::ChatRoomNotification
ChatRoomNotification()
Definition: nim_chatroom_helper.h:236
nim_chatroom::RobotInfo::SetIcon
void SetIcon(const std::string &icon)
Definition: nim_chatroom_helper.h:785
nim_chatroom::ChatRoomGetMembersByTagParameters::limit_
int limit_
Definition: nim_chatroom_helper.h:520
nim_chatroom::ChatRoomEnterInfo::SetAvatar
void SetAvatar(const std::string &avatar)
设置进入聊天室后展示的头像,选填
Definition: nim_chatroom_helper.h:44
nim_chatroom::ChatRoomNotification::queue_change_
std::string queue_change_
Definition: nim_chatroom_helper.h:233
nim_chatroom::ChatRoomGetMsgHistoryParameters::reverse_
bool reverse_
Definition: nim_chatroom_helper.h:544
nim_chatroom::ChatRoomAnoymityEnterInfo::app_key_
std::string app_key_
Definition: nim_chatroom_helper.h:132
nim_chatroom::ChatRoomMemberInfo::room_id_
int64_t room_id_
Definition: nim_chatroom_helper.h:624
nim_chatroom::ChatRoomMessage
聊天室消息
Definition: nim_chatroom_helper.h:408
nim_chatroom::ChatRoomEnterInfo::SetNotifyTags
void SetNotifyTags(const std::string &expression)
登录时携带的 notify tag 表达式
Definition: nim_chatroom_helper.h:78
nim_chatroom::ParseRobotInfoStringToRobotInfo
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfoStringToRobotInfo(const std::string &info_json, RobotInfo &info)
解析机器人信息
nim_chatroom::ChatRoomNotification::temp_muted_
bool temp_muted_
Definition: nim_chatroom_helper.h:232
nim_chatroom::ChatRoomMemberInfo::update_timetag_
int64_t update_timetag_
Definition: nim_chatroom_helper.h:639
nim_chatroom::NIMChatRoomExitReasonInfo::notify_ext_
std::string notify_ext_
Definition: nim_chatroom_helper.h:734
nim_chatroom::RobotInfo::GetName
std::string GetName() const
Definition: nim_chatroom_helper.h:782
nim_chatroom::RobotInfo::SetName
void SetName(const std::string &name)
Definition: nim_chatroom_helper.h:779
nim_chatroom::RobotInfo::GetIcon
std::string GetIcon() const
Definition: nim_chatroom_helper.h:788
nim_chatroom::ChatRoomMemberInfo::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &value)
Definition: nim_chatroom_helper.h:658
nim_chatroom::ChatRoomGetMembersByTagParameters::timestamp_offset_
int64_t timestamp_offset_
Definition: nim_chatroom_helper.h:519
nim_chatroom::ChatRoomMemberInfo::level_
int level_
Definition: nim_chatroom_helper.h:628
nim_chatroom::ChatRoomEnterInfo::SetLoginTag
void SetLoginTag(const std::list< std::string > &login_tags)
设置登录携带的 tag 列表,允许多个
Definition: nim_chatroom_helper.h:67
nim_chatroom::ChatRoomMessage::from_nick_
std::string from_nick_
Definition: nim_chatroom_helper.h:414
nim_chatroom::ChatRoomInfo::broadcast_url_
std::string broadcast_url_
Definition: nim_chatroom_helper.h:169
nim_chatroom::ChatRoomBatchMembers
聊天室批量更新成员
Definition: nim_chatroom_helper.h:839
nim_chatroom::ChatRoomQueueChangedNotification::type_
std::string type_
Definition: nim_chatroom_helper.h:292
nim_chatroom::ChatRoomAnoymityEnterInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:146
nim_chatroom::ChatRoomMessage::from_avatar_
std::string from_avatar_
Definition: nim_chatroom_helper.h:415
nim_chatroom::ChatRoomGetMembersByTagParameters::tag_
std::string tag_
Definition: nim_chatroom_helper.h:518
nim_chatroom::ChatRoomMessageSetting::env_config_
std::string env_config_
Definition: nim_chatroom_helper.h:357
nim_chatroom::ChatRoomMemberInfo::is_blacklist_
bool is_blacklist_
Definition: nim_chatroom_helper.h:636
nim_chatroom::ChatRoomGetMembersParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:507
nim_chatroom::ChatRoomQueueElement::key_
std::string key_
Definition: nim_chatroom_helper.h:725
nim_chatroom::ChatRoomIndependentEnterInfo::token_
std::string token_
Definition: nim_chatroom_helper.h:96
nim_chatroom::ChatRoomMessage::client_msg_id_
std::string client_msg_id_
Definition: nim_chatroom_helper.h:427
nim_chatroom::ChatRoomMessageSetting::ext_
std::string ext_
Definition: nim_chatroom_helper.h:348
nim_chatroom::ChatRoomQueueBatchChangedNotification
通知麦序队列中有批量变更,发生在元素提交者离开聊天室或者从聊天室异常掉线时
Definition: nim_chatroom_helper.h:313
nim_chatroom::ChatRoomQueueBatchChangedNotification::type_
std::string type_
Definition: nim_chatroom_helper.h:314
nim_chatroom::ChatRoomInfo
聊天室信息
Definition: nim_chatroom_helper.h:165
nim_chatroom::ChatRoomNotification::id_
NIMChatRoomNotificationId id_
Definition: nim_chatroom_helper.h:223
nim_chatroom::ChatRoomGetMembersParameters::limit_
int limit_
Definition: nim_chatroom_helper.h:496
nim_chatroom::ChatRoomInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:205
nim_chatroom::RobotInfo::SetAccid
void SetAccid(const std::string &accid)
Definition: nim_chatroom_helper.h:773
nim_chatroom::ChatRoomMemberInfo::type_
int type_
Definition: nim_chatroom_helper.h:627
nim_chatroom::ChatRoomBatchMembers::ChatRoomBatchMembers
ChatRoomBatchMembers()
Definition: nim_chatroom_helper.h:842
nim_chatroom::ParseChatRoomMemberInfos
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMemberInfos(const std::string &infos_json_str, std::list< ChatRoomMemberInfo > &infos)
解析聊天室成员信息
nim_chatroom::ChatRoomNotification::muted_
bool muted_
Definition: nim_chatroom_helper.h:231
nim_chatroom::ChatRoomEnterInfo::SetNick
void SetNick(const std::string &nick)
设置进入聊天室后展示的昵称,选填
Definition: nim_chatroom_helper.h:37
nim_chatroom::ChatRoomQueueChangedNotification::key_
std::string key_
Definition: nim_chatroom_helper.h:293
nim_chatroom::RobotInfo::SetIntro
void SetIntro(const std::string &intro)
Definition: nim_chatroom_helper.h:791
nim_chatroom::ChatRoomMessage::ChatRoomMessage
ChatRoomMessage()
Definition: nim_chatroom_helper.h:438
nim_chatroom::ChatRoomSetMemberAttributeParameters::account_id_
std::string account_id_
Definition: nim_chatroom_helper.h:596
nim_chatroom::ChatRoomQueueChangedNotification::value_
std::string value_
Definition: nim_chatroom_helper.h:294
nim_chatroom::ChatRoomSetMemberAttributeParameters::notify_ext_
std::string notify_ext_
Definition: nim_chatroom_helper.h:599
nim_chatroom::RobotInfo::SetRobotID
void SetRobotID(const std::string &id)
Definition: nim_chatroom_helper.h:797
nim_chatroom::ChatRoomSetMemberAttributeParameters
设置聊天室成员身份标识参数
Definition: nim_chatroom_helper.h:595
nim_chatroom::ChatRoomMemberInfo::ext_
std::string ext_
Definition: nim_chatroom_helper.h:631
nim_chatroom::ChatRoomAnoymityEnterInfo::sdk_log_level_
int sdk_log_level_
Definition: nim_chatroom_helper.h:131
nim_chatroom::RobotInfo::SetUpdateTime
void SetUpdateTime(const uint64_t time)
Definition: nim_chatroom_helper.h:809
nim_chatroom::ChatRoomMemberInfo::temp_muted_duration_
int64_t temp_muted_duration_
Definition: nim_chatroom_helper.h:641
nim_chatroom::ChatRoomNotification
聊天室通知
Definition: nim_chatroom_helper.h:222
nim_chatroom::ChatRoomMessage::local_res_id_
std::string local_res_id_
Definition: nim_chatroom_helper.h:435
nim_chatroom::ChatRoomMemberInfo
聊天室成员信息
Definition: nim_chatroom_helper.h:623
nim_chatroom::ChatRoomEnterInfo::SetNotifyExt
void SetNotifyExt(const nim_cpp_wrapper_util::Json::Value &notify_ext)
设置进入聊天室通知开发者扩展字段,选填
Definition: nim_chatroom_helper.h:58
nim_chatroom::ChatRoomMessageSetting::anti_spam_using_yidun_
int anti_spam_using_yidun_
Definition: nim_chatroom_helper.h:353
nim_chatroom::ChatRoomEnterInfo
聊天室登录信息
Definition: nim_chatroom_helper.h:31
nim_chatroom::ChatRoomNotification::target_ids_
std::list< std::string > target_ids_
Definition: nim_chatroom_helper.h:228
nim_chatroom::ChatRoomGetMembersParameters
获取聊天室成员参数
Definition: nim_chatroom_helper.h:493
nim_chatroom::ChatRoomMessage::third_party_callback_ext_
std::string third_party_callback_ext_
Definition: nim_chatroom_helper.h:418
nim_chatroom::ChatRoomGetMsgHistoryParameters::limit_
int limit_
Definition: nim_chatroom_helper.h:543
nim_chatroom::ChatRoomQueueBatchChangedNotification::value_
std::string value_
Definition: nim_chatroom_helper.h:316
nim_chatroom::ChatRoomMessage::msg_body_
std::string msg_body_
Definition: nim_chatroom_helper.h:428
nim_chatroom::ChatRoomQueueBatchChangedNotification::key_
std::string key_
Definition: nim_chatroom_helper.h:315
nim_chatroom::ChatRoomMessage::msg_type_
NIMChatRoomMsgType msg_type_
Definition: nim_chatroom_helper.h:425
nim_chatroom::ChatRoomAnoymityEnterInfo::address_
std::list< std::string > address_
Definition: nim_chatroom_helper.h:126
nim_chatroom::ChatRoomNotification::ext_
std::string ext_
Definition: nim_chatroom_helper.h:224
nim_chatroom::ChatRoomQueueChangedNotification::ParseFromNotification
void ParseFromNotification(const ChatRoomNotification &notification)
从聊天室通知中解析得到队列变更具体内容
Definition: nim_chatroom_helper.h:301
nim_chatroom::ChatRoomMessage::from_client_type_
NIMChatRoomClientType from_client_type_
Definition: nim_chatroom_helper.h:413
nim_chatroom::ChatRoomQueue
std::list< ChatRoomQueueElement > ChatRoomQueue
聊天室麦序队列
Definition: nim_chatroom_helper.h:730
nim_chatroom::ChatRoomInfo::ext_
std::string ext_
Definition: nim_chatroom_helper.h:172
nim_chatroom::ChatRoomMessageSetting::yidun_anti_cheating_
std::string yidun_anti_cheating_
Definition: nim_chatroom_helper.h:356
nim_chatroom::ChatRoomInfo::creator_id_
std::string creator_id_
Definition: nim_chatroom_helper.h:170
nim_chatroom::ChatRoomMessage::msg_attach_
std::string msg_attach_
Definition: nim_chatroom_helper.h:426
nim_chatroom::RobotInfo::SetCreateTime
void SetCreateTime(const uint64_t time)
Definition: nim_chatroom_helper.h:803
nim_chatroom::ChatRoomMemberInfo::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:632
nim_chatroom::ChatRoomMessage::sub_type_
int32_t sub_type_
Definition: nim_chatroom_helper.h:431
nim_chatroom::ChatRoomMessageSetting::resend_flag_
bool resend_flag_
Definition: nim_chatroom_helper.h:347
nim_chatroom::ChatRoomMessageSetting::high_priority_
int high_priority_
Definition: nim_chatroom_helper.h:355
nim_chatroom::ChatRoomIndependentEnterInfo::accid_
std::string accid_
Definition: nim_chatroom_helper.h:95
nim_chatroom::ChatRoomMessage::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:421
nim_chatroom::ChatRoomInfo::online_count_
int online_count_
Definition: nim_chatroom_helper.h:173
nim_chatroom::ChatRoomNotification::target_nick_
std::list< std::string > target_nick_
Definition: nim_chatroom_helper.h:227
nim_chatroom::ChatRoomInfo::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室信息
Definition: nim_chatroom_helper.h:188
nim_chatroom::ChatRoomMessageSetting::anti_spam_bizid_
std::string anti_spam_bizid_
Definition: nim_chatroom_helper.h:352
nim_chatroom::ChatRoomIndependentEnterInfo
Definition: nim_chatroom_helper.h:90
nim_chatroom::ChatRoomAnoymityEnterInfo
Definition: nim_chatroom_helper.h:125
nim_chatroom::RobotInfo::GetIntro
std::string GetIntro() const
Definition: nim_chatroom_helper.h:794
nim_chatroom::ChatRoomMessage::from_id_
std::string from_id_
Definition: nim_chatroom_helper.h:411
nim_chatroom::ChatRoomQueueBatchChangedNotification::changed_values_
std::map< std::string, std::string > changed_values_
Definition: nim_chatroom_helper.h:317
nim_chatroom::ChatRoomMessage::from_ext_
std::string from_ext_
Definition: nim_chatroom_helper.h:416
nim_chatroom::ChatRoomGetMembersParameters::ChatRoomGetMembersParameters
ChatRoomGetMembersParameters()
Definition: nim_chatroom_helper.h:499
nim_chatroom::ChatRoomIndependentEnterInfo::app_key_
std::string app_key_
Definition: nim_chatroom_helper.h:94
nim_chatroom::RobotInfo::GetUpdateTime
uint64_t GetUpdateTime() const
Definition: nim_chatroom_helper.h:812
nim_chatroom::ChatRoomMemberInfo::avatar_
std::string avatar_
Definition: nim_chatroom_helper.h:630
nim_chatroom::ChatRoomSetMemberAttributeParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:609