NIM SDK API  9.0.0
nim_chatroom_helper.h
Go to the documentation of this file.
1 
7 #ifndef WRAPPER_NIM_CHATROOM_CPP_WRAPPER_HELPER_NIM_CHATROOM_HELPER_H_
8 #define WRAPPER_NIM_CHATROOM_CPP_WRAPPER_HELPER_NIM_CHATROOM_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
21 #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 
85  void SetLocation(NIMChatRoomLocation location) {
86  values_[kNIMChatRoomEnterLocationX] = location.x_;
87  values_[kNIMChatRoomEnterLocationY] = location.y_;
88  values_[kNIMChatRoomEnterLocationZ] = location.z_;
89  values_[kNIMChatRoomEnterLocationDistance] = location.distance_;
90  }
91 
97  void EnableLocation(bool enable) { values_[kNIMChatRoomEnterEnableLocation] = enable; }
98 
104  void SetAuthType(int auth_type) { values_[kNIMChatRoomEnterAuthType] = auth_type; }
105 
111  void SetLoginExt(const std::string& login_ext) { values_[kNIMChatRoomEnterLoginExt] = login_ext; }
112 
118  void SetAntiSpamBusinessID(const std::string& anti_spam_business_id) { values_[kNIMChatRoomEnterAntiSpamBusinessID] = anti_spam_business_id; }
119 
124  std::string ToJsonString() const { return values_.empty() ? "" : nim::GetJsonStringWithNoStyled(values_); }
125 
126 private:
127  nim_cpp_wrapper_util::Json::Value values_;
128 };
129 
130 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomIndependentEnterInfo {
131  std::list<std::string> address_;
132  std::string app_data_file_;
134  std::string app_key_;
135  std::string accid_;
136  std::string token_;
137  std::list<std::string> login_tags_;
138  std::string notify_tags_;
139  NIMChatRoomLocation location_;
143  std::string login_ext_;
147  sdk_log_level_ = 5;
148  location_ = {0};
149  enable_location_ = false;
150  auth_type_ = 0;
151  }
152 
157  std::string ToJsonString() const {
158  nim_cpp_wrapper_util::Json::Value values;
159  nim_cpp_wrapper_util::Json::FastWriter fw;
160  std::string addr_str;
161  for (auto& address : address_) {
162  values[kNIMChatRoomEnterKeyAddress].append(address);
163  }
164  std::string login_tags;
165  nim::StrListToJsonString(login_tags_, login_tags);
166  values[kNIMChatRoomEnterLoginTags] = login_tags;
167  values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
168  values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
169  values[kNIMChatRoomEnterKeyAppKey] = app_key_;
170  values[kNIMChatRoomEnterKeyAccID] = accid_;
171  values[kNIMChatRoomEnterKeyToken] = token_;
172  values[kNIMChatRoomEnterNotifyTags] = notify_tags_;
173  values[kNIMChatRoomEnterLocationX] = location_.x_;
174  values[kNIMChatRoomEnterLocationY] = location_.y_;
175  values[kNIMChatRoomEnterLocationZ] = location_.z_;
176  values[kNIMChatRoomEnterLocationDistance] = location_.distance_;
177  values[kNIMChatRoomEnterEnableLocation] = enable_location_;
178  values[kNIMChatRoomEnterAuthType] = auth_type_;
179  values[kNIMChatRoomEnterLoginExt] = login_ext_;
180  values[kNIMChatRoomEnterAntiSpamBusinessID] = anti_spam_business_id_;
181  return fw.write(values);
182  }
183 };
184 
185 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomAnoymityEnterInfo {
186  std::list<std::string> address_;
187  std::string
192  std::string app_key_;
193  bool random_id_;
194  std::string accid_;
195  std::string token_;
198  sdk_log_level_ = 5;
199  random_id_ = false;
200  }
201 
206  std::string ToJsonString() const {
207  nim_cpp_wrapper_util::Json::Value values;
208  nim_cpp_wrapper_util::Json::FastWriter fw;
209  std::string addr_str;
210  for (auto& address : address_) {
211  values[kNIMChatRoomEnterKeyAddress].append(address);
212  }
213  std::string login_tags;
214  values[kNIMChatRoomEnterLoginTags] = login_tags;
215  values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
216  values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
217  values[kNIMChatRoomEnterKeyAppKey] = app_key_;
218  values[kNIMChatRoomEnterKeyRandomID] = random_id_ ? 1 : 0;
219  if (!accid_.empty())
220  values[kNIMChatRoomEnterKeyAccID] = accid_;
221  if (!token_.empty())
222  values[kNIMChatRoomEnterKeyToken] = token_;
223  return fw.write(values);
224  }
225 };
226 
228 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomInfo {
229  int64_t id_;
230  std::string name_;
231  std::string announcement_;
232  std::string broadcast_url_;
233  std::string creator_id_;
235  std::string ext_;
237  int mute_all_;
241  : id_(0)
242  , valid_flag_(0)
243  , mute_all_(0)
244  , queuelevel(1) {}
245 
251  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& values) {
252  id_ = values[kNIMChatRoomInfoKeyID].asUInt64();
253  name_ = values[kNIMChatRoomInfoKeyName].asString();
254  announcement_ = values[kNIMChatRoomInfoKeyAnnouncement].asString();
255  broadcast_url_ = values[kNIMChatRoomInfoKeyBroadcastUrl].asString();
256  creator_id_ = values[kNIMChatRoomInfoKeyCreatorID].asString();
257  valid_flag_ = values[kNIMChatRoomInfoKeyValidFlag].asUInt();
258  ext_ = values[kNIMChatRoomInfoKeyExt].asString();
259  online_count_ = values[kNIMChatRoomInfoKeyOnlineCount].asUInt();
260  mute_all_ = values[kNIMChatRoomInfoKeyMuteAll].asUInt();
261  queuelevel = values[kNIMChatRoomInfoKeyQueuelevel].asInt();
262  }
263 
268  std::string ToJsonString() const {
269  nim_cpp_wrapper_util::Json::Value values;
270  values[kNIMChatRoomInfoKeyID] = id_;
271  values[kNIMChatRoomInfoKeyName] = name_;
272  values[kNIMChatRoomInfoKeyAnnouncement] = announcement_;
273  values[kNIMChatRoomInfoKeyBroadcastUrl] = broadcast_url_;
274  values[kNIMChatRoomInfoKeyCreatorID] = creator_id_;
275  values[kNIMChatRoomInfoKeyValidFlag] = valid_flag_;
276  values[kNIMChatRoomInfoKeyExt] = ext_;
277  values[kNIMChatRoomInfoKeyOnlineCount] = online_count_;
278  values[kNIMChatRoomInfoKeyMuteAll] = mute_all_;
279  values[kNIMChatRoomInfoKeyQueuelevel] = queuelevel;
280  return nim::GetJsonStringWithNoStyled(values);
281  }
282 };
283 
285 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomNotification {
286  NIMChatRoomNotificationId id_;
287  std::string ext_;
288  std::string operator_id_;
289  std::string operator_nick_;
290  std::list<std::string> target_nick_;
291  std::list<std::string> target_ids_;
294  bool muted_;
295  bool temp_muted_;
296  std::string queue_change_;
299  std::string target_tag_;
302  std::string msg_id_;
303  uint64_t msg_timetag_;
307  : temp_mute_duration_(0)
308  , muted_(false)
309  , temp_muted_(false)
310  , msg_timetag_(0) {}
311 
317  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& values) {
318  id_ = (NIMChatRoomNotificationId)values[kChatRoomNotificationKeyID].asUInt();
319  ext_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyExt].asString();
320  operator_id_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyOpt].asString();
321  operator_nick_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyOptNick].asString();
322  nim::JsonStrArrayToList(values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTargetNick], target_nick_);
323  nim::JsonStrArrayToList(values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTarget], target_ids_);
324  if (id_ == kNIMChatRoomNotificationIdMemberTempMute || id_ == kNIMChatRoomNotificationIdMemberTempUnMute)
325  temp_mute_duration_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTempMuteDuration].asInt64();
326  if (id_ == kNIMChatRoomNotificationIdMemberIn) {
327  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyMuteFlag))
328  muted_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyMuteFlag].asUInt() == 1;
329  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyTempMutedFlag))
330  temp_muted_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTempMutedFlag].asUInt() == 1;
331  temp_mute_duration_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyMemberInTempMutedDuration].asInt64();
332  }
333  if (id_ == kNIMChatRoomNotificationIdQueueChanged || id_ == kNIMChatRoomNotificationIdQueueBatchChanged ||
334  id_ == kNIMChatRoomNotificationIdQueueBatchOffer) {
335  queue_change_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyQueueChange].asString();
336  }
337  if (id_ == kNIMChatRoomNotificationIdTagTempMuteAdd || id_ == kNIMChatRoomNotificationIdTagTempMuteRemove) {
338  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyTargetTag)) {
339  target_tag_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyTargetTag].asString();
340  }
341  }
342  if (id_ == kNIMChatRoomNotificationIdRecallMessage) {
343  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyMsgTimetag)) {
344  msg_timetag_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyMsgTimetag].asUInt64();
345  }
346  if (values[kChatRoomNotificationKeyData].isMember(kChatRoomNotificationDataKeyMsgId)) {
347  msg_id_ = values[kChatRoomNotificationKeyData][kChatRoomNotificationDataKeyMsgId].asString();
348  }
349  }
350  }
351 
352  std::string ToJsonString() const {
353  nim_cpp_wrapper_util::Json::Value values;
354  values[kNIMChatRoomInfoKeyID] = id_;
355  values[kChatRoomNotificationDataKeyExt] = ext_;
356  values[kChatRoomNotificationDataKeyOpt] = operator_id_;
357  values[kChatRoomNotificationDataKeyOptNick] = operator_nick_;
358  for (const auto& nick : target_nick_) {
359  values[kChatRoomNotificationDataKeyTargetNick].append(nick);
360  }
361  for (const auto& id : target_ids_) {
362  values[kChatRoomNotificationDataKeyTarget].append(id);
363  }
364  values[kChatRoomNotificationDataKeyTempMuteDuration] = temp_mute_duration_;
365  values[kChatRoomNotificationDataKeyMuteFlag] = muted_;
366  values[kChatRoomNotificationDataKeyTempMutedFlag] = temp_muted_;
367  values[kChatRoomNotificationDataKeyQueueChange] = queue_change_;
368  if (!target_tag_.empty())
369  values[kChatRoomNotificationDataKeyTargetTag] = target_tag_;
370  if (!msg_id_.empty()) {
371  values[kChatRoomNotificationDataKeyMsgTimetag] = msg_timetag_;
372  values[kChatRoomNotificationDataKeyMsgId] = msg_id_;
373  }
374 
375  return nim::GetJsonStringWithNoStyled(values);
376  }
377 };
378 
380 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueOfferOption {
381 public:
382  bool transient_;
383  std::string element_accid_;
385  : transient_(false) {}
386  std::string ToJsonString() const {
387  nim_cpp_wrapper_util::Json::Value values;
388  nim_cpp_wrapper_util::Json::FastWriter writer;
389  values[kNIMChatRoomQueueOfferOptionTransient] = transient_;
390  if (!element_accid_.empty())
391  values[kNIMChatRoomQueueOfferOptionElementAccId] = element_accid_;
392  return writer.write(values);
393  }
394 };
395 
397 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueChangedNotification {
398  std::string type_;
399  std::string key_;
400  std::string value_;
407  void ParseFromNotification(const ChatRoomNotification& notification) {
408  nim_cpp_wrapper_util::Json::Value values;
409  nim_cpp_wrapper_util::Json::Reader reader;
410  if (reader.parse(notification.queue_change_, values) && values.isObject()) {
411  type_ = values[kNIMChatRoomNotificationQueueChangedKeyType].asString();
412  key_ = values[kNIMChatRoomNotificationQueueChangedKeyKey].asString();
413  value_ = values[kNIMChatRoomNotificationQueueChangedKeyValue].asString();
414  }
415  }
416 };
417 
419 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueBatchChangedNotification {
420  std::string type_;
421  std::string key_;
422  std::string value_;
423  std::map<std::string, std::string> changed_values_;
430  void ParseFromNotification(const ChatRoomNotification& notification) {
431  nim_cpp_wrapper_util::Json::Value values;
432  nim_cpp_wrapper_util::Json::Reader reader;
433  if (reader.parse(notification.queue_change_, values) && values.isObject()) {
434  type_ = values[kNIMChatRoomNotificationQueueBatchChangedKeyType].asString();
435  if (values.isMember(kNIMChatRoomNotificationQueueBatchChangedKeyKey))
436  key_ = values[kNIMChatRoomNotificationQueueBatchChangedKeyKey].asString();
437  if (values.isMember(kNIMChatRoomNotificationQueueBatchChangedKeyValue))
438  value_ = values[kNIMChatRoomNotificationQueueBatchChangedKeyValue].asString();
439  if (values.isMember(kNIMChatRoomNotificationQueueBatchChangedKeyObject)) {
440  auto members_name = values[kNIMChatRoomNotificationQueueBatchChangedKeyObject].getMemberNames();
441  auto it = members_name.begin();
442  while (it != members_name.end()) {
443  changed_values_.insert(std::make_pair(*it, values[kNIMChatRoomNotificationQueueBatchChangedKeyObject][*it].asString()));
444  it++;
445  }
446  }
447  }
448  }
449 };
450 
452 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomMessageSetting {
454  std::string ext_;
456  std::string anti_spam_content_;
458  std::string anti_spam_bizid_;
462  std::string yidun_anti_cheating_;
463  std::string env_config_;
464  std::string anti_spam_ext_;
465  NIMChatRoomLocation location_;
466  std::list<std::string> to_accids;
469  : resend_flag_(false)
470  , anti_spam_enable_(false)
471  , history_save_(true)
472  , anti_spam_bizid_("")
473  , anti_spam_using_yidun_(1)
474  , high_priority_(0)
475  , yidun_anti_cheating_("")
476  , anti_spam_ext_("")
477  , location_({0}) {}
478 
484  void ToJsonValue(nim_cpp_wrapper_util::Json::Value& message) const {
485  message[kNIMChatRoomMsgKeyResendFlag] = resend_flag_ ? 1 : 0;
486  message[kNIMChatRoomMsgKeyExt] = ext_;
487  message[kNIMChatRoomMsgKeyAntiSpamEnable] = anti_spam_enable_ ? 1 : 0;
488  message[kNIMChatRoomMsgKeyAntiSpamContent] = anti_spam_content_;
489  if (!anti_spam_bizid_.empty())
490  message[kNIMChatRoomMsgKeyAntiSpamBizId] = anti_spam_bizid_;
491  message[kNIMChatRoomMsgKeyHistorySave] = history_save_ ? 1 : 0;
492  message[kNIMChatRoomMsgKeyAntiSpamUsingYiDun] = anti_spam_using_yidun_;
493  if (!yidun_anti_cheating_.empty())
494  message[kNIMChatRoomMsgKeyYiDunAntiCheating] = yidun_anti_cheating_;
495  if (!env_config_.empty())
496  message[kNIMChatRoomMsgKeyEnvConfig] = env_config_;
497  if (!anti_spam_ext_.empty())
498  message[kNIMChatRoomMsgKeyAntiSpamExt] = anti_spam_ext_;
499  message[kNIMChatRoomMsgKeyLocationX] = location_.x_;
500  message[kNIMChatRoomMsgKeyLocationY] = location_.y_;
501  message[kNIMChatRoomMsgKeyLocationZ] = location_.z_;
502  std::string to_accids_str;
503  nim::StrListToJsonString(to_accids, to_accids_str);
504  message[kNIMChatRoomMsgKeyToAccids] = to_accids_str;
505  }
506 
512  void ParseMessageSetting(const nim_cpp_wrapper_util::Json::Value& message) {
513  resend_flag_ = message[kNIMChatRoomMsgKeyResendFlag].asUInt() == 1;
514  ext_ = message[kNIMChatRoomMsgKeyExt].asString();
515  if (message.isMember(kNIMChatRoomMsgKeyAntiSpamEnable))
516  anti_spam_enable_ = message[kNIMChatRoomMsgKeyAntiSpamEnable].asInt() == 1;
517  anti_spam_content_ = message[kNIMChatRoomMsgKeyAntiSpamContent].asString();
518  high_priority_ = message[kNIMChatRoomMsgKeyHighPriorityFlag].asInt();
519  if (message.isMember(kNIMChatRoomMsgKeyYiDunAntiCheating))
520  yidun_anti_cheating_ = message[kNIMChatRoomMsgKeyYiDunAntiCheating].asString();
521  if (message.isMember(kNIMChatRoomMsgKeyEnvConfig))
522  env_config_ = message[kNIMChatRoomMsgKeyEnvConfig].asString();
523  if (message.isMember(kNIMChatRoomMsgKeyAntiSpamExt))
524  anti_spam_ext_ = message[kNIMChatRoomMsgKeyAntiSpamExt].asString();
525  if (message.isMember(kNIMChatRoomMsgKeyLocationX))
526  location_.x_ = message[kNIMChatRoomMsgKeyLocationX].asFloat();
527  if (message.isMember(kNIMChatRoomMsgKeyLocationY))
528  location_.y_ = message[kNIMChatRoomMsgKeyLocationY].asFloat();
529  if (message.isMember(kNIMChatRoomMsgKeyLocationZ))
530  location_.z_ = message[kNIMChatRoomMsgKeyLocationZ].asFloat();
531  if (message.isMember(kNIMChatRoomMsgKeyToAccids)) {
532  to_accids.clear();
533  nim::JsonStrArrayToList(message[kNIMChatRoomMsgKeyToAccids], to_accids);
534  }
535  }
536 };
537 
539 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomMessage {
540 public:
541  int64_t room_id_;
542  std::string from_id_;
543  int64_t timetag_;
544  NIMChatRoomClientType from_client_type_;
545  std::string from_nick_;
546  std::string from_avatar_;
547  std::string from_ext_;
548  // v7.8 <--
550  // --> v7.8
551  // v8.4.0 <--
552  std::string notify_tags_;
553  // --> v8.4.0
554  std::string anti_spam_res_;
556 public:
557  NIMChatRoomMsgType msg_type_;
558  std::string msg_attach_;
559  std::string client_msg_id_;
560  std::string msg_body_;
562  // v7.8 <--
563  int32_t sub_type_;
564  // --> v7.8
565 public:
566  std::string local_res_path_;
567  std::string local_res_id_;
571  : room_id_(-1)
572  , from_client_type_(kNIMChatRoomClientTypeDefault)
573  , timetag_(0)
574  , third_party_callback_ext_("")
575  , sub_type_(0) {}
576 
582  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& values) {
583  room_id_ = values[kNIMChatRoomMsgKeyRoomID].asUInt64();
584  from_id_ = values[kNIMChatRoomMsgKeyFromAccount].asString();
585  timetag_ = values[kNIMChatRoomMsgKeyTime].asUInt64();
586  from_client_type_ = (NIMChatRoomClientType)values[kNIMChatRoomMsgKeyFromClientType].asUInt();
587  from_nick_ = values[kNIMChatRoomMsgKeyFromNick].asString();
588  from_avatar_ = values[kNIMChatRoomMsgKeyFromAvatar].asString();
589  from_ext_ = values[kNIMChatRoomMsgKeyFromExt].asString();
590  msg_type_ = (NIMChatRoomMsgType)values[kNIMChatRoomMsgKeyType].asUInt();
591  msg_attach_ = values[kNIMChatRoomMsgKeyAttach].asString();
592  client_msg_id_ = values[kNIMChatRoomMsgKeyClientMsgid].asString();
593  local_res_path_ = values[kNIMChatRoomMsgKeyLocalFilePath].asString();
594  local_res_id_ = values[kNIMChatRoomMsgKeyLocalResId].asString();
595  msg_body_ = values[kNIMChatRoomMsgKeyBody].asString();
596  msg_setting_.ParseMessageSetting(values);
597  if (values.isMember(kNIMChatRoomMsgKeyThirdPartyCBEXT))
598  third_party_callback_ext_ = values[kNIMChatRoomMsgKeyThirdPartyCBEXT].asString();
599  if (values.isMember(kNIMChatRoomMsgKeySubType))
600  sub_type_ = values[kNIMChatRoomMsgKeySubType].asInt();
601  if (values.isMember(kNIMChatRoomMsgKeyNotifyTags))
602  notify_tags_ = values[kNIMChatRoomMsgKeyNotifyTags].asString();
603  if (values.isMember(kNIMChatRoomMsgKeyAntiSpamRes))
604  anti_spam_res_ = values[kNIMChatRoomMsgKeyAntiSpamRes].asString();
605  }
606 
611  std::string ToJsonString() const {
612  nim_cpp_wrapper_util::Json::Value values;
613  values[kNIMChatRoomMsgKeyType] = msg_type_;
614  values[kNIMChatRoomMsgKeyTime] = timetag_;
615  values[kNIMChatRoomMsgKeyAttach] = msg_attach_;
616  values[kNIMChatRoomMsgKeyClientMsgid] = client_msg_id_;
617  values[kNIMChatRoomMsgKeyLocalFilePath] = local_res_path_;
618  values[kNIMChatRoomMsgKeyLocalResId] = local_res_id_;
619  values[kNIMChatRoomMsgKeyBody] = msg_body_;
620  values[kNIMChatRoomMsgKeyThirdPartyCBEXT] = third_party_callback_ext_;
621  values[kNIMChatRoomMsgKeySubType] = sub_type_;
622  values[kNIMChatRoomMsgKeyAntiSpamRes] = anti_spam_res_;
623  msg_setting_.ToJsonValue(values);
624  return nim::GetJsonStringWithNoStyled(values);
625  }
626 };
627 
629 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomGetMembersParameters {
630  NIMChatRoomGetMemberType type_;
632  int limit_;
636  : timestamp_offset_(0)
637  , limit_(0) {}
638 
643  std::string ToJsonString() const {
644  nim_cpp_wrapper_util::Json::Value values;
645  values[kNIMChatRoomGetMembersKeyType] = type_;
646  values[kNIMChatRoomGetMembersKeyOffset] = timestamp_offset_;
647  values[kNIMChatRoomGetMembersKeyLimit] = limit_;
648  return nim::GetJsonStringWithNoStyled(values);
649  }
650 };
651 
653 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomGetMembersByTagParameters {
654  std::string tag_;
656  int limit_;
660  : timestamp_offset_(0)
661  , limit_(0) {}
662 
667  std::string ToJsonString() const {
668  nim_cpp_wrapper_util::Json::Value values;
669  values[kNIMChatRoomGetMembersKeyTag] = tag_;
670  values[kNIMChatRoomGetMembersKeyOffset] = timestamp_offset_;
671  values[kNIMChatRoomGetMembersKeyLimit] = limit_;
672  return nim::GetJsonStringWithNoStyled(values);
673  }
674 };
675 
677 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomGetMsgHistoryParameters {
678  int64_t start_timetag_;
679  int limit_;
680  bool reverse_;
681  std::vector<NIMChatRoomMsgType> msg_types_;
684  : start_timetag_(0)
685  , limit_(0)
686  , reverse_(false) {
687  if (kMsg_Types_List.empty()) {
688  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeText);
689  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeImage);
690  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeAudio);
691  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeVideo);
692  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeLocation);
693  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeNotification);
694  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeFile);
695  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeRobot);
696  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeTips);
697  kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeCustom);
698  }
699  msg_types_.assign(kMsg_Types_List.begin(), kMsg_Types_List.end());
700  }
701  // 考虑到兼容以前版本,只提供删除类型接口,如果所有类型都被删除,会添加Unknown类型以区别之前的版本
702  void RemoveMessageType(NIMChatRoomMsgType type) {
703  auto it = std::find_if(msg_types_.begin(), msg_types_.end(), [&](const NIMChatRoomMsgType& item) {
704  return item == type;
705  });
706  if (it != msg_types_.end())
707  msg_types_.erase(it);
708  if (msg_types_.empty())
709  msg_types_.emplace_back(kNIMChatRoomMsgTypeUnknown);
710  }
715  std::string ToJsonString() const {
716  nim_cpp_wrapper_util::Json::Value values;
717  values[kNIMChatRoomGetMsgHistoryKeyStartTime] = start_timetag_;
718  values[kNIMChatRoomGetMsgHistoryKeyLimit] = limit_;
719  values[kNIMChatRoomGetMsgHistoryKeyReverse] = reverse_;
720  auto it = msg_types_.begin();
721  while (it != msg_types_.end()) {
722  values[kNIMChatRoomGetMsgHistoryKeyMsgtypes].append(nim_cpp_wrapper_util::Json::Value(*it));
723  it++;
724  }
725  return nim::GetJsonStringWithNoStyled(values);
726  }
727 
728 private:
729  static std::vector<NIMChatRoomMsgType> kMsg_Types_List;
730 };
731 
733 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomSetMemberAttributeParameters {
734  std::string account_id_;
735  NIMChatRoomMemberAttribute attribute_;
736  bool opt_;
737  std::string notify_ext_;
741  : level_(0) {}
742 
747  std::string ToJsonString() const {
748  nim_cpp_wrapper_util::Json::Value values;
749  values[kNIMChatRoomSetMemberAttributeKeyAccoutID] = account_id_;
750  values[kNIMChatRoomSetMemberAttributeKeyAttribute] = attribute_;
751  values[kNIMChatRoomSetMemberAttributeKeyOpt] = opt_;
752  values[kNIMChatRoomSetMemberAttributeKeyNotifyExt] = notify_ext_;
753  return nim::GetJsonStringWithNoStyled(values);
754  }
755 
756 private:
757  int level_;
758 };
759 
761 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomMemberInfo {
762  int64_t room_id_;
763  std::string account_id_;
764  std::string tags_;
765  int type_;
766  int level_;
767  std::string nick_;
768  std::string avatar_;
769  std::string ext_;
770  std::string notify_tags_;
771  NIMChatRoomOnlineState state_;
772  NIMChatRoomGuestFlag guest_flag_;
773  int64_t enter_timetag_;
775  bool is_muted_;
776  bool is_valid_;
777  int64_t update_timetag_;
778  bool temp_muted_;
782  : room_id_(0)
783  , type_(-2)
784  , level_(0)
785  , state_(kNIMChatRoomOnlineStateOffline)
786  , guest_flag_(kNIMChatRoomGuestFlagGuest)
787  , enter_timetag_(0)
788  , is_blacklist_(false)
789  , is_muted_(false)
790  , is_valid_(false)
791  , update_timetag_(0)
792  , temp_muted_(false)
793  , temp_muted_duration_(0) {}
794 
796  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& value) {
797  if (value.isMember(kNIMChatRoomMemberInfoKeyRoomID))
798  room_id_ = value[kNIMChatRoomMemberInfoKeyRoomID].asUInt64();
799  if (value.isMember(kNIMChatRoomMemberInfoKeyAccID))
800  account_id_ = value[kNIMChatRoomMemberInfoKeyAccID].asString();
801  if (value.isMember(kNIMChatRoomMemberInfoKeyType))
802  type_ = value[kNIMChatRoomMemberInfoKeyType].asInt();
803  if (value.isMember(kNIMChatRoomMemberInfoKeyLevel))
804  level_ = value[kNIMChatRoomMemberInfoKeyLevel].asInt();
805  if (value.isMember(kNIMChatRoomMemberInfoKeyNick))
806  nick_ = value[kNIMChatRoomMemberInfoKeyNick].asString();
807  if (value.isMember(kNIMChatRoomMemberInfoKeyAvatar))
808  avatar_ = value[kNIMChatRoomMemberInfoKeyAvatar].asString();
809  if (value.isMember(kNIMChatRoomMemberInfoKeyExt))
810  ext_ = value[kNIMChatRoomMemberInfoKeyExt].asString();
811  if (value.isMember(kNIMChatRoomMemberInfoKeyOnlineState))
812  state_ = (NIMChatRoomOnlineState)value[kNIMChatRoomMemberInfoKeyOnlineState].asInt();
813  if (value.isMember(kNIMChatRoomMemberInfoKeyGuestFlag))
814  guest_flag_ = (NIMChatRoomGuestFlag)value[kNIMChatRoomMemberInfoKeyGuestFlag].asInt();
815  if (value.isMember(kNIMChatRoomMemberInfoKeyEnterTimetag))
816  enter_timetag_ = value[kNIMChatRoomMemberInfoKeyEnterTimetag].asUInt64();
817  if (value.isMember(kNIMChatRoomMemberInfoKeyBlacklist))
818  is_blacklist_ = value[kNIMChatRoomMemberInfoKeyBlacklist].asInt() == 1;
819  if (value.isMember(kNIMChatRoomMemberInfoKeyMuted))
820  is_muted_ = value[kNIMChatRoomMemberInfoKeyMuted].asInt() == 1;
821  if (value.isMember(kNIMChatRoomMemberInfoKeyValid))
822  is_valid_ = value[kNIMChatRoomMemberInfoKeyValid].asInt() == 1;
823  if (value.isMember(kNIMChatRoomMemberInfoKeyUpdateTimetag))
824  update_timetag_ = value[kNIMChatRoomMemberInfoKeyUpdateTimetag].asUInt64();
825  if (value.isMember(kNIMChatRoomMemberInfoKeyTempMute))
826  temp_muted_ = value[kNIMChatRoomMemberInfoKeyTempMute].asInt() == 1;
827  if (value.isMember(kNIMChatRoomMemberInfoKeyTempMuteRestDuration))
828  temp_muted_duration_ = value[kNIMChatRoomMemberInfoKeyTempMuteRestDuration].asInt64();
829  if (value.isMember(kNIMChatRoomMemberInfoKeyTag))
830  tags_ = value[kNIMChatRoomMemberInfoKeyTag].asString();
831  if (value.isMember(kNIMChatRoomMemberInfoKeyNotifyTags))
832  notify_tags_ = value[kNIMChatRoomMemberInfoKeyNotifyTags].asString();
833  }
834 
839  std::string ToJsonString() const {
840  nim_cpp_wrapper_util::Json::Value values;
841  values[kNIMChatRoomMemberInfoKeyRoomID] = room_id_;
842  values[kNIMChatRoomMemberInfoKeyAccID] = account_id_;
843  values[kNIMChatRoomMemberInfoKeyType] = type_;
844  values[kNIMChatRoomMemberInfoKeyLevel] = level_;
845  values[kNIMChatRoomMemberInfoKeyNick] = nick_;
846  values[kNIMChatRoomMemberInfoKeyAvatar] = avatar_;
847  values[kNIMChatRoomMemberInfoKeyExt] = ext_;
848  values[kNIMChatRoomMemberInfoKeyOnlineState] = state_;
849  values[kNIMChatRoomMemberInfoKeyGuestFlag] = guest_flag_;
850  values[kNIMChatRoomMemberInfoKeyEnterTimetag] = enter_timetag_;
851  values[kNIMChatRoomMemberInfoKeyBlacklist] = is_blacklist_ ? 1 : 0;
852  values[kNIMChatRoomMemberInfoKeyMuted] = is_muted_ ? 1 : 0;
853  values[kNIMChatRoomMemberInfoKeyValid] = is_valid_ ? 1 : 0;
854  values[kNIMChatRoomMemberInfoKeyUpdateTimetag] = update_timetag_;
855  values[kNIMChatRoomMemberInfoKeyTempMute] = temp_muted_ ? 1 : 0;
856  values[kNIMChatRoomMemberInfoKeyTempMuteRestDuration] = temp_muted_duration_;
857  return nim::GetJsonStringWithNoStyled(values);
858  }
859 };
860 
862 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomQueueElement {
863  std::string key_;
864  std::string value_;
865 };
866 
868 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomUpdateTagsInfo {
869  std::list<std::string> tags_;
870  std::string notify_target_tags_;
871  int need_notify_{0};
872  std::string ext_;
873 };
874 
876 typedef std::list<ChatRoomQueueElement> ChatRoomQueue;
877 
879 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API NIMChatRoomExitReasonInfo {
880  std::string notify_ext_;
881  NIMChatRoomExitReason code_;
882  operator NIMChatRoomExitReason() const { return code_; }
883 };
884 
886 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool operator==(const NIMChatRoomExitReasonInfo& info, NIMChatRoomExitReason code);
887 
895 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomEnterCallbackResultInfo(const std::string& result,
896  ChatRoomInfo& room_info,
897  ChatRoomMemberInfo& my_info);
898 
905 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMemberInfos(const std::string& infos_json_str, std::list<ChatRoomMemberInfo>& infos);
906 
913 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMsgs(const std::string& msgs_json_str, std::list<ChatRoomMessage>& msgs);
914 
916 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API RobotInfo {
917 public:
919  void SetAccid(const std::string& accid) { robot_info_[kNIMRobotInfoKeyAccid] = accid; }
920 
922  std::string GetAccid() const { return robot_info_[kNIMRobotInfoKeyAccid].asString(); }
923 
925  void SetName(const std::string& name) { robot_info_[kNIMRobotInfoKeyName] = name; }
926 
928  std::string GetName() const { return robot_info_[kNIMRobotInfoKeyName].asString(); }
929 
931  void SetIcon(const std::string& icon) { robot_info_[kNIMRobotInfoKeyIcon] = icon; }
932 
934  std::string GetIcon() const { return robot_info_[kNIMRobotInfoKeyIcon].asString(); }
935 
937  void SetIntro(const std::string& intro) { robot_info_[kNIMRobotInfoKeyIntro] = intro; }
938 
940  std::string GetIntro() const { return robot_info_[kNIMRobotInfoKeyIntro].asString(); }
941 
943  void SetRobotID(const std::string& id) { robot_info_[kNIMRobotInfoKeyRobotId] = id; }
944 
946  std::string GetRobotID() const { return robot_info_[kNIMRobotInfoKeyRobotId].asString(); }
947 
949  void SetCreateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyCreateTime] = time; }
950 
952  uint64_t GetCreateTime() const { return robot_info_[kNIMRobotInfoKeyCreateTime].asUInt64(); }
953 
955  void SetUpdateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyUpdateTime] = time; }
956 
958  uint64_t GetUpdateTime() const { return robot_info_[kNIMRobotInfoKeyUpdateTime].asUInt64(); }
959 
960 private:
961  nim_cpp_wrapper_util::Json::Value robot_info_;
962 };
963 
965 typedef std::list<RobotInfo> RobotInfos;
966 
973 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfosStringToRobotInfos(const std::string& infos_json, RobotInfos& infos);
974 
981 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfoStringToRobotInfo(const std::string& info_json, RobotInfo& info);
982 
983 typedef ChatRoomQueueElement ChatRoomMember;
985 struct NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API ChatRoomBatchMembers {
986  std::map<std::string, std::string> members_values_;
988  ChatRoomBatchMembers() { members_values_.clear(); }
989  explicit ChatRoomBatchMembers(const std::map<std::string, std::string>& members)
990  : members_values_(members) {}
991 
992  void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& json_str) { assert(false); }
993 
998  std::string ToJsonString() const {
999  nim_cpp_wrapper_util::Json::Value values;
1000  int i = 0;
1001  for (auto it = members_values_.begin(); it != members_values_.end(); ++it) {
1002  values[i][kNIMChatRoomQueueElementKey] = it->first.c_str();
1003  values[i][kNIMChatRoomQueueElementValue] = it->second.c_str();
1004  i++;
1005  }
1006  return nim::GetJsonStringWithNoStyled(values);
1007  }
1008 };
1009 
1016 NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseBatchInfosStringToNotMembers(const std::string& infos_json, std::list<std::string>& lst_members);
1017 
1018 } // namespace nim_chatroom
1019 
1020 #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:317
nim_chatroom::ChatRoomQueueElement::value_
std::string value_
Definition: nim_chatroom_helper.h:864
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:740
nim_chatroom::ChatRoomAnoymityEnterInfo::app_data_file_
std::string app_data_file_
Definition: nim_chatroom_helper.h:188
nim_chatroom::ChatRoomQueueChangedNotification
聊天室队列通知内容
Definition: nim_chatroom_helper.h:397
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:541
nim_chatroom::NIMChatRoomExitReasonInfo::code_
NIMChatRoomExitReason code_
Definition: nim_chatroom_helper.h:881
nim_chatroom::ChatRoomMessageSetting::anti_spam_ext_
std::string anti_spam_ext_
Definition: nim_chatroom_helper.h:464
nim_chatroom::ChatRoomIndependentEnterInfo::app_data_file_
std::string app_data_file_
Definition: nim_chatroom_helper.h:132
nim_chatroom::ChatRoomGetMsgHistoryParameters::start_timetag_
int64_t start_timetag_
Definition: nim_chatroom_helper.h:678
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:468
nim_chatroom::ChatRoomIndependentEnterInfo::enable_location_
bool enable_location_
Definition: nim_chatroom_helper.h:140
nim_chatroom::ChatRoomGetMembersByTagParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:667
nim_chatroom::ChatRoomAnoymityEnterInfo::random_id_
bool random_id_
Definition: nim_chatroom_helper.h:193
nim_chatroom_sdk_cpp_wrapper.h
定义导出宏
nim_chatroom::ChatRoomIndependentEnterInfo::address_
std::list< std::string > address_
Definition: nim_chatroom_helper.h:131
nim_chatroom::ChatRoomMemberInfo::enter_timetag_
int64_t enter_timetag_
Definition: nim_chatroom_helper.h:773
nim_chatroom::ChatRoomSetMemberAttributeParameters::opt_
bool opt_
Definition: nim_chatroom_helper.h:736
nim_chatroom::RobotInfo::GetCreateTime
uint64_t GetCreateTime() const
Definition: nim_chatroom_helper.h:952
nim_chatroom::ChatRoomNotification::temp_mute_duration_
int64_t temp_mute_duration_
Definition: nim_chatroom_helper.h:292
nim_chatroom
聊天室
nim_chatroom::ChatRoomIndependentEnterInfo::sdk_log_level_
int sdk_log_level_
Definition: nim_chatroom_helper.h:133
nim_chatroom::RobotInfo::GetAccid
std::string GetAccid() const
Definition: nim_chatroom_helper.h:922
nim_chatroom::ChatRoomIndependentEnterInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:157
nim_chatroom::ChatRoomIndependentEnterInfo::login_ext_
std::string login_ext_
Definition: nim_chatroom_helper.h:143
nim_chatroom::ChatRoomNotification::operator_id_
std::string operator_id_
Definition: nim_chatroom_helper.h:288
nim_chatroom::ChatRoomGetMembersParameters::type_
NIMChatRoomGetMemberType type_
Definition: nim_chatroom_helper.h:630
nim_chatroom::ChatRoomInfo::id_
int64_t id_
Definition: nim_chatroom_helper.h:229
nim_chatroom::RobotInfo
机器人信息
Definition: nim_chatroom_helper.h:916
nim_chatroom::RobotInfo::GetRobotID
std::string GetRobotID() const
Definition: nim_chatroom_helper.h:946
nim_chatroom::ChatRoomMessageSetting::history_save_
bool history_save_
Definition: nim_chatroom_helper.h:457
nim_chatroom::ChatRoomIndependentEnterInfo::location_
NIMChatRoomLocation location_
Definition: nim_chatroom_helper.h:139
nim_chatroom::ChatRoomGetMsgHistoryParameters
获取聊天室消息历史参数
Definition: nim_chatroom_helper.h:677
nim_chatroom::ChatRoomMessage::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:611
nim_chatroom::ChatRoomMemberInfo::ChatRoomMemberInfo
ChatRoomMemberInfo()
Definition: nim_chatroom_helper.h:781
nim_chatroom::ChatRoomMemberInfo::guest_flag_
NIMChatRoomGuestFlag guest_flag_
Definition: nim_chatroom_helper.h:772
nim_chatroom::ChatRoomMemberInfo::is_muted_
bool is_muted_
Definition: nim_chatroom_helper.h:775
nim_chatroom::ChatRoomMessageSetting::location_
NIMChatRoomLocation location_
Definition: nim_chatroom_helper.h:465
nim_chatroom::ChatRoomMemberInfo::tags_
std::string tags_
Definition: nim_chatroom_helper.h:764
nim_chatroom::ChatRoomGetMsgHistoryParameters::msg_types_
std::vector< NIMChatRoomMsgType > msg_types_
Definition: nim_chatroom_helper.h:681
nim_chatroom::ChatRoomGetMembersByTagParameters::ChatRoomGetMembersByTagParameters
ChatRoomGetMembersByTagParameters()
Definition: nim_chatroom_helper.h:659
nim_chatroom::ChatRoomMessage::local_res_path_
std::string local_res_path_
Definition: nim_chatroom_helper.h:566
nim_chatroom::ChatRoomInfo::announcement_
std::string announcement_
Definition: nim_chatroom_helper.h:231
nim_chatroom::ChatRoomAnoymityEnterInfo::token_
std::string token_
Definition: nim_chatroom_helper.h:195
nim_chatroom::ChatRoomGetMembersByTagParameters
根据 tag 获取聊天室成员参数
Definition: nim_chatroom_helper.h:653
nim_chatroom::ChatRoomMessageSetting::to_accids
std::list< std::string > to_accids
Definition: nim_chatroom_helper.h:466
nim_chatroom::ChatRoomGetMsgHistoryParameters::ChatRoomGetMsgHistoryParameters
ChatRoomGetMsgHistoryParameters()
Definition: nim_chatroom_helper.h:683
nim_chatroom::ChatRoomMessageSetting
聊天室消息属性设置
Definition: nim_chatroom_helper.h:452
nim_chatroom::ChatRoomMessageSetting::anti_spam_enable_
bool anti_spam_enable_
Definition: nim_chatroom_helper.h:455
nim_chatroom::ChatRoomMessage::timetag_
int64_t timetag_
Definition: nim_chatroom_helper.h:543
nim_chatroom::ChatRoomIndependentEnterInfo::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:138
nim_chatroom::ChatRoomMessageSetting::ToJsonValue
void ToJsonValue(nim_cpp_wrapper_util::Json::Value &message) const
组装Json Value字符串
Definition: nim_chatroom_helper.h:484
nim_chatroom::ChatRoomEnterInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:124
nim_chatroom::ChatRoomMessage::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室消息
Definition: nim_chatroom_helper.h:582
nim_chatroom::ChatRoomMemberInfo::state_
NIMChatRoomOnlineState state_
Definition: nim_chatroom_helper.h:771
nim_chatroom::ChatRoomGetMembersParameters::timestamp_offset_
int64_t timestamp_offset_
Definition: nim_chatroom_helper.h:631
nim_chatroom::ChatRoomSetMemberAttributeParameters::attribute_
NIMChatRoomMemberAttribute attribute_
Definition: nim_chatroom_helper.h:735
nim_chatroom::ChatRoomMemberInfo::temp_muted_
bool temp_muted_
Definition: nim_chatroom_helper.h:778
nim_chatroom::ChatRoomIndependentEnterInfo::login_tags_
std::list< std::string > login_tags_
Definition: nim_chatroom_helper.h:137
nim_chatroom::ChatRoomEnterInfo::SetLoginExt
void SetLoginExt(const std::string &login_ext)
登录自定义字段
Definition: nim_chatroom_helper.h:111
nim_chatroom::ChatRoomMessageSetting::anti_spam_content_
std::string anti_spam_content_
Definition: nim_chatroom_helper.h:456
nim_chatroom::ChatRoomGetMsgHistoryParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:715
nim_chatroom::NIMChatRoomExitReasonInfo
聊天室退出时的信息
Definition: nim_chatroom_helper.h:879
nim_chatroom::ChatRoomInfo::queuelevel
int queuelevel
Definition: nim_chatroom_helper.h:238
nim_chatroom::ChatRoomMemberInfo::is_valid_
bool is_valid_
Definition: nim_chatroom_helper.h:776
nim_chatroom::ChatRoomNotification::target_tag_
std::string target_tag_
Definition: nim_chatroom_helper.h:299
nim_chatroom::ChatRoomNotification::operator_nick_
std::string operator_nick_
Definition: nim_chatroom_helper.h:289
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:230
nim_chatroom::ChatRoomMessageSetting::ParseMessageSetting
void ParseMessageSetting(const nim_cpp_wrapper_util::Json::Value &message)
从Json Value解析出消息属性设置
Definition: nim_chatroom_helper.h:512
nim_chatroom::ChatRoomBatchMembers::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:998
nim_chatroom::ChatRoomInfo::valid_flag_
int valid_flag_
Definition: nim_chatroom_helper.h:234
nim_chatroom::ChatRoomQueueElement
聊天室麦序队列元素
Definition: nim_chatroom_helper.h:862
nim_chatroom::ChatRoomQueueBatchChangedNotification::ParseFromNotification
void ParseFromNotification(const ChatRoomNotification &notification)
从聊天室通知中解析得到队列变更具体内容
Definition: nim_chatroom_helper.h:430
nim_chatroom::ChatRoomMemberInfo::account_id_
std::string account_id_
Definition: nim_chatroom_helper.h:763
nim_chatroom::ChatRoomMessage::msg_setting_
ChatRoomMessageSetting msg_setting_
Definition: nim_chatroom_helper.h:561
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:237
nim_chatroom::ChatRoomMemberInfo::nick_
std::string nick_
Definition: nim_chatroom_helper.h:767
nim_chatroom::ChatRoomMemberInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:839
nim_chatroom::ChatRoomInfo::ChatRoomInfo
ChatRoomInfo()
Definition: nim_chatroom_helper.h:240
nim_chatroom::ChatRoomNotification::ChatRoomNotification
ChatRoomNotification()
Definition: nim_chatroom_helper.h:306
nim_chatroom::RobotInfo::SetIcon
void SetIcon(const std::string &icon)
Definition: nim_chatroom_helper.h:931
nim_chatroom::ChatRoomGetMembersByTagParameters::limit_
int limit_
Definition: nim_chatroom_helper.h:656
nim_chatroom::ChatRoomUpdateTagsInfo::notify_target_tags_
std::string notify_target_tags_
Definition: nim_chatroom_helper.h:870
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:296
nim_chatroom::ChatRoomEnterInfo::EnableLocation
void EnableLocation(bool enable)
是否启用聊天室空间位置信息功能,启用后 SetLocation 功能才生效,否则 SDK 不解析 Location 信息
Definition: nim_chatroom_helper.h:97
nim_chatroom::ChatRoomGetMsgHistoryParameters::reverse_
bool reverse_
Definition: nim_chatroom_helper.h:680
nim_chatroom::ChatRoomAnoymityEnterInfo::app_key_
std::string app_key_
Definition: nim_chatroom_helper.h:192
nim_chatroom::ChatRoomMemberInfo::room_id_
int64_t room_id_
Definition: nim_chatroom_helper.h:762
nim_chatroom::ChatRoomNotification::msg_timetag_
uint64_t msg_timetag_
Definition: nim_chatroom_helper.h:303
nim_chatroom::ChatRoomMessage
聊天室消息
Definition: nim_chatroom_helper.h:539
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:295
nim_chatroom::ChatRoomMemberInfo::update_timetag_
int64_t update_timetag_
Definition: nim_chatroom_helper.h:777
nim_chatroom::NIMChatRoomExitReasonInfo::notify_ext_
std::string notify_ext_
Definition: nim_chatroom_helper.h:880
nim_chatroom::RobotInfo::GetName
std::string GetName() const
Definition: nim_chatroom_helper.h:928
nim_chatroom::RobotInfo::SetName
void SetName(const std::string &name)
Definition: nim_chatroom_helper.h:925
nim_chatroom::RobotInfo::GetIcon
std::string GetIcon() const
Definition: nim_chatroom_helper.h:934
nim_chatroom::ChatRoomMemberInfo::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &value)
Definition: nim_chatroom_helper.h:796
nim_chatroom::ChatRoomGetMembersByTagParameters::timestamp_offset_
int64_t timestamp_offset_
Definition: nim_chatroom_helper.h:655
nim_chatroom::ChatRoomMemberInfo::level_
int level_
Definition: nim_chatroom_helper.h:766
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:545
nim_chatroom::ChatRoomInfo::broadcast_url_
std::string broadcast_url_
Definition: nim_chatroom_helper.h:232
nim_chatroom::ChatRoomBatchMembers
聊天室批量更新成员
Definition: nim_chatroom_helper.h:985
nim_chatroom::ChatRoomQueueChangedNotification::type_
std::string type_
Definition: nim_chatroom_helper.h:398
nim_chatroom::ChatRoomAnoymityEnterInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:206
nim_chatroom::ChatRoomMessage::from_avatar_
std::string from_avatar_
Definition: nim_chatroom_helper.h:546
nim_chatroom::ChatRoomGetMembersByTagParameters::tag_
std::string tag_
Definition: nim_chatroom_helper.h:654
nim_chatroom::ChatRoomMessageSetting::env_config_
std::string env_config_
Definition: nim_chatroom_helper.h:463
nim_chatroom::ChatRoomMemberInfo::is_blacklist_
bool is_blacklist_
Definition: nim_chatroom_helper.h:774
nim_chatroom::ChatRoomIndependentEnterInfo::auth_type_
int auth_type_
Definition: nim_chatroom_helper.h:141
nim_chatroom::ChatRoomGetMembersParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:643
nim_chatroom::ChatRoomQueueElement::key_
std::string key_
Definition: nim_chatroom_helper.h:863
nim_chatroom::ChatRoomNotification::msg_id_
std::string msg_id_
Definition: nim_chatroom_helper.h:302
nim_chatroom::ChatRoomIndependentEnterInfo::token_
std::string token_
Definition: nim_chatroom_helper.h:136
nim_chatroom::ChatRoomMessage::client_msg_id_
std::string client_msg_id_
Definition: nim_chatroom_helper.h:559
nim_chatroom::ChatRoomMessageSetting::ext_
std::string ext_
Definition: nim_chatroom_helper.h:454
nim_chatroom::ChatRoomQueueBatchChangedNotification
通知麦序队列中有批量变更,发生在元素提交者离开聊天室或者从聊天室异常掉线时
Definition: nim_chatroom_helper.h:419
nim_chatroom::ChatRoomQueueBatchChangedNotification::type_
std::string type_
Definition: nim_chatroom_helper.h:420
nim_chatroom::ChatRoomInfo
聊天室信息
Definition: nim_chatroom_helper.h:228
nim_chatroom::ChatRoomNotification::id_
NIMChatRoomNotificationId id_
Definition: nim_chatroom_helper.h:286
nim_chatroom::ChatRoomGetMembersParameters::limit_
int limit_
Definition: nim_chatroom_helper.h:632
nim_chatroom::ChatRoomInfo::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:268
nim_chatroom::RobotInfo::SetAccid
void SetAccid(const std::string &accid)
Definition: nim_chatroom_helper.h:919
nim_chatroom::ChatRoomMemberInfo::type_
int type_
Definition: nim_chatroom_helper.h:765
nim_chatroom::ChatRoomBatchMembers::ChatRoomBatchMembers
ChatRoomBatchMembers()
Definition: nim_chatroom_helper.h:988
nim_chatroom::ParseChatRoomMemberInfos
NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMemberInfos(const std::string &infos_json_str, std::list< ChatRoomMemberInfo > &infos)
解析聊天室成员信息
nim_chatroom::ChatRoomEnterInfo::SetLocation
void SetLocation(NIMChatRoomLocation location)
登录聊天室时传递的位置信息
Definition: nim_chatroom_helper.h:85
nim_chatroom::ChatRoomNotification::muted_
bool muted_
Definition: nim_chatroom_helper.h:294
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:399
nim_chatroom::RobotInfo::SetIntro
void SetIntro(const std::string &intro)
Definition: nim_chatroom_helper.h:937
nim_chatroom::ChatRoomMessage::ChatRoomMessage
ChatRoomMessage()
Definition: nim_chatroom_helper.h:570
nim_chatroom::ChatRoomSetMemberAttributeParameters::account_id_
std::string account_id_
Definition: nim_chatroom_helper.h:734
nim_chatroom::ChatRoomQueueChangedNotification::value_
std::string value_
Definition: nim_chatroom_helper.h:400
nim_chatroom::ChatRoomSetMemberAttributeParameters::notify_ext_
std::string notify_ext_
Definition: nim_chatroom_helper.h:737
nim_chatroom::RobotInfo::SetRobotID
void SetRobotID(const std::string &id)
Definition: nim_chatroom_helper.h:943
nim_chatroom::ChatRoomSetMemberAttributeParameters
设置聊天室成员身份标识参数
Definition: nim_chatroom_helper.h:733
nim_chatroom::ChatRoomMemberInfo::ext_
std::string ext_
Definition: nim_chatroom_helper.h:769
nim_chatroom::ChatRoomAnoymityEnterInfo::sdk_log_level_
int sdk_log_level_
Definition: nim_chatroom_helper.h:191
nim_chatroom::RobotInfo::SetUpdateTime
void SetUpdateTime(const uint64_t time)
Definition: nim_chatroom_helper.h:955
nim_chatroom::ChatRoomMemberInfo::temp_muted_duration_
int64_t temp_muted_duration_
Definition: nim_chatroom_helper.h:779
nim_chatroom::ChatRoomNotification
聊天室通知
Definition: nim_chatroom_helper.h:285
nim_chatroom::ChatRoomMessage::local_res_id_
std::string local_res_id_
Definition: nim_chatroom_helper.h:567
nim_chatroom::ChatRoomMemberInfo
聊天室成员信息
Definition: nim_chatroom_helper.h:761
nim_chatroom::ChatRoomEnterInfo::SetNotifyExt
void SetNotifyExt(const nim_cpp_wrapper_util::Json::Value &notify_ext)
设置进入聊天室通知开发者扩展字段,选填
Definition: nim_chatroom_helper.h:58
nim_chatroom::ChatRoomQueueOfferOption::transient_
bool transient_
Definition: nim_chatroom_helper.h:382
nim_chatroom::ChatRoomMessageSetting::anti_spam_using_yidun_
int anti_spam_using_yidun_
Definition: nim_chatroom_helper.h:459
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:291
nim_chatroom::ChatRoomGetMembersParameters
获取聊天室成员参数
Definition: nim_chatroom_helper.h:629
nim_chatroom::ChatRoomMessage::third_party_callback_ext_
std::string third_party_callback_ext_
Definition: nim_chatroom_helper.h:549
nim_chatroom::ChatRoomGetMsgHistoryParameters::limit_
int limit_
Definition: nim_chatroom_helper.h:679
nim_chatroom::ChatRoomUpdateTagsInfo
聊天室更新标签
Definition: nim_chatroom_helper.h:868
nim_chatroom::ChatRoomQueueBatchChangedNotification::value_
std::string value_
Definition: nim_chatroom_helper.h:422
nim_chatroom::ChatRoomMessage::msg_body_
std::string msg_body_
Definition: nim_chatroom_helper.h:560
nim_chatroom::ChatRoomQueueBatchChangedNotification::key_
std::string key_
Definition: nim_chatroom_helper.h:421
nim_chatroom::ChatRoomMessage::msg_type_
NIMChatRoomMsgType msg_type_
Definition: nim_chatroom_helper.h:557
nim_chatroom::ChatRoomQueueOfferOption
聊天室麦序添加、更新选项
Definition: nim_chatroom_helper.h:380
nim_chatroom::ChatRoomAnoymityEnterInfo::address_
std::list< std::string > address_
Definition: nim_chatroom_helper.h:186
nim_chatroom::ChatRoomAnoymityEnterInfo::accid_
std::string accid_
Definition: nim_chatroom_helper.h:194
nim_chatroom::ChatRoomNotification::ext_
std::string ext_
Definition: nim_chatroom_helper.h:287
nim_chatroom::ChatRoomQueueChangedNotification::ParseFromNotification
void ParseFromNotification(const ChatRoomNotification &notification)
从聊天室通知中解析得到队列变更具体内容
Definition: nim_chatroom_helper.h:407
nim_chatroom::ChatRoomMessage::from_client_type_
NIMChatRoomClientType from_client_type_
Definition: nim_chatroom_helper.h:544
nim_chatroom::ChatRoomQueue
std::list< ChatRoomQueueElement > ChatRoomQueue
聊天室麦序队列
Definition: nim_chatroom_helper.h:876
nim_chatroom::ChatRoomIndependentEnterInfo::anti_spam_business_id_
std::string anti_spam_business_id_
Definition: nim_chatroom_helper.h:144
nim_chatroom::ChatRoomUpdateTagsInfo::tags_
std::list< std::string > tags_
Definition: nim_chatroom_helper.h:869
nim_chatroom::ChatRoomInfo::ext_
std::string ext_
Definition: nim_chatroom_helper.h:235
nim_chatroom::ChatRoomMessageSetting::yidun_anti_cheating_
std::string yidun_anti_cheating_
Definition: nim_chatroom_helper.h:462
nim_chatroom::ChatRoomInfo::creator_id_
std::string creator_id_
Definition: nim_chatroom_helper.h:233
nim_chatroom::ChatRoomMessage::msg_attach_
std::string msg_attach_
Definition: nim_chatroom_helper.h:558
nim_chatroom::ChatRoomQueueOfferOption::element_accid_
std::string element_accid_
Definition: nim_chatroom_helper.h:383
nim_chatroom::RobotInfo::SetCreateTime
void SetCreateTime(const uint64_t time)
Definition: nim_chatroom_helper.h:949
nim_chatroom::ChatRoomMemberInfo::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:770
nim_chatroom::ChatRoomMessage::sub_type_
int32_t sub_type_
Definition: nim_chatroom_helper.h:563
nim_chatroom::ChatRoomMessageSetting::resend_flag_
bool resend_flag_
Definition: nim_chatroom_helper.h:453
nim_chatroom::ChatRoomMessageSetting::high_priority_
int high_priority_
Definition: nim_chatroom_helper.h:461
nim_chatroom::ChatRoomIndependentEnterInfo::accid_
std::string accid_
Definition: nim_chatroom_helper.h:135
nim_chatroom::ChatRoomMessage::notify_tags_
std::string notify_tags_
Definition: nim_chatroom_helper.h:552
nim_chatroom::ChatRoomInfo::online_count_
int online_count_
Definition: nim_chatroom_helper.h:236
nim_chatroom::ChatRoomNotification::target_nick_
std::list< std::string > target_nick_
Definition: nim_chatroom_helper.h:290
nim_chatroom::ChatRoomInfo::ParseFromJsonValue
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室信息
Definition: nim_chatroom_helper.h:251
nim_chatroom::ChatRoomMessageSetting::anti_spam_bizid_
std::string anti_spam_bizid_
Definition: nim_chatroom_helper.h:458
nim_chatroom::ChatRoomIndependentEnterInfo
Definition: nim_chatroom_helper.h:130
nim_chatroom::ChatRoomAnoymityEnterInfo
Definition: nim_chatroom_helper.h:185
nim_chatroom::RobotInfo::GetIntro
std::string GetIntro() const
Definition: nim_chatroom_helper.h:940
nim_chatroom::ChatRoomMessage::from_id_
std::string from_id_
Definition: nim_chatroom_helper.h:542
nim_chatroom::ChatRoomUpdateTagsInfo::ext_
std::string ext_
Definition: nim_chatroom_helper.h:872
nim_chatroom::ChatRoomMessage::anti_spam_res_
std::string anti_spam_res_
Definition: nim_chatroom_helper.h:554
nim_chatroom::ChatRoomQueueBatchChangedNotification::changed_values_
std::map< std::string, std::string > changed_values_
Definition: nim_chatroom_helper.h:423
nim_chatroom::ChatRoomMessage::from_ext_
std::string from_ext_
Definition: nim_chatroom_helper.h:547
nim_chatroom::ChatRoomGetMembersParameters::ChatRoomGetMembersParameters
ChatRoomGetMembersParameters()
Definition: nim_chatroom_helper.h:635
nim_chatroom::ChatRoomIndependentEnterInfo::app_key_
std::string app_key_
Definition: nim_chatroom_helper.h:134
nim_chatroom::ChatRoomEnterInfo::SetAuthType
void SetAuthType(int auth_type)
设置鉴权方式
Definition: nim_chatroom_helper.h:104
nim_chatroom::RobotInfo::GetUpdateTime
uint64_t GetUpdateTime() const
Definition: nim_chatroom_helper.h:958
nim_chatroom::ChatRoomMemberInfo::avatar_
std::string avatar_
Definition: nim_chatroom_helper.h:768
nim_chatroom::ChatRoomSetMemberAttributeParameters::ToJsonString
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:747