NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_chatroom_helper.h
浏览该文件的文档.
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
23
28namespace nim_chatroom {
29
37 void SetNick(const std::string& nick) { values_[kNIMChatRoomEnterKeyNick] = nick; }
38
44 void SetAvatar(const std::string& avatar) { values_[kNIMChatRoomEnterKeyAvatar] = avatar; }
45
52
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
86 values_[kNIMChatRoomEnterLocationX] = location.x_;
87 values_[kNIMChatRoomEnterLocationY] = location.y_;
88 values_[kNIMChatRoomEnterLocationZ] = location.z_;
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
126public:
128};
129
133 std::list<std::string> address_;
135 std::string app_data_file_;
139 std::string app_key_;
141 std::string accid_;
143 std::string token_;
145 std::list<std::string> login_tags_;
147 std::string notify_tags_;
155 std::string login_ext_;
158
160 sdk_log_level_ = 5;
161 location_ = {0};
162 enable_location_ = false;
163 auth_type_ = 0;
164 }
165
170 std::string ToJsonString() const {
172 std::string addr_str;
173 for (auto& address : address_) {
174 values[kNIMChatRoomEnterKeyAddress].append(address);
175 }
176 std::string login_tags;
177 nim::StrListToJsonString(login_tags_, login_tags);
178 values[kNIMChatRoomEnterLoginTags] = login_tags;
179 values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
180 values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
181 values[kNIMChatRoomEnterKeyAppKey] = app_key_;
182 values[kNIMChatRoomEnterKeyAccID] = accid_;
183 values[kNIMChatRoomEnterKeyToken] = token_;
184 values[kNIMChatRoomEnterNotifyTags] = notify_tags_;
185 values[kNIMChatRoomEnterLocationX] = location_.x_;
186 values[kNIMChatRoomEnterLocationY] = location_.y_;
187 values[kNIMChatRoomEnterLocationZ] = location_.z_;
189 values[kNIMChatRoomEnterEnableLocation] = enable_location_;
190 values[kNIMChatRoomEnterAuthType] = auth_type_;
191 values[kNIMChatRoomEnterLoginExt] = login_ext_;
192 values[kNIMChatRoomEnterAntiSpamBusinessID] = anti_spam_business_id_;
193 return nim::GetJsonStringWithNoStyled(values);
194 }
195
202 std::string addr_str;
204 for (auto& address : address_) {
205 values[kNIMChatRoomEnterKeyAddress].append(address);
206 }
207 std::string login_tags;
208 nim::StrListToJsonString(login_tags_, login_tags);
209 values[kNIMChatRoomEnterLoginTags] = login_tags;
210 values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
211 values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
212 values[kNIMChatRoomEnterKeyAppKey] = app_key_;
213 values[kNIMChatRoomEnterKeyAccID] = accid_;
214 values[kNIMChatRoomEnterKeyToken] = token_;
215 values[kNIMChatRoomEnterNotifyTags] = notify_tags_;
216 values[kNIMChatRoomEnterLocationX] = location_.x_;
217 values[kNIMChatRoomEnterLocationY] = location_.y_;
218 values[kNIMChatRoomEnterLocationZ] = location_.z_;
220 values[kNIMChatRoomEnterEnableLocation] = enable_location_;
221 values[kNIMChatRoomEnterAuthType] = auth_type_;
222 values[kNIMChatRoomEnterLoginExt] = login_ext_;
223 values[kNIMChatRoomEnterAntiSpamBusinessID] = anti_spam_business_id_;
224 return values;
225 }
226
228 nim::JsonArrayStringToList(values[kNIMChatRoomEnterLoginTags].asString(), login_tags_);
229 app_data_file_ = values[kNIMChatRoomEnterKeyAppDataPath].asString();
230 sdk_log_level_ = values[kNIMChatRoomEnterKeyLogLevel].asInt();
231 app_key_ = values[kNIMChatRoomEnterKeyAppKey].asString();
232 accid_ = values[kNIMChatRoomEnterKeyAccID].asString();
233 token_ = values[kNIMChatRoomEnterKeyToken].asString();
234 notify_tags_ = values[kNIMChatRoomEnterNotifyTags].asString();
235 location_.x_ = values[kNIMChatRoomEnterLocationX].asFloat();
236 location_.y_ = values[kNIMChatRoomEnterLocationY].asFloat();
237 location_.z_ = values[kNIMChatRoomEnterLocationZ].asFloat();
239 enable_location_ = values[kNIMChatRoomEnterEnableLocation].asBool();
240 auth_type_ = values[kNIMChatRoomEnterAuthType].asInt();
241 login_ext_ = values[kNIMChatRoomEnterLoginExt].asString();
242 anti_spam_business_id_ = values[kNIMChatRoomEnterAntiSpamBusinessID].asString();
243 for (auto index = values[kNIMChatRoomEnterKeyAddress].begin(); index != values[kNIMChatRoomEnterKeyAddress].end(); index++) {
244 address_.push_back(index->asString());
245 }
246 }
247};
248
252 std::list<std::string> address_;
254 std::string app_data_file_;
258 std::string app_key_;
262 std::string accid_;
264 std::string token_;
265
267 sdk_log_level_ = 5;
268 random_id_ = false;
269 }
270
275 std::string ToJsonString() const {
277 std::string addr_str;
278 for (auto& address : address_) {
279 values[kNIMChatRoomEnterKeyAddress].append(address);
280 }
281 values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
282 values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
283 values[kNIMChatRoomEnterKeyAppKey] = app_key_;
284 values[kNIMChatRoomEnterKeyRandomID] = random_id_ ? 1 : 0;
285 values[kNIMChatRoomEnterKeyAccID] = accid_;
286 values[kNIMChatRoomEnterKeyToken] = token_;
287 return nim::GetJsonStringWithNoStyled(values);
288 }
295 std::string addr_str;
297 for (auto& address : address_) {
298 values[kNIMChatRoomEnterKeyAddress].append(address);
299 }
300 values[kNIMChatRoomEnterKeyAppDataPath] = app_data_file_;
301 values[kNIMChatRoomEnterKeyLogLevel] = sdk_log_level_;
302 values[kNIMChatRoomEnterKeyAppKey] = app_key_;
303 values[kNIMChatRoomEnterKeyRandomID] = random_id_ ? 1 : 0;
304 values[kNIMChatRoomEnterKeyAccID] = accid_;
305 values[kNIMChatRoomEnterKeyToken] = token_;
306 return values;
307 }
315 address_.clear();
316 for (auto iter = values[kNIMChatRoomEnterKeyAddress].begin(); iter != values[kNIMChatRoomEnterKeyAddress].end(); ++iter) {
317 address_.push_back(iter->asString());
318 }
319 }
321 app_data_file_ = values[kNIMChatRoomEnterKeyAppDataPath].asString();
323 sdk_log_level_ = values[kNIMChatRoomEnterKeyLogLevel].asInt();
325 app_key_ = values[kNIMChatRoomEnterKeyAppKey].asString();
327 random_id_ = values[kNIMChatRoomEnterKeyRandomID].asInt() == 1;
329 accid_ = values[kNIMChatRoomEnterKeyAccID].asString();
331 token_ = values[kNIMChatRoomEnterKeyToken].asString();
332 }
333};
334
338 int64_t id_;
340 std::string name_;
342 std::string announcement_;
344 std::string broadcast_url_;
346 std::string creator_id_;
348 int valid_flag_{0};
350 std::string ext_;
352 int online_count_{0};
354 int mute_all_{0};
356 int queuelevel{0};
359 : id_(0)
360 , valid_flag_(0)
361 , mute_all_(0)
362 , queuelevel(1) {}
363
370 id_ = values[kNIMChatRoomInfoKeyID].asUInt64();
371 name_ = values[kNIMChatRoomInfoKeyName].asString();
372 announcement_ = values[kNIMChatRoomInfoKeyAnnouncement].asString();
373 broadcast_url_ = values[kNIMChatRoomInfoKeyBroadcastUrl].asString();
374 creator_id_ = values[kNIMChatRoomInfoKeyCreatorID].asString();
375 valid_flag_ = values[kNIMChatRoomInfoKeyValidFlag].asUInt();
376 ext_ = values[kNIMChatRoomInfoKeyExt].asString();
377 online_count_ = values[kNIMChatRoomInfoKeyOnlineCount].asUInt();
378 mute_all_ = values[kNIMChatRoomInfoKeyMuteAll].asUInt();
379 queuelevel = values[kNIMChatRoomInfoKeyQueuelevel].asInt();
380 }
381
386 std::string ToJsonString() const {
388 values[kNIMChatRoomInfoKeyID] = id_;
389 values[kNIMChatRoomInfoKeyName] = name_;
390 values[kNIMChatRoomInfoKeyAnnouncement] = announcement_;
391 values[kNIMChatRoomInfoKeyBroadcastUrl] = broadcast_url_;
392 values[kNIMChatRoomInfoKeyCreatorID] = creator_id_;
393 values[kNIMChatRoomInfoKeyValidFlag] = valid_flag_;
394 values[kNIMChatRoomInfoKeyExt] = ext_;
395 values[kNIMChatRoomInfoKeyOnlineCount] = online_count_;
396 values[kNIMChatRoomInfoKeyMuteAll] = mute_all_;
397 values[kNIMChatRoomInfoKeyQueuelevel] = queuelevel;
398 return nim::GetJsonStringWithNoStyled(values);
399 }
400
407 values[kNIMChatRoomInfoKeyID] = id_;
408 values[kNIMChatRoomInfoKeyName] = name_;
409 values[kNIMChatRoomInfoKeyAnnouncement] = announcement_;
410 values[kNIMChatRoomInfoKeyBroadcastUrl] = broadcast_url_;
411 values[kNIMChatRoomInfoKeyCreatorID] = creator_id_;
412 values[kNIMChatRoomInfoKeyValidFlag] = valid_flag_;
413 values[kNIMChatRoomInfoKeyExt] = ext_;
414 values[kNIMChatRoomInfoKeyOnlineCount] = online_count_;
415 values[kNIMChatRoomInfoKeyMuteAll] = mute_all_;
416 values[kNIMChatRoomInfoKeyQueuelevel] = queuelevel;
417 return values;
418 }
419};
420
426 std::string ext_;
428 std::string operator_id_;
430 std::string operator_nick_;
432 std::list<std::string> target_nick_;
434 std::list<std::string> target_ids_;
440 bool muted_;
444 std::string queue_change_;
447 std::string target_tag_;
450 std::string msg_id_;
452 uint64_t msg_timetag_{0};
453
456 : temp_mute_duration_(0)
457 , muted_(false)
458 , temp_muted_(false)
459 , msg_timetag_(0) {}
460
475 temp_muted_ = (temp_mute_duration_ != 0);
476 }
483 }
487 }
491 }
494 }
495 temp_muted_ = (temp_mute_duration_ != 0);
496 }
500 }
503 }
504 }
508 target_tag_ =
510 }
511 }
512 }
513 }
514
515 std::string ToJsonString() const {
517 values[kNIMChatRoomInfoKeyID] = id_;
518 values[kChatRoomNotificationDataKeyExt] = ext_;
519 values[kChatRoomNotificationDataKeyOpt] = operator_id_;
520 values[kChatRoomNotificationDataKeyOptNick] = operator_nick_;
521 for (const auto& nick : target_nick_) {
523 }
524 for (const auto& id : target_ids_) {
526 }
527 values[kChatRoomNotificationDataKeyTempMuteDuration] = temp_mute_duration_;
529 values[kChatRoomNotificationDataKeyTempMutedFlag] = temp_muted_;
530 values[kChatRoomNotificationDataKeyQueueChange] = queue_change_;
531 if (!target_tag_.empty())
532 values[kChatRoomNotificationDataKeyTargetTag] = target_tag_;
533 if (!msg_id_.empty()) {
534 values[kChatRoomNotificationDataKeyMsgTimetag] = msg_timetag_;
535 values[kChatRoomNotificationDataKeyMsgId] = msg_id_;
536 }
537
538 return nim::GetJsonStringWithNoStyled(values);
539 }
540
547 values[kNIMChatRoomInfoKeyID] = id_;
548 values[kChatRoomNotificationDataKeyExt] = ext_;
549 values[kChatRoomNotificationDataKeyOpt] = operator_id_;
550 values[kChatRoomNotificationDataKeyOptNick] = operator_nick_;
551 for (const auto& nick : target_nick_) {
553 }
554 for (const auto& id : target_ids_) {
556 }
557 values[kChatRoomNotificationDataKeyTempMuteDuration] = temp_mute_duration_;
559 values[kChatRoomNotificationDataKeyTempMutedFlag] = temp_muted_;
560 values[kChatRoomNotificationDataKeyQueueChange] = queue_change_;
561 if (!target_tag_.empty())
562 values[kChatRoomNotificationDataKeyTargetTag] = target_tag_;
563 if (!msg_id_.empty()) {
564 values[kChatRoomNotificationDataKeyMsgTimetag] = msg_timetag_;
565 values[kChatRoomNotificationDataKeyMsgId] = msg_id_;
566 }
567 return values;
568 }
569};
570
573public:
577 std::string element_accid_;
579 : transient_(false) {}
580 std::string ToJsonString() const {
582 values[kNIMChatRoomQueueOfferOptionTransient] = transient_;
583 if (!element_accid_.empty())
584 values[kNIMChatRoomQueueOfferOptionElementAccId] = element_accid_;
585 return nim::GetJsonStringWithNoStyled(values);
586 }
587};
588
592 std::string type_;
594 std::string key_;
596 std::string value_;
597
603 void ParseFromNotification(const ChatRoomNotification& notification) {
605 if (nim::ParseJsonValue(notification.queue_change_, values) && values.isObject()) {
609 }
610 }
611};
612
616 std::string type_;
618 std::string key_;
620 std::string value_;
622 std::map<std::string, std::string> changed_values_;
623
629 void ParseFromNotification(const ChatRoomNotification& notification) {
631 if (nim::ParseJsonValue(notification.queue_change_, values) && values.isObject()) {
639 auto it = members_name.begin();
640 while (it != members_name.end()) {
641 changed_values_.insert(std::make_pair(*it, values[kNIMChatRoomNotificationQueueBatchChangedKeyObject][*it].asString()));
642 it++;
643 }
644 }
645 }
646 }
647};
648
654 std::string ext_;
662 std::string anti_spam_bizid_;
670 std::string env_config_;
672 std::string anti_spam_ext_;
676 std::list<std::string> to_accids;
679 : resend_flag_(false)
680 , anti_spam_enable_(false)
681 , history_save_(true)
682 , anti_spam_bizid_("")
683 , anti_spam_using_yidun_(1)
684 , high_priority_(0)
685 , yidun_anti_cheating_("")
686 , anti_spam_ext_("")
687 , location_({0}) {}
688
695 message[kNIMChatRoomMsgKeyResendFlag] = resend_flag_ ? 1 : 0;
696 message[kNIMChatRoomMsgKeyExt] = ext_;
697 message[kNIMChatRoomMsgKeyAntiSpamEnable] = anti_spam_enable_ ? 1 : 0;
698 message[kNIMChatRoomMsgKeyAntiSpamContent] = anti_spam_content_;
699 message[kNIMChatRoomMsgKeyAntiSpamBizId] = anti_spam_bizid_;
700 message[kNIMChatRoomMsgKeyHistorySave] = history_save_ ? 1 : 0;
701 message[kNIMChatRoomMsgKeyAntiSpamUsingYiDun] = anti_spam_using_yidun_;
702 message[kNIMChatRoomMsgKeyYiDunAntiCheating] = yidun_anti_cheating_;
703 message[kNIMChatRoomMsgKeyEnvConfig] = env_config_;
704 message[kNIMChatRoomMsgKeyAntiSpamExt] = anti_spam_ext_;
705 message[kNIMChatRoomMsgKeyLocationX] = location_.x_;
706 message[kNIMChatRoomMsgKeyLocationY] = location_.y_;
707 message[kNIMChatRoomMsgKeyLocationZ] = location_.z_;
708 std::string to_accids_str;
709 nim::StrListToJsonString(to_accids, to_accids_str);
710 message[kNIMChatRoomMsgKeyToAccids] = to_accids_str;
711 }
712
719 resend_flag_ = message[kNIMChatRoomMsgKeyResendFlag].asUInt() == 1;
720 ext_ = message[kNIMChatRoomMsgKeyExt].asString();
722 anti_spam_enable_ = message[kNIMChatRoomMsgKeyAntiSpamEnable].asInt() == 1;
723 anti_spam_content_ = message[kNIMChatRoomMsgKeyAntiSpamContent].asString();
724 high_priority_ = message[kNIMChatRoomMsgKeyHighPriorityFlag].asInt();
726 yidun_anti_cheating_ = message[kNIMChatRoomMsgKeyYiDunAntiCheating].asString();
728 env_config_ = message[kNIMChatRoomMsgKeyEnvConfig].asString();
730 anti_spam_ext_ = message[kNIMChatRoomMsgKeyAntiSpamExt].asString();
732 location_.x_ = message[kNIMChatRoomMsgKeyLocationX].asFloat();
734 location_.y_ = message[kNIMChatRoomMsgKeyLocationY].asFloat();
736 location_.z_ = message[kNIMChatRoomMsgKeyLocationZ].asFloat();
738 to_accids.clear();
740 }
741 }
742};
743
746public:
748 int64_t room_id_;
750 std::string from_id_;
752 int64_t timetag_;
756 std::string from_nick_;
758 std::string from_avatar_;
760 std::string from_ext_;
761 // v7.8 <--
764 // --> v7.8
765 // v8.4.0 <--
767 std::string notify_tags_;
768 // --> v8.4.0
770 std::string anti_spam_res_;
771
772public:
776 std::string msg_attach_;
778 std::string client_msg_id_;
780 std::string msg_body_;
783 // v7.8 <--
785 int32_t sub_type_;
786 // --> v7.8
787public:
789 std::string local_res_path_;
791 std::string local_res_id_;
792
795 : room_id_(0)
796 , from_client_type_(kNIMChatRoomClientTypeDefault)
797 , timetag_(0)
798 , third_party_callback_ext_("")
799 , sub_type_(0) {}
800
807 room_id_ = values[kNIMChatRoomMsgKeyRoomID].asInt64();
808 from_id_ = values[kNIMChatRoomMsgKeyFromAccount].asString();
809 timetag_ = values[kNIMChatRoomMsgKeyTime].asUInt64();
810 from_client_type_ = (NIMChatRoomClientType)values[kNIMChatRoomMsgKeyFromClientType].asUInt();
811 from_nick_ = values[kNIMChatRoomMsgKeyFromNick].asString();
812 from_avatar_ = values[kNIMChatRoomMsgKeyFromAvatar].asString();
813 from_ext_ = values[kNIMChatRoomMsgKeyFromExt].asString();
814 msg_type_ = (NIMChatRoomMsgType)values[kNIMChatRoomMsgKeyType].asUInt();
815 msg_attach_ = values[kNIMChatRoomMsgKeyAttach].asString();
816 client_msg_id_ = values[kNIMChatRoomMsgKeyClientMsgid].asString();
817 local_res_path_ = values[kNIMChatRoomMsgKeyLocalFilePath].asString();
818 local_res_id_ = values[kNIMChatRoomMsgKeyLocalResId].asString();
819 msg_body_ = values[kNIMChatRoomMsgKeyBody].asString();
820 msg_setting_.ParseMessageSetting(values);
822 third_party_callback_ext_ = values[kNIMChatRoomMsgKeyThirdPartyCBEXT].asString();
824 sub_type_ = values[kNIMChatRoomMsgKeySubType].asInt();
826 notify_tags_ = values[kNIMChatRoomMsgKeyNotifyTags].asString();
828 anti_spam_res_ = values[kNIMChatRoomMsgKeyAntiSpamRes].asString();
829 }
830
835 std::string ToJsonString() const {
837 values[kNIMChatRoomMsgKeyRoomID] = room_id_;
838 values[kNIMChatRoomMsgKeyFromAccount] = from_id_;
839 values[kNIMChatRoomMsgKeyTime] = timetag_;
840 values[kNIMChatRoomMsgKeyFromClientType] = from_client_type_;
841 values[kNIMChatRoomMsgKeyFromNick] = from_nick_;
842 values[kNIMChatRoomMsgKeyFromAvatar] = from_avatar_;
843 values[kNIMChatRoomMsgKeyFromExt] = from_ext_;
844 values[kNIMChatRoomMsgKeyType] = msg_type_;
845 values[kNIMChatRoomMsgKeyAttach] = msg_attach_;
846 values[kNIMChatRoomMsgKeyClientMsgid] = client_msg_id_;
847 values[kNIMChatRoomMsgKeyLocalFilePath] = local_res_path_;
848 values[kNIMChatRoomMsgKeyLocalResId] = local_res_id_;
849 values[kNIMChatRoomMsgKeyBody] = msg_body_;
850 values[kNIMChatRoomMsgKeyThirdPartyCBEXT] = third_party_callback_ext_;
851 values[kNIMChatRoomMsgKeySubType] = sub_type_;
852 values[kNIMChatRoomMsgKeyAntiSpamRes] = anti_spam_res_;
853 values[kNIMChatRoomMsgKeyNotifyTags] = notify_tags_;
854 msg_setting_.ToJsonValue(values);
855 return nim::GetJsonStringWithNoStyled(values);
856 }
857
864 values[kNIMChatRoomMsgKeyRoomID] = room_id_;
865 values[kNIMChatRoomMsgKeyFromAccount] = from_id_;
866 values[kNIMChatRoomMsgKeyTime] = timetag_;
867 values[kNIMChatRoomMsgKeyFromClientType] = from_client_type_;
868 values[kNIMChatRoomMsgKeyFromNick] = from_nick_;
869 values[kNIMChatRoomMsgKeyFromAvatar] = from_avatar_;
870 values[kNIMChatRoomMsgKeyFromExt] = from_ext_;
871 values[kNIMChatRoomMsgKeyType] = msg_type_;
872 values[kNIMChatRoomMsgKeyAttach] = msg_attach_;
873 values[kNIMChatRoomMsgKeyClientMsgid] = client_msg_id_;
874 values[kNIMChatRoomMsgKeyLocalFilePath] = local_res_path_;
875 values[kNIMChatRoomMsgKeyLocalResId] = local_res_id_;
876 values[kNIMChatRoomMsgKeyBody] = msg_body_;
877 values[kNIMChatRoomMsgKeyThirdPartyCBEXT] = third_party_callback_ext_;
878 values[kNIMChatRoomMsgKeySubType] = sub_type_;
879 values[kNIMChatRoomMsgKeyAntiSpamRes] = anti_spam_res_;
880 values[kNIMChatRoomMsgKeyNotifyTags] = notify_tags_;
881 msg_setting_.ToJsonValue(values);
882 return values;
883 }
884};
885
894
897 : timestamp_offset_(0)
898 , limit_(0) {}
899
904 std::string ToJsonString() const {
906 values[kNIMChatRoomGetMembersKeyType] = type_;
907 values[kNIMChatRoomGetMembersKeyOffset] = timestamp_offset_;
908 values[kNIMChatRoomGetMembersKeyLimit] = limit_;
909 return nim::GetJsonStringWithNoStyled(values);
910 }
911};
912
916 std::string tag_;
921
924 : timestamp_offset_(0)
925 , limit_(0) {}
926
931 std::string ToJsonString() const {
933 values[kNIMChatRoomGetMembersKeyTag] = tag_;
934 values[kNIMChatRoomGetMembersKeyOffset] = timestamp_offset_;
935 values[kNIMChatRoomGetMembersKeyLimit] = limit_;
936 return nim::GetJsonStringWithNoStyled(values);
937 }
938};
939
949 std::vector<NIMChatRoomMsgType> msg_types_;
952 : start_timetag_(0)
953 , limit_(0)
954 , reverse_(false) {
955 if (kMsg_Types_List.empty()) {
956 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeText);
957 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeImage);
958 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeAudio);
959 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeVideo);
960 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeLocation);
961 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeNotification);
962 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeFile);
963 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeRobot);
964 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeTips);
965 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeCustom);
966 }
967 msg_types_.assign(kMsg_Types_List.begin(), kMsg_Types_List.end());
968 }
969 // 考虑到兼容以前版本,只提供删除类型接口,如果所有类型都被删除,会添加Unknown类型以区别之前的版本
971 auto it = std::find_if(msg_types_.begin(), msg_types_.end(), [&](const NIMChatRoomMsgType& item) {
972 return item == type;
973 });
974 if (it != msg_types_.end())
975 msg_types_.erase(it);
976 if (msg_types_.empty())
977 msg_types_.emplace_back(kNIMChatRoomMsgTypeUnknown);
978 }
983 std::string ToJsonString() const {
985 values[kNIMChatRoomGetMsgHistoryKeyStartTime] = start_timetag_;
986 values[kNIMChatRoomGetMsgHistoryKeyLimit] = limit_;
987 values[kNIMChatRoomGetMsgHistoryKeyReverse] = reverse_;
988 auto it = msg_types_.begin();
989 while (it != msg_types_.end()) {
991 it++;
992 }
993 return nim::GetJsonStringWithNoStyled(values);
994 }
995
996private:
997 static std::vector<NIMChatRoomMsgType> kMsg_Types_List;
998};
999
1001 std::list<std::string> tags_;
1011 std::vector<NIMChatRoomMsgType> msg_types_;
1014 : start_timetag_(0)
1015 , end_timetag_(0)
1016 , limit_(0)
1017 , reverse_(false) {
1018 if (kMsg_Types_List.empty()) {
1019 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeText);
1020 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeImage);
1021 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeAudio);
1022 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeVideo);
1023 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeLocation);
1024 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeNotification);
1025 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeFile);
1026 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeRobot);
1027 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeTips);
1028 kMsg_Types_List.emplace_back(kNIMChatRoomMsgTypeCustom);
1029 }
1030 msg_types_.assign(kMsg_Types_List.begin(), kMsg_Types_List.end());
1031 }
1032 // 考虑到兼容以前版本,只提供删除类型接口,如果所有类型都被删除,会添加Unknown类型以区别之前的版本
1034 auto it = std::find_if(msg_types_.begin(), msg_types_.end(), [&](const NIMChatRoomMsgType& item) {
1035 return item == type;
1036 });
1037 if (it != msg_types_.end())
1038 msg_types_.erase(it);
1039 if (msg_types_.empty())
1040 msg_types_.emplace_back(kNIMChatRoomMsgTypeUnknown);
1041 }
1046 std::string ToJsonString() const {
1050 for (auto& tag : tags_)
1051 tags_value.append(tag);
1052 values[kNIMChatRoomGetMsgHistoryKeyTags] = writer.write(tags_value);
1053 values[kNIMChatRoomGetMsgHistoryKeyStartTime] = start_timetag_;
1054 values[kNIMChatRoomGetMsgHistoryKeyEndTime] = end_timetag_;
1055 values[kNIMChatRoomGetMsgHistoryKeyLimit] = limit_;
1056 values[kNIMChatRoomGetMsgHistoryKeyReverse] = reverse_;
1057 auto it = msg_types_.begin();
1058 while (it != msg_types_.end()) {
1060 it++;
1061 }
1062 return nim::GetJsonStringWithNoStyled(values);
1063 }
1064
1065private:
1066 static std::vector<NIMChatRoomMsgType> kMsg_Types_List;
1067};
1068
1072 std::string account_id_;
1076 bool opt_;
1078 std::string notify_ext_;
1079
1082 : level_(0) {}
1083
1088 std::string ToJsonString() const {
1090 values[kNIMChatRoomSetMemberAttributeKeyAccoutID] = account_id_;
1091 values[kNIMChatRoomSetMemberAttributeKeyAttribute] = attribute_;
1093 values[kNIMChatRoomSetMemberAttributeKeyNotifyExt] = notify_ext_;
1094 return nim::GetJsonStringWithNoStyled(values);
1095 }
1096
1097private:
1100};
1101
1105 int64_t room_id_;
1107 std::string account_id_;
1109 std::string tags_;
1115 std::string nick_;
1117 std::string avatar_;
1119 std::string ext_;
1121 std::string notify_tags_;
1142 : room_id_(0)
1143 , type_(-2)
1144 , level_(0)
1146 , guest_flag_(kNIMChatRoomGuestFlagGuest)
1147 , enter_timetag_(0)
1148 , is_blacklist_(false)
1149 , is_muted_(false)
1150 , is_valid_(false)
1151 , update_timetag_(0)
1152 , temp_muted_(false)
1153 , temp_muted_duration_(0) {}
1154
1158 room_id_ = value[kNIMChatRoomMemberInfoKeyRoomID].asUInt64();
1160 account_id_ = value[kNIMChatRoomMemberInfoKeyAccID].asString();
1162 type_ = value[kNIMChatRoomMemberInfoKeyType].asInt();
1164 level_ = value[kNIMChatRoomMemberInfoKeyLevel].asInt();
1166 nick_ = value[kNIMChatRoomMemberInfoKeyNick].asString();
1168 avatar_ = value[kNIMChatRoomMemberInfoKeyAvatar].asString();
1170 ext_ = value[kNIMChatRoomMemberInfoKeyExt].asString();
1176 enter_timetag_ = value[kNIMChatRoomMemberInfoKeyEnterTimetag].asUInt64();
1178 is_blacklist_ = value[kNIMChatRoomMemberInfoKeyBlacklist].asInt() == 1;
1180 is_muted_ = value[kNIMChatRoomMemberInfoKeyMuted].asInt() == 1;
1182 is_valid_ = value[kNIMChatRoomMemberInfoKeyValid].asInt() == 1;
1184 update_timetag_ = value[kNIMChatRoomMemberInfoKeyUpdateTimetag].asUInt64();
1186 temp_muted_ = value[kNIMChatRoomMemberInfoKeyTempMute].asInt() == 1;
1188 temp_muted_duration_ = value[kNIMChatRoomMemberInfoKeyTempMuteRestDuration].asInt64();
1190 tags_ = value[kNIMChatRoomMemberInfoKeyTag].asString();
1192 notify_tags_ = value[kNIMChatRoomMemberInfoKeyNotifyTags].asString();
1193 }
1194
1199 std::string ToJsonString() const {
1201 values[kNIMChatRoomMemberInfoKeyRoomID] = room_id_;
1202 values[kNIMChatRoomMemberInfoKeyAccID] = account_id_;
1203 values[kNIMChatRoomMemberInfoKeyTag] = tags_;
1204 values[kNIMChatRoomMemberInfoKeyType] = type_;
1205 values[kNIMChatRoomMemberInfoKeyLevel] = level_;
1206 values[kNIMChatRoomMemberInfoKeyNick] = nick_;
1207 values[kNIMChatRoomMemberInfoKeyAvatar] = avatar_;
1208 values[kNIMChatRoomMemberInfoKeyExt] = ext_;
1209 values[kNIMChatRoomMemberInfoKeyNotifyTags] = notify_tags_;
1210 values[kNIMChatRoomMemberInfoKeyOnlineState] = state_;
1211 values[kNIMChatRoomMemberInfoKeyGuestFlag] = guest_flag_;
1212 values[kNIMChatRoomMemberInfoKeyEnterTimetag] = enter_timetag_;
1213 values[kNIMChatRoomMemberInfoKeyBlacklist] = is_blacklist_ ? 1 : 0;
1214 values[kNIMChatRoomMemberInfoKeyMuted] = is_muted_ ? 1 : 0;
1215 values[kNIMChatRoomMemberInfoKeyValid] = is_valid_ ? 1 : 0;
1216 values[kNIMChatRoomMemberInfoKeyUpdateTimetag] = update_timetag_;
1217 values[kNIMChatRoomMemberInfoKeyTempMute] = temp_muted_ ? 1 : 0;
1218 values[kNIMChatRoomMemberInfoKeyTempMuteRestDuration] = temp_muted_duration_;
1219 return nim::GetJsonStringWithNoStyled(values);
1220 }
1221
1228 values[kNIMChatRoomMemberInfoKeyRoomID] = room_id_;
1229 values[kNIMChatRoomMemberInfoKeyAccID] = account_id_;
1230 values[kNIMChatRoomMemberInfoKeyTag] = tags_;
1231 values[kNIMChatRoomMemberInfoKeyType] = type_;
1232 values[kNIMChatRoomMemberInfoKeyLevel] = level_;
1233 values[kNIMChatRoomMemberInfoKeyNick] = nick_;
1234 values[kNIMChatRoomMemberInfoKeyAvatar] = avatar_;
1235 values[kNIMChatRoomMemberInfoKeyExt] = ext_;
1236 values[kNIMChatRoomMemberInfoKeyNotifyTags] = notify_tags_;
1237 values[kNIMChatRoomMemberInfoKeyOnlineState] = state_;
1238 values[kNIMChatRoomMemberInfoKeyGuestFlag] = guest_flag_;
1239 values[kNIMChatRoomMemberInfoKeyEnterTimetag] = enter_timetag_;
1240 values[kNIMChatRoomMemberInfoKeyBlacklist] = is_blacklist_ ? 1 : 0;
1241 values[kNIMChatRoomMemberInfoKeyMuted] = is_muted_ ? 1 : 0;
1242 values[kNIMChatRoomMemberInfoKeyValid] = is_valid_ ? 1 : 0;
1243 values[kNIMChatRoomMemberInfoKeyUpdateTimetag] = update_timetag_;
1244 values[kNIMChatRoomMemberInfoKeyTempMute] = temp_muted_ ? 1 : 0;
1245 values[kNIMChatRoomMemberInfoKeyTempMuteRestDuration] = temp_muted_duration_;
1246 return values;
1247 }
1248};
1249
1253 std::string key_;
1255 std::string value_;
1256};
1257
1261 std::list<std::string> tags_;
1265 int need_notify_{0};
1267 std::string ext_;
1268};
1269
1271typedef std::list<ChatRoomQueueElement> ChatRoomQueue;
1272
1276 std::string notify_ext_;
1279 operator NIMChatRoomExitReason() const { return code_; }
1280};
1281
1283NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool operator==(const NIMChatRoomExitReasonInfo& info, NIMChatRoomExitReason code);
1284
1293 ChatRoomInfo& room_info,
1294 ChatRoomMemberInfo& my_info);
1295
1302NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMemberInfos(const std::string& infos_json_str, std::list<ChatRoomMemberInfo>& infos);
1303
1310NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseChatRoomMsgs(const std::string& msgs_json_str, std::list<ChatRoomMessage>& msgs);
1311
1314public:
1316 void SetAccid(const std::string& accid) { robot_info_[kNIMRobotInfoKeyAccid] = accid; }
1317
1319 std::string GetAccid() const { return robot_info_[kNIMRobotInfoKeyAccid].asString(); }
1320
1322 void SetName(const std::string& name) { robot_info_[kNIMRobotInfoKeyName] = name; }
1323
1325 std::string GetName() const { return robot_info_[kNIMRobotInfoKeyName].asString(); }
1326
1328 void SetIcon(const std::string& icon) { robot_info_[kNIMRobotInfoKeyIcon] = icon; }
1329
1331 std::string GetIcon() const { return robot_info_[kNIMRobotInfoKeyIcon].asString(); }
1332
1334 void SetIntro(const std::string& intro) { robot_info_[kNIMRobotInfoKeyIntro] = intro; }
1335
1337 std::string GetIntro() const { return robot_info_[kNIMRobotInfoKeyIntro].asString(); }
1338
1340 void SetRobotID(const std::string& id) { robot_info_[kNIMRobotInfoKeyRobotId] = id; }
1341
1343 std::string GetRobotID() const { return robot_info_[kNIMRobotInfoKeyRobotId].asString(); }
1344
1346 void SetCreateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyCreateTime] = time; }
1347
1349 uint64_t GetCreateTime() const { return robot_info_[kNIMRobotInfoKeyCreateTime].asUInt64(); }
1350
1352 void SetUpdateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyUpdateTime] = time; }
1353
1355 uint64_t GetUpdateTime() const { return robot_info_[kNIMRobotInfoKeyUpdateTime].asUInt64(); }
1356
1357private:
1359};
1360
1362typedef std::list<RobotInfo> RobotInfos;
1363
1370NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfosStringToRobotInfos(const std::string& infos_json, RobotInfos& infos);
1371
1378NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfoStringToRobotInfo(const std::string& info_json, RobotInfo& info);
1379
1383 std::map<std::string, std::string> members_values_;
1385 ChatRoomBatchMembers() { members_values_.clear(); }
1386 explicit ChatRoomBatchMembers(const std::map<std::string, std::string>& members)
1387 : members_values_(members) {}
1388
1389 void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value& json_str) { assert(false); }
1390
1395 std::string ToJsonString() const {
1397 int i = 0;
1398 for (auto it = members_values_.begin(); it != members_values_.end(); ++it) {
1399 values[i][kNIMChatRoomQueueElementKey] = it->first.c_str();
1400 values[i][kNIMChatRoomQueueElementValue] = it->second.c_str();
1401 i++;
1402 }
1403 return nim::GetJsonStringWithNoStyled(values);
1404 }
1405};
1406
1413NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API bool ParseBatchInfosStringToNotMembers(const std::string& infos_json, std::list<std::string>& lst_members);
1414
1415} // namespace nim_chatroom
1416
1417#endif //_NIM_CHATROOM_SDK_CPP_HELPER_H_
Outputs a Value in JSON format without formatting (not human friendly).
Definition: writer.h:168
String write(const Value &root) override
Definition: json_writer.cpp:373
Represents a JSON value.
Definition: value.h:196
bool isMember(const char *key) const
Definition: json_value.cpp:1241
float asFloat() const
Definition: json_value.cpp:810
bool isObject() const
Definition: json_value.cpp:1390
UInt asUInt() const
Definition: json_value.cpp:684
Members getMemberNames() const
Return a list of the member names.
Definition: json_value.cpp:1248
Value & append(const Value &value)
Append value to array at the end.
Definition: json_value.cpp:1142
bool asBool() const
Definition: json_value.cpp:839
const_iterator begin() const
Definition: json_value.cpp:1475
Int asInt() const
Definition: json_value.cpp:657
const_iterator end() const
Definition: json_value.cpp:1488
String asString() const
Embedded zeroes are possible.
Definition: json_value.cpp:632
聊天室
Definition: nim_chatroom_def_include.h:17
std::list< ChatRoomQueueElement > ChatRoomQueue
聊天室麦序队列
Definition: nim_chatroom_helper.h:1271
std::list< RobotInfo > RobotInfos
机器人信息
Definition: nim_chatroom_helper.h:1362
bool ParseChatRoomMsgs(const std::string &msgs_json_str, std::list< ChatRoomMessage > &msgs)
解析聊天室成员信息
Definition: nim_chatroom_helper.cpp:41
bool ParseChatRoomEnterCallbackResultInfo(const std::string &result, ChatRoomInfo &room_info, ChatRoomMemberInfo &my_info)
解析聊天室登录结果
Definition: nim_chatroom_helper.cpp:17
bool ParseRobotInfosStringToRobotInfos(const std::string &infos_json, RobotInfos &infos)
解析机器人信息
Definition: nim_chatroom_helper.cpp:55
bool ParseBatchInfosStringToNotMembers(const std::string &infos_json, std::list< std::string > &lst_members)
解析成员列表
Definition: nim_chatroom_helper.cpp:84
bool ParseChatRoomMemberInfos(const std::string &infos_json_str, std::list< ChatRoomMemberInfo > &infos)
解析聊天室成员信息
Definition: nim_chatroom_helper.cpp:27
ChatRoomQueueElement ChatRoomMember
Definition: nim_chatroom_helper.h:1380
bool ParseRobotInfoStringToRobotInfo(const std::string &info_json, RobotInfo &info)
解析机器人信息
Definition: nim_chatroom_helper.cpp:69
bool operator==(const NIMChatRoomExitReasonInfo &info, NIMChatRoomExitReason code)
Definition: nim_chatroom_helper.cpp:13
@ arrayValue
array value (ordered list)
Definition: value.h:115
bool ParseJsonValue(const std::string &content, nim_cpp_wrapper_util::Json::Value &values)
解析JsonString
Definition: nim_json_util.cpp:70
bool StrListToJsonString(const std::list< std::string > &list, std::string &out)
将一个string类型的list组装成一个Json Array
Definition: nim_json_util.cpp:12
bool JsonArrayStringToList(const std::string &array_str, std::list< std::string > &out)
将一个string类型的Json Array解析成一个string类型的list
Definition: nim_json_util.cpp:54
bool JsonStrArrayToList(const nim_cpp_wrapper_util::Json::Value &array_str, std::list< std::string > &out)
将一个string类型的Json Array解析成一个string类型的list
Definition: nim_json_util.cpp:30
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
static const char * kNIMChatRoomMsgKeyAntiSpamRes
String, 易盾反垃圾返回的结果字段
Definition: nim_chatroom_def.h:502
static const char * kNIMChatRoomMemberInfoKeyTag
string 聊天室成员所属的 tag 信息
Definition: nim_chatroom_def.h:641
static const char * kNIMChatRoomGetMembersKeyLimit
int 数量
Definition: nim_chatroom_def.h:730
static const char * kNIMChatRoomSetMemberAttributeKeyOpt
boolean: true:是,false:否
Definition: nim_chatroom_def.h:758
static const char * kNIMChatRoomMemberInfoKeyLevel
int 成员级别: >=0表示用户开发者可以自定义的级别
Definition: nim_chatroom_def.h:633
static const char * kNIMChatRoomSetMemberAttributeKeyAccoutID
string 成员ID
Definition: nim_chatroom_def.h:754
static const char * kNIMChatRoomGetMembersKeyTag
获取成员时指定的 tag
Definition: nim_chatroom_def.h:726
static const char * kNIMChatRoomMemberInfoKeyEnterTimetag
long 进入聊天室的时间点,对于离线成员该字段为空
Definition: nim_chatroom_def.h:649
static const char * kNIMChatRoomMsgKeyYiDunAntiCheating
(可选)String, 易盾反垃圾增强反作弊专属字段, 限制json,长度限制1024
Definition: nim_chatroom_def.h:494
static const char * kNIMChatRoomGetMembersKeyType
NIMChatRoomGetMemberType 成员类型
Definition: nim_chatroom_def.h:724
static const char * kChatRoomNotificationDataKeyExt
string 上层开发自定义的事件通知扩展字段, 必须为可以解析为Json的非格式化的字符串
Definition: nim_chatroom_def.h:771
static const char * kChatRoomNotificationDataKeyTags
string 当通知为 kNIMChatRoomNotificationIdMemberTagChanged 时,代表变更后的 tags 信息
Definition: nim_chatroom_def.h:797
static const char * kNIMChatRoomEnterLocationDistance
Definition: nim_chatroom_def.h:439
static const char * kNIMChatRoomNotificationQueueChangedKeyType
string 变更类型,目前有OFFER,POLL,DROP,BATCH_UPDATE 类型
Definition: nim_chatroom_def.h:837
static const char * kChatRoomNotificationDataKeyMuteFlag
int 当通知为 kNIMChatRoomNotificationIdMemberIn才有,代表是否禁言状态,1:是 缺省或0:不是
Definition: nim_chatroom_def.h:783
static const char * kChatRoomNotificationDataKeyTarget
string json array 被操作者的accid
Definition: nim_chatroom_def.h:779
static const char * kNIMChatRoomEnterKeyAppKey
string, 应用appkey,匿名登录时必填
Definition: nim_chatroom_def.h:446
static const char * kNIMChatRoomEnterLoginExt
string, 登录自定义字段,用于提交给用户的第三方回调服务进行登录检测,不会同步给其他端
Definition: nim_chatroom_def.h:431
static const char * kNIMChatRoomMsgKeyType
int, 消息类型(NIMChatRoomMsgType)
Definition: nim_chatroom_def.h:468
static const char * kNIMChatRoomMemberInfoKeyMuted
int 是禁言用户
Definition: nim_chatroom_def.h:654
static const char * kNIMChatRoomMsgKeyHistorySave
int,(可选)该消息是否存储云端历史,可选,0:不是,1:是, 默认1
Definition: nim_chatroom_def.h:484
static const char * kNIMChatRoomInfoKeyQueuelevel
int, 队列管理权限:0:所有人都有权限变更队列,1:只有主播管理员才能操作变更
Definition: nim_chatroom_def.h:610
static const char * kNIMRobotInfoKeyAccid
string 帐号
Definition: nim_chatroom_def.h:921
static const char * kChatRoomNotificationDataKeyTempMuteDuration
long 当通知为临时禁言相关时有该值,禁言时kNIMChatRoomNotificationIdMemberTempMute代表本次禁言的时长(秒)
Definition: nim_chatroom_def.h:781
static const char * kChatRoomNotificationKeyData
string 通知内容
Definition: nim_chatroom_def.h:767
NIMChatRoomMemberAttribute
Definition: nim_chatroom_def.h:713
NIMChatRoomGetMemberType
Definition: nim_chatroom_def.h:701
NIMChatRoomOnlineState
Definition: nim_chatroom_def.h:689
@ kNIMChatRoomOnlineStateOffline
Definition: nim_chatroom_def.h:690
static const char * kNIMChatRoomMsgKeyExt
string, 第三方扩展字段, 长度限制4096, 必须为可以解析为Json的非格式化的字符串
Definition: nim_chatroom_def.h:476
NIMChatRoomGuestFlag
Definition: nim_chatroom_def.h:695
@ kNIMChatRoomGuestFlagGuest
Definition: nim_chatroom_def.h:697
static const char * kNIMChatRoomNotificationQueueBatchChangedKeyKey
string 变更元素的key
Definition: nim_chatroom_def.h:851
static const char * kNIMChatRoomGetMsgHistoryKeyEndTime
long 结束时间,单位毫秒
Definition: nim_chatroom_def.h:741
static const char * kNIMChatRoomMsgKeyRoomID
long, 消息所属的聊天室id,服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:516
static const char * kNIMChatRoomMemberInfoKeyRoomID
long 聊天室id
Definition: nim_chatroom_def.h:627
static const char * kNIMChatRoomQueueElementValue
string 元素value
Definition: nim_chatroom_def.h:807
static const char * kNIMChatRoomMsgKeyBody
string,(可选)文本消息内容(聊天室机器人文本消息)
Definition: nim_chatroom_def.h:488
static const char * kNIMChatRoomEnterNotifyTags
string 登录登出通知的目标标签
Definition: nim_chatroom_def.h:427
static const char * kNIMChatRoomNotificationQueueChangedKeyKey
string 变更元素的key
Definition: nim_chatroom_def.h:839
static const char * kNIMChatRoomMsgKeyNotifyTags
(可选)String 消息的目标标签表达式,参见TagPattern和TagCalculator v8.4.0 新增
Definition: nim_chatroom_def.h:498
static const char * kNIMChatRoomMemberInfoKeyUpdateTimetag
long 固定成员的记录更新时间,用于固定成员列表的排列查询
Definition: nim_chatroom_def.h:658
static const char * kNIMChatRoomMsgKeyAntiSpamExt
(可选)String, 易盾反垃圾扩展字段,限制json,长度限制1024
Definition: nim_chatroom_def.h:500
static const char * kChatRoomNotificationDataKeyMemberInTempMutedDuration
long 当通知为 kNIMChatRoomNotificationIdMemberIn,代表临时禁言时长(秒), 其他通知事件不带该数据
Definition: nim_chatroom_def.h:787
static const char * kNIMChatRoomMsgKeyLocationY
(可选)int, 位置信息 Y 轴坐标
Definition: nim_chatroom_def.h:506
static const char * kNIMChatRoomMsgKeyFromClientType
int,消息发送方客户端类型(NIMChatRoomClientType),服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:522
static const char * kNIMChatRoomInfoKeyBroadcastUrl
string, 视频直播拉流地址
Definition: nim_chatroom_def.h:598
static const char * kNIMRobotInfoKeyRobotId
string 机器人ID
Definition: nim_chatroom_def.h:929
static const char * kNIMChatRoomNotificationQueueChangedKeyValue
string 变更元素的内容
Definition: nim_chatroom_def.h:841
static const char * kNIMChatRoomMemberInfoKeyNick
string 聊天室内的昵称字段,预留字段, 可从Uinfo中取
Definition: nim_chatroom_def.h:635
static const char * kNIMChatRoomMsgKeyHighPriorityFlag
int, 高优先级消息标记,1:是; 非高优先级消息不带该字段,服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:530
static const char * kNIMChatRoomMemberInfoKeyNotifyTags
string 聊天室成员登录时指定的 notify_tags 信息
Definition: nim_chatroom_def.h:643
static const char * kNIMChatRoomInfoKeyOnlineCount
int, 当前在线用户数量
Definition: nim_chatroom_def.h:606
static const char * kNIMChatRoomEnterKeyAvatar
string, (匿名登录时必填)设置后通过获取聊天室成员信息接口可以获取该数据
Definition: nim_chatroom_def.h:419
static const char * kNIMRobotInfoKeyIcon
string 头像
Definition: nim_chatroom_def.h:925
static const char * kNIMChatRoomEnterKeyNick
string, (匿名登录时必填)进入聊天室后展示的昵称,选填,聊天室成员收到聊天室进入通知中可以获取该数据
Definition: nim_chatroom_def.h:417
static const char * kNIMChatRoomInfoKeyName
string, 聊天室名称
Definition: nim_chatroom_def.h:594
static const char * kNIMChatRoomEnterKeyRandomID
int,是否开启随机ID模式,默认为关闭(0),建议默认值
Definition: nim_chatroom_def.h:456
NIMChatRoomClientType
Definition: nim_chatroom_def.h:566
@ kNIMChatRoomClientTypeDefault
Definition: nim_chatroom_def.h:567
static const char * kNIMChatRoomEnterKeyAccID
string,登录聊天室的账号非匿名模式下使用
Definition: nim_chatroom_def.h:458
static const char * kNIMChatRoomEnterKeyExt
string, 聊天室可用的扩展字段,必须为可以解析为Json的非格式化的字符串,选填,设置后通过获取聊天室成员信息接口可以获取该数据
Definition: nim_chatroom_def.h:421
static const char * kChatRoomNotificationDataKeyMsgId
string 当通知为 kNIMChatRoomNotificationIdRecallMessage,代表被撤回消息的消息 ID
Definition: nim_chatroom_def.h:795
static const char * kNIMChatRoomMemberInfoKeyValid
int 记录有效标记位
Definition: nim_chatroom_def.h:656
static const char * kNIMChatRoomMemberInfoKeyBlacklist
int 是黑名单
Definition: nim_chatroom_def.h:652
static const char * kNIMChatRoomGetMsgHistoryKeyMsgtypes
array:数组 要查询的消息类型,取值NIMChatRoomMsgType中所枚举类型
Definition: nim_chatroom_def.h:747
static const char * kNIMChatRoomEnterAuthType
int 鉴权方式,0表示最初的loginToken的校验方式,1表示基于appSecret计算的token鉴权方式,2表示基于第三方回调的token鉴权方式,默认0
Definition: nim_chatroom_def.h:429
static const char * kNIMChatRoomMsgKeyFromAvatar
string, 消息发送方头像,服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:526
static const char * kNIMChatRoomMsgKeyAntiSpamContent
string, (可选)开发者自定义的反垃圾字段, 长度限制2048
Definition: nim_chatroom_def.h:480
static const char * kNIMChatRoomMsgKeyEnvConfig
(可选)String, 自定义抄送配置 v8.0.0 新增
Definition: nim_chatroom_def.h:496
static const char * kNIMChatRoomMsgKeyLocalFilePath
string, 暂时不用,多媒体消息资源本地绝对路径,SDK本地维护,发送多媒体消息时必填
Definition: nim_chatroom_def.h:534
static const char * kNIMChatRoomMemberInfoKeyTempMute
int 临时禁言
Definition: nim_chatroom_def.h:660
static const char * kNIMRobotInfoKeyIntro
string 介绍
Definition: nim_chatroom_def.h:927
static const char * kNIMChatRoomQueueElementKey
string 元素key
Definition: nim_chatroom_def.h:805
static const char * kNIMChatRoomGetMsgHistoryKeyTags
array 查询历史消息指定的 tags
Definition: nim_chatroom_def.h:737
static const char * kNIMChatRoomGetMsgHistoryKeyLimit
int 本次返回的消息数量
Definition: nim_chatroom_def.h:743
NIMChatRoomMsgType
Definition: nim_chatroom_def.h:551
@ kNIMChatRoomMsgTypeImage
Definition: nim_chatroom_def.h:553
@ kNIMChatRoomMsgTypeTips
Definition: nim_chatroom_def.h:560
@ kNIMChatRoomMsgTypeCustom
Definition: nim_chatroom_def.h:561
@ kNIMChatRoomMsgTypeText
Definition: nim_chatroom_def.h:552
@ kNIMChatRoomMsgTypeFile
Definition: nim_chatroom_def.h:558
@ kNIMChatRoomMsgTypeLocation
Definition: nim_chatroom_def.h:556
@ kNIMChatRoomMsgTypeNotification
Definition: nim_chatroom_def.h:557
@ kNIMChatRoomMsgTypeAudio
Definition: nim_chatroom_def.h:554
@ kNIMChatRoomMsgTypeRobot
Definition: nim_chatroom_def.h:559
@ kNIMChatRoomMsgTypeVideo
Definition: nim_chatroom_def.h:555
@ kNIMChatRoomMsgTypeUnknown
Definition: nim_chatroom_def.h:562
static const char * kNIMChatRoomMsgKeyResendFlag
int,消息重发标记位,第一次发送0,重发1
Definition: nim_chatroom_def.h:474
static const char * kNIMChatRoomEnterLoginTags
string array 登录标签,可以设置多个,json array 格式,例子:["tag1", "tag2"]
Definition: nim_chatroom_def.h:425
static const char * kNIMChatRoomEnterKeyAppDataPath
Definition: nim_chatroom_def.h:450
static const char * kNIMChatRoomMemberInfoKeyExt
string 开发者扩展字段, 长度限制2k, 必须为可以解析为Json的非格式化的字符串
Definition: nim_chatroom_def.h:639
NIMChatRoomExitReason
Definition: nim_chatroom_def.h:614
static const char * kNIMChatRoomEnterEnableLocation
int 登录时使用的位置信息
Definition: nim_chatroom_def.h:435
static const char * kNIMChatRoomMsgKeyAntiSpamUsingYiDun
int, (可选) 单条消息是否使用易盾反垃圾 0:(在开通易盾的情况下)不过易盾反垃圾
Definition: nim_chatroom_def.h:486
static const char * kNIMRobotInfoKeyName
string 名字
Definition: nim_chatroom_def.h:923
static const char * kChatRoomNotificationDataKeyMsgTimetag
int64_t 当通知为 kNIMChatRoomNotificationIdRecallMessage,代表被撤回消息的消息时间戳
Definition: nim_chatroom_def.h:793
static const char * kNIMChatRoomInfoKeyAnnouncement
string, 聊天室公告
Definition: nim_chatroom_def.h:596
static const char * kNIMChatRoomMsgKeyAntiSpamBizId
string, (可选)用户配置的对某些单条消息另外的反垃圾的业务ID
Definition: nim_chatroom_def.h:482
static const char * kNIMChatRoomMsgKeyThirdPartyCBEXT
(可选)string第三方回调回来的自定义扩展字段 v7.8 新增
Definition: nim_chatroom_def.h:490
static const char * kChatRoomNotificationDataKeyOptNick
string 操作者的账号nick
Definition: nim_chatroom_def.h:775
static const char * kNIMChatRoomQueueOfferOptionTransient
bool (可选参数)true 表示当提交这个新元素的用户从聊天室掉线或退出的时候,需要删除这个元素;默认 false 表示不删除
Definition: nim_chatroom_def.h:815
static const char * kNIMChatRoomMsgKeyToAccids
(可选)string, json array,消息接受者,如果设置了本字段,且不为空,则本消息为聊天室定向消息(聊天室定向消息不会存历史)
Definition: nim_chatroom_def.h:510
static const char * kNIMChatRoomEnterKeyLogLevel
int,匿名登录时选填,定义见NIMSDKLogLevel(选填,SDK默认的内置级别为kNIMSDKLogLevelPro)
Definition: nim_chatroom_def.h:452
static const char * kNIMChatRoomSetMemberAttributeKeyAttribute
NIMChatRoomMemberAttribute
Definition: nim_chatroom_def.h:756
static const char * kNIMChatRoomQueueOfferOptionElementAccId
string (可选参数)队列元素所属账号,默认不传表示队列元素属于当前操作人,管理员可以指定队列元素归属于其他合法账号
Definition: nim_chatroom_def.h:817
static const char * kChatRoomNotificationDataKeyTargetTag
string 当通知为 kChatRoomNotificationIdTagTempMuteAdd 或 kChatRoomNotificationIdTagTempMuteRemove,代表被禁言的目标...
Definition: nim_chatroom_def.h:791
static const char * kNIMRobotInfoKeyCreateTime
long 创建时间戳 毫秒
Definition: nim_chatroom_def.h:931
static const char * kNIMChatRoomMemberInfoKeyType
成员类型, -1:受限用户; 0:普通;1:创建者;2:管理员;3:临时用户,非固定成员;4:匿名非注册用户,非云信注册用户
Definition: nim_chatroom_def.h:631
static const char * kNIMChatRoomNotificationQueueBatchChangedKeyValue
string 变更元素的内容
Definition: nim_chatroom_def.h:853
static const char * kNIMChatRoomEnterKeyAddress
string array,聊天室地址,地址通过应用服务器接口获取
Definition: nim_chatroom_def.h:454
static const char * kNIMChatRoomMemberInfoKeyTempMuteRestDuration
long 临时禁言的解除时长,单位秒
Definition: nim_chatroom_def.h:662
static const char * kNIMChatRoomMsgKeyLocalResId
string, 暂时不用,多媒体资源id,发送方选填,接收方收到的是客户端消息id
Definition: nim_chatroom_def.h:536
static const char * kNIMChatRoomMsgKeySubType
(可选)int,消息的子类型,客户端定义,服务器透传
Definition: nim_chatroom_def.h:492
static const char * kNIMChatRoomMemberInfoKeyOnlineState
NIMChatRoomOnlineState 成员是否处于在线状态, 仅特殊成员才可能离线, 对游客/匿名用户而言只能是在线
Definition: nim_chatroom_def.h:645
static const char * kNIMChatRoomSetMemberAttributeKeyNotifyExt
string 自定义的事件通知扩展字段, 必须为可以解析为Json的非格式化的字符串
Definition: nim_chatroom_def.h:760
static const char * kNIMChatRoomMsgKeyAttach
string, 消息内容,长度限制2048, 如果约定的是json字符串,必须为可以解析为json的非格式化的字符串
Definition: nim_chatroom_def.h:470
static const char * kNIMRobotInfoKeyUpdateTime
long 更新时间戳 毫秒
Definition: nim_chatroom_def.h:933
NIMChatRoomNotificationId
Definition: nim_chatroom_def.h:860
@ kNIMChatRoomNotificationIdQueueBatchOffer
聊天室麦序队列中有批量增加通知消息 "ext" :{"_e":"BATCH_OFFER","elements":[{"nick":"ddd","accid":"ljmt",...
Definition: nim_chatroom_def.h:885
@ kNIMChatRoomNotificationIdMemberTempUnMute
Definition: nim_chatroom_def.h:875
@ kNIMChatRoomNotificationIdMemberTagChanged
聊天室中有成员 tags 变更
Definition: nim_chatroom_def.h:887
@ kNIMChatRoomNotificationIdQueueBatchChanged
Definition: nim_chatroom_def.h:880
@ kNIMChatRoomNotificationIdTagTempMuteAdd
Definition: nim_chatroom_def.h:881
@ kNIMChatRoomNotificationIdMemberTempMute
Definition: nim_chatroom_def.h:874
@ kNIMChatRoomNotificationIdQueueChanged
Definition: nim_chatroom_def.h:877
@ kNIMChatRoomNotificationIdMemberIn
Definition: nim_chatroom_def.h:861
@ kNIMChatRoomNotificationIdTagTempMuteRemove
Definition: nim_chatroom_def.h:882
@ kNIMChatRoomNotificationIdRecallMessage
Definition: nim_chatroom_def.h:883
static const char * kNIMChatRoomEnterKeyToken
string,登录聊天室的密码非匿名模式下使用
Definition: nim_chatroom_def.h:460
static const char * kNIMChatRoomMemberInfoKeyAvatar
string 聊天室内的头像,预留字段, 可从Uinfo中取icon
Definition: nim_chatroom_def.h:637
static const char * kNIMChatRoomMsgKeyLocationX
(可选)int, 位置信息 X 轴坐标
Definition: nim_chatroom_def.h:504
static const char * kNIMChatRoomInfoKeyValidFlag
int, 聊天室有效标记, 1:有效,0:无效
Definition: nim_chatroom_def.h:602
static const char * kNIMChatRoomEnterLocationX
Definition: nim_chatroom_def.h:436
static const char * kChatRoomNotificationDataKeyOpt
string 操作者的账号accid
Definition: nim_chatroom_def.h:773
static const char * kChatRoomNotificationDataKeyTargetNick
string json array 被操作者的nick列表
Definition: nim_chatroom_def.h:777
static const char * kNIMChatRoomEnterLocationY
Definition: nim_chatroom_def.h:437
static const char * kNIMChatRoomInfoKeyExt
string, 第三方扩展字段, 必须为可以解析为Json的非格式化的字符串, 长度4k
Definition: nim_chatroom_def.h:604
static const char * kNIMChatRoomMsgKeyTime
long, 消息发送的时间戳(毫秒),服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:520
static const char * kNIMChatRoomGetMsgHistoryKeyStartTime
long 开始时间,单位毫秒
Definition: nim_chatroom_def.h:739
static const char * kNIMChatRoomNotificationQueueBatchChangedKeyObject
map 变更元素的内容
Definition: nim_chatroom_def.h:855
static const char * kNIMChatRoomInfoKeyMuteAll
int, 聊天室禁言标志 1:禁言,0:解除禁言
Definition: nim_chatroom_def.h:608
static const char * kNIMChatRoomNotificationQueueBatchChangedKeyType
string 变更类型,目前有OFFER,POLL,DROP,PARTCLEAR四个类型
Definition: nim_chatroom_def.h:849
static const char * kNIMChatRoomGetMsgHistoryKeyReverse
boolean: true:按时间正序起查,正序排列,false:按时间逆序起查,逆序排列
Definition: nim_chatroom_def.h:745
static const char * kNIMChatRoomEnterLocationZ
Definition: nim_chatroom_def.h:438
static const char * kChatRoomNotificationDataKeyTempMutedFlag
int 当通知为 kNIMChatRoomNotificationIdMemberIn才有,代表是否临时禁言状态,1:是 缺省或0:不是
Definition: nim_chatroom_def.h:785
static const char * kNIMChatRoomMemberInfoKeyGuestFlag
NIMChatRoomGuestFlag 是否是普通游客类型,0:不是游客,1:是游客; 游客身份在聊天室中没有持久化, 只有在线时才会有内存状态
Definition: nim_chatroom_def.h:647
static const char * kNIMChatRoomEnterKeyNotifyExt
string, 进入聊天室通知开发者扩展字段,必须为可以解析为Json的非格式化的字符串,选填,聊天室成员收到聊天室进入通知中可以获取该数据
Definition: nim_chatroom_def.h:423
static const char * kNIMChatRoomMsgKeyAntiSpamEnable
int, 是否需要过易盾反垃圾, 0:不需要,1:需要, 默认0
Definition: nim_chatroom_def.h:478
static const char * kNIMChatRoomMsgKeyClientMsgid
string,客户端消息id
Definition: nim_chatroom_def.h:472
static const char * kNIMChatRoomMsgKeyLocationZ
(可选)int, 位置信息 Z 轴坐标
Definition: nim_chatroom_def.h:508
static const char * kNIMChatRoomMemberInfoKeyAccID
string 成员账号
Definition: nim_chatroom_def.h:629
static const char * kNIMChatRoomMsgKeyFromAccount
string, 消息发送者的账号,服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:518
static const char * kNIMChatRoomEnterAntiSpamBusinessID
string, 反垃圾相关业务id
Definition: nim_chatroom_def.h:433
static const char * kNIMChatRoomMsgKeyFromExt
string, 消息发送方身份扩展字段,服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:528
static const char * kNIMChatRoomInfoKeyCreatorID
string, 聊天室创建者账号
Definition: nim_chatroom_def.h:600
static const char * kNIMChatRoomGetMembersKeyOffset
long 时间戳,填0会使用当前服务器最新时间开始查询,即第一页
Definition: nim_chatroom_def.h:728
static const char * kChatRoomNotificationKeyID
string 通知类型ID
Definition: nim_chatroom_def.h:769
static const char * kNIMChatRoomInfoKeyID
long, 聊天室ID
Definition: nim_chatroom_def.h:592
static const char * kChatRoomNotificationDataKeyQueueChange
string 当通知为 kNIMChatRoomNotificationIdQueueChange,代表队列变更具体内容,内容解析 参考麦序队列变更通知扩展字段queueChange
Definition: nim_chatroom_def.h:789
static const char * kNIMChatRoomMsgKeyFromNick
string, 消息发送方昵称,服务器填写,发送方不需要填写
Definition: nim_chatroom_def.h:524
nim chatroom 公共数据类型定义总的包含文件
#define NIM_CHATROOM_SDK_CPPWRAPPER_DLL_API
Definition: nim_chatroom_sdk_cpp_wrapper.h:38
JSON辅助方法
#define true
Definition: stdbool.h:30
#define false
Definition: stdbool.h:33
Definition: nim_chatroom_def.h:16
float z_
位置信息 z 坐标
Definition: nim_chatroom_def.h:22
float x_
位置信息 x 坐标
Definition: nim_chatroom_def.h:18
float distance_
距离信息,仅在更新位置信息时会用到,发送消息、加入房间不需要填写
Definition: nim_chatroom_def.h:24
float y_
位置信息 y 坐标
Definition: nim_chatroom_def.h:20
Definition: nim_chatroom_helper.h:250
std::string app_key_
应用appkey,匿名登录时必填
Definition: nim_chatroom_helper.h:258
ChatRoomAnoymityEnterInfo()
Definition: nim_chatroom_helper.h:266
void ParseJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
解析Json Value
Definition: nim_chatroom_helper.h:313
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_chatroom_helper.h:293
std::list< std::string > address_
聊天室地址,地址通过应用服务器接口获取
Definition: nim_chatroom_helper.h:252
std::string app_data_file_
应用数据目录,匿名登录时必填,使用默认路径时只需传入单个目录名(不以反斜杠结尾),使用自定义路径时需传入完整路径(以反斜杠结尾,并确保有正确的读写权限!)
Definition: nim_chatroom_helper.h:254
bool random_id_
是否开启随机ID模式,默认为关闭(false),建议默认值
Definition: nim_chatroom_helper.h:260
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:275
std::string token_
登录聊天室的密码
Definition: nim_chatroom_helper.h:264
std::string accid_
使用自定义用户 ID,一旦指定,SDK 不会自动生成随机 ID,random 参数将无效
Definition: nim_chatroom_helper.h:262
int sdk_log_level_
匿名登录时选填,定义见NIMSDKLogLevel(选填,SDK默认的内置级别为kNIMSDKLogLevelPro)
Definition: nim_chatroom_helper.h:256
聊天室批量更新成员
Definition: nim_chatroom_helper.h:1382
std::map< std::string, std::string > members_values_
Definition: nim_chatroom_helper.h:1383
ChatRoomBatchMembers(const std::map< std::string, std::string > &members)
Definition: nim_chatroom_helper.h:1386
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:1395
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &json_str)
Definition: nim_chatroom_helper.h:1389
ChatRoomBatchMembers()
Definition: nim_chatroom_helper.h:1385
聊天室登录信息
Definition: nim_chatroom_helper.h:31
void SetAuthType(int auth_type)
设置鉴权方式
Definition: nim_chatroom_helper.h:104
nim_cpp_wrapper_util::Json::Value values_
Definition: nim_chatroom_helper.h:127
void SetNotifyExt(const nim_cpp_wrapper_util::Json::Value &notify_ext)
设置进入聊天室通知开发者扩展字段,选填
Definition: nim_chatroom_helper.h:58
void EnableLocation(bool enable)
是否启用聊天室空间位置信息功能,启用后 SetLocation 功能才生效,否则 SDK 不解析 Location 信息
Definition: nim_chatroom_helper.h:97
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:124
void SetLocation(NIMChatRoomLocation location)
登录聊天室时传递的位置信息
Definition: nim_chatroom_helper.h:85
void SetNick(const std::string &nick)
设置进入聊天室后展示的昵称,选填
Definition: nim_chatroom_helper.h:37
void SetLoginExt(const std::string &login_ext)
登录自定义字段
Definition: nim_chatroom_helper.h:111
void SetExt(const nim_cpp_wrapper_util::Json::Value &ext)
设置聊天室可用的扩展字段,选填
Definition: nim_chatroom_helper.h:51
void SetAntiSpamBusinessID(const std::string &anti_spam_business_id)
Definition: nim_chatroom_helper.h:118
void SetNotifyTags(const std::string &expression)
登录时携带的 notify tag 表达式
Definition: nim_chatroom_helper.h:78
void SetLoginTag(const std::list< std::string > &login_tags)
设置登录携带的 tag 列表,允许多个
Definition: nim_chatroom_helper.h:67
void SetAvatar(const std::string &avatar)
设置进入聊天室后展示的头像,选填
Definition: nim_chatroom_helper.h:44
根据 tag 获取聊天室成员参数
Definition: nim_chatroom_helper.h:914
int limit_
数量
Definition: nim_chatroom_helper.h:920
std::string tag_
成员 tag
Definition: nim_chatroom_helper.h:916
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:931
int64_t timestamp_offset_
成员时间戳偏移量
Definition: nim_chatroom_helper.h:918
ChatRoomGetMembersByTagParameters()
Definition: nim_chatroom_helper.h:923
获取聊天室成员参数
Definition: nim_chatroom_helper.h:887
int64_t timestamp_offset_
成员时间戳偏移量
Definition: nim_chatroom_helper.h:891
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:904
ChatRoomGetMembersParameters()
Definition: nim_chatroom_helper.h:896
NIMChatRoomGetMemberType type_
成员类型
Definition: nim_chatroom_helper.h:889
int limit_
数量
Definition: nim_chatroom_helper.h:893
Definition: nim_chatroom_helper.h:1000
int64_t start_timetag_
开始时间,单位毫秒
Definition: nim_chatroom_helper.h:1003
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:1046
static std::vector< NIMChatRoomMsgType > kMsg_Types_List
Definition: nim_chatroom_helper.h:1066
std::vector< NIMChatRoomMsgType > msg_types_
类型
Definition: nim_chatroom_helper.h:1011
ChatRoomGetMsgHistoryByTagsParameters()
Definition: nim_chatroom_helper.h:1013
int64_t end_timetag_
结束时间
Definition: nim_chatroom_helper.h:1005
bool reverse_
是否反向查询
Definition: nim_chatroom_helper.h:1009
void RemoveMessageType(NIMChatRoomMsgType type)
Definition: nim_chatroom_helper.h:1033
int limit_
本次返回的消息数量
Definition: nim_chatroom_helper.h:1007
std::list< std::string > tags_
Definition: nim_chatroom_helper.h:1001
获取聊天室消息历史参数
Definition: nim_chatroom_helper.h:941
int limit_
本次返回的消息数量
Definition: nim_chatroom_helper.h:945
static std::vector< NIMChatRoomMsgType > kMsg_Types_List
Definition: nim_chatroom_helper.h:997
ChatRoomGetMsgHistoryParameters()
Definition: nim_chatroom_helper.h:951
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:983
void RemoveMessageType(NIMChatRoomMsgType type)
Definition: nim_chatroom_helper.h:970
int64_t start_timetag_
开始时间,单位毫秒
Definition: nim_chatroom_helper.h:943
bool reverse_
是否反向查询
Definition: nim_chatroom_helper.h:947
std::vector< NIMChatRoomMsgType > msg_types_
类型
Definition: nim_chatroom_helper.h:949
Definition: nim_chatroom_helper.h:131
std::list< std::string > address_
聊天室地址,地址通过应用服务器接口获取
Definition: nim_chatroom_helper.h:133
std::string login_ext_
登录自定义字段
Definition: nim_chatroom_helper.h:155
ChatRoomIndependentEnterInfo()
Definition: nim_chatroom_helper.h:159
bool enable_location_
是否启用空间消息能力,true 为启用,false 为关闭,SDK 不解析 location 相关信息
Definition: nim_chatroom_helper.h:151
NIMChatRoomLocation location_
位置坐标描述
Definition: nim_chatroom_helper.h:149
std::string anti_spam_business_id_
反垃圾相关业务id
Definition: nim_chatroom_helper.h:157
std::list< std::string > login_tags_
登录标签,可以设置多个
Definition: nim_chatroom_helper.h:145
std::string app_data_file_
应用数据目录
Definition: nim_chatroom_helper.h:135
std::string token_
登录聊天室的密码
Definition: nim_chatroom_helper.h:143
std::string accid_
登录聊天室的账号
Definition: nim_chatroom_helper.h:141
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:170
void FromJsonObject(const nim_cpp_wrapper_util::Json::Value &values)
Definition: nim_chatroom_helper.h:227
int sdk_log_level_
选填,定义见NIMSDKLogLevel(选填,SDK默认的内置级别为kNIMSDKLogLevelAPP)
Definition: nim_chatroom_helper.h:137
std::string app_key_
应用appkey
Definition: nim_chatroom_helper.h:139
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_chatroom_helper.h:200
std::string notify_tags_
登录登出通知的目标标签
Definition: nim_chatroom_helper.h:147
int auth_type_
鉴权方式,0表示最初的loginToken的校验方式,1表示基于appSecret计算的token鉴权方式,2表示基于第三方回调的token鉴权方式,默认0
Definition: nim_chatroom_helper.h:153
聊天室信息
Definition: nim_chatroom_helper.h:336
ChatRoomInfo()
Definition: nim_chatroom_helper.h:358
std::string announcement_
聊天室公告
Definition: nim_chatroom_helper.h:342
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_chatroom_helper.h:405
std::string ext_
第三方扩展字段, 必须为可以解析为json的非格式化的字符串, 长度4k
Definition: nim_chatroom_helper.h:350
int64_t id_
聊天室ID
Definition: nim_chatroom_helper.h:338
std::string name_
聊天室名称
Definition: nim_chatroom_helper.h:340
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:386
std::string broadcast_url_
视频直播拉流地址
Definition: nim_chatroom_helper.h:344
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室信息
Definition: nim_chatroom_helper.h:369
std::string creator_id_
聊天室创建者账号
Definition: nim_chatroom_helper.h:346
聊天室成员信息
Definition: nim_chatroom_helper.h:1103
std::string account_id_
成员账号
Definition: nim_chatroom_helper.h:1107
int64_t enter_timetag_
进入聊天室的时间点,对于离线成员该字段为空
Definition: nim_chatroom_helper.h:1127
bool is_muted_
是禁言用户
Definition: nim_chatroom_helper.h:1131
std::string avatar_
聊天室内的头像,预留字段, 可从Uinfo中取icon
Definition: nim_chatroom_helper.h:1117
bool temp_muted_
临时禁言
Definition: nim_chatroom_helper.h:1137
int64_t room_id_
聊天室id
Definition: nim_chatroom_helper.h:1105
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &value)
Definition: nim_chatroom_helper.h:1156
bool is_blacklist_
是黑名单
Definition: nim_chatroom_helper.h:1129
NIMChatRoomOnlineState state_
成员是否处于在线状态, 仅特殊成员才可能离线, 对游客/匿名用户而言只能是在线
Definition: nim_chatroom_helper.h:1123
std::string nick_
聊天室内的昵称字段,预留字段, 可从Uinfo中取
Definition: nim_chatroom_helper.h:1115
int type_
成员类型, -2:未设置;-1:受限用户; 0:普通;1:创建者;2:管理员;3:临时用户,非固定成员;4:匿名非注册用户,非云信注册用户
Definition: nim_chatroom_helper.h:1111
NIMChatRoomGuestFlag guest_flag_
是否是普通游客类型,0:不是游客,1:是游客; 游客身份在聊天室中没有持久化, 只有在线时才会有内存状态
Definition: nim_chatroom_helper.h:1125
std::string ext_
开发者扩展字段, 长度限制2k, 必须为可以解析为json的非格式化的字符串
Definition: nim_chatroom_helper.h:1119
int64_t temp_muted_duration_
临时禁言的解除时长,单位秒
Definition: nim_chatroom_helper.h:1139
std::string tags_
聊天室成员登录时指定的 tag 信息
Definition: nim_chatroom_helper.h:1109
std::string notify_tags_
聊天室成员登录时指定的 notify_tags 信息
Definition: nim_chatroom_helper.h:1121
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:1199
ChatRoomMemberInfo()
Definition: nim_chatroom_helper.h:1141
int level_
成员级别: >=0表示用户开发者可以自定义的级别
Definition: nim_chatroom_helper.h:1113
int64_t update_timetag_
固定成员的记录更新时间,用于固定成员列表的排列查询
Definition: nim_chatroom_helper.h:1135
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_chatroom_helper.h:1226
bool is_valid_
记录有效标记位
Definition: nim_chatroom_helper.h:1133
聊天室消息
Definition: nim_chatroom_helper.h:745
int64_t timetag_
消息发送的时间戳(毫秒),服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:752
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:835
std::string msg_body_
文本消息内容(聊天室机器人文本消息)
Definition: nim_chatroom_helper.h:780
std::string from_ext_
发送方身份扩展字段,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:760
ChatRoomMessage()
Definition: nim_chatroom_helper.h:794
std::string from_id_
消息发送者的账号,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:750
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室消息
Definition: nim_chatroom_helper.h:806
std::string local_res_id_
媒体文件ID(客户端)
Definition: nim_chatroom_helper.h:791
int64_t room_id_
消息所属的聊天室id,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:748
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_chatroom_helper.h:862
int32_t sub_type_
消息的子类型,客户端定义,服务器透传
Definition: nim_chatroom_helper.h:785
std::string msg_attach_
消息内容,长度限制2048,json结构, 文本消息和其他消息保持一致
Definition: nim_chatroom_helper.h:776
NIMChatRoomClientType from_client_type_
消息发送方客户端类型,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:754
ChatRoomMessageSetting msg_setting_
消息属性设置
Definition: nim_chatroom_helper.h:782
std::string notify_tags_
对端发送消息或通知时携带的 notify tags 信息
Definition: nim_chatroom_helper.h:767
std::string anti_spam_res_
String, 易盾反垃圾返回的结果字段
Definition: nim_chatroom_helper.h:770
std::string client_msg_id_
客户端消息id
Definition: nim_chatroom_helper.h:778
std::string local_res_path_
媒体文件本地绝对路径(客户端)
Definition: nim_chatroom_helper.h:789
std::string third_party_callback_ext_
第三方回调回来的自定义扩展字段
Definition: nim_chatroom_helper.h:763
std::string from_nick_
发送方昵称,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:756
std::string from_avatar_
发送方头像,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:758
聊天室消息属性设置
Definition: nim_chatroom_helper.h:650
bool history_save_
(可选)是否存云端消息历史,默认存
Definition: nim_chatroom_helper.h:660
int anti_spam_using_yidun_
(可选) 单条消息是否使用易盾反垃圾 0:(在开通易盾的情况下)不过易盾反垃圾
Definition: nim_chatroom_helper.h:664
std::string anti_spam_bizid_
(可选)用户配置的对某些单条消息另外的反垃圾的业务ID
Definition: nim_chatroom_helper.h:662
void ToJsonValue(nim_cpp_wrapper_util::Json::Value &message) const
组装Json Value字符串
Definition: nim_chatroom_helper.h:694
std::string anti_spam_ext_
(可选)String, 易盾反垃圾扩展字段,限制json,长度限制1024
Definition: nim_chatroom_helper.h:672
std::string yidun_anti_cheating_
(可选)String, 易盾反垃圾增强反作弊专属字段, 限制json,长度限制1024
Definition: nim_chatroom_helper.h:668
int high_priority_
高优先级消息标记,1:是; 非高优先级消息不带该字段,服务器填写,发送方不需要填写
Definition: nim_chatroom_helper.h:666
bool anti_spam_enable_
是否需要过易盾反垃圾
Definition: nim_chatroom_helper.h:656
void ParseMessageSetting(const nim_cpp_wrapper_util::Json::Value &message)
从Json Value解析出消息属性设置
Definition: nim_chatroom_helper.h:718
NIMChatRoomLocation location_
(可选)发送消息时附加的位置信息
Definition: nim_chatroom_helper.h:674
std::string anti_spam_content_
(可选)开发者自定义的反垃圾字段,长度限制2048
Definition: nim_chatroom_helper.h:658
std::list< std::string > to_accids
(可选)消息接受者,如果设置了本字段,且不为空,则本消息为聊天室定向消息(聊天室定向消息不会存历史)
Definition: nim_chatroom_helper.h:676
bool resend_flag_
消息重发标记位
Definition: nim_chatroom_helper.h:652
std::string ext_
第三方扩展字段, 必须为可以解析为json的非格式化的字符串,长度限制4096
Definition: nim_chatroom_helper.h:654
ChatRoomMessageSetting()
Definition: nim_chatroom_helper.h:678
std::string env_config_
(可选) 自定义抄送配置
Definition: nim_chatroom_helper.h:670
聊天室通知
Definition: nim_chatroom_helper.h:422
std::string target_tag_
当通知为聊天室按标签禁言/解禁、聊天室成员标签变更事件才有,代表当前被禁言或变更的 tag 信息
Definition: nim_chatroom_helper.h:447
std::string ToJsonString() const
Definition: nim_chatroom_helper.h:515
bool temp_muted_
当通知为聊天室进入事件才有,代表是否临时禁言状态
Definition: nim_chatroom_helper.h:442
std::string operator_id_
操作者的账号 accid
Definition: nim_chatroom_helper.h:428
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_chatroom_helper.h:545
std::list< std::string > target_nick_
被操作者的账号 nick 列表
Definition: nim_chatroom_helper.h:432
NIMChatRoomNotificationId id_
通知类型
Definition: nim_chatroom_helper.h:424
std::string queue_change_
当通知为聊天室队列变更事件才有,代表变更的内容
Definition: nim_chatroom_helper.h:444
std::string operator_nick_
操作者的账号 nick
Definition: nim_chatroom_helper.h:430
std::string msg_id_
当通知为聊天室撤回消息事件时才有,代表当前被撤回的消息 ID
Definition: nim_chatroom_helper.h:450
int64_t temp_mute_duration_
Definition: nim_chatroom_helper.h:438
ChatRoomNotification()
Definition: nim_chatroom_helper.h:455
std::list< std::string > target_ids_
被操作者的 accid 列表
Definition: nim_chatroom_helper.h:434
std::string ext_
上层开发自定义的事件通知扩展字段, 必须为可以解析为 json 的非格式化的字符串
Definition: nim_chatroom_helper.h:426
void ParseFromJsonValue(const nim_cpp_wrapper_util::Json::Value &values)
从JsonValue中解析得到聊天室通知
Definition: nim_chatroom_helper.h:466
bool muted_
表示是否是被禁言标记
Definition: nim_chatroom_helper.h:440
通知麦序队列中有批量变更,发生在元素提交者离开聊天室或者从聊天室异常掉线时
Definition: nim_chatroom_helper.h:614
std::string value_
队列变更元素的Value
Definition: nim_chatroom_helper.h:620
std::string type_
队列变更类型 OFFER, POLL, DROP
Definition: nim_chatroom_helper.h:616
std::string key_
队列变更元素的Key
Definition: nim_chatroom_helper.h:618
void ParseFromNotification(const ChatRoomNotification &notification)
从聊天室通知中解析得到队列变更具体内容
Definition: nim_chatroom_helper.h:629
std::map< std::string, std::string > changed_values_
队列变更元素的Value
Definition: nim_chatroom_helper.h:622
聊天室队列通知内容
Definition: nim_chatroom_helper.h:590
std::string value_
队列变更元素的Value
Definition: nim_chatroom_helper.h:596
void ParseFromNotification(const ChatRoomNotification &notification)
从聊天室通知中解析得到队列变更具体内容
Definition: nim_chatroom_helper.h:603
std::string type_
队列变更类型 OFFER, POLL, DROP
Definition: nim_chatroom_helper.h:592
std::string key_
队列变更元素的Key
Definition: nim_chatroom_helper.h:594
聊天室麦序队列元素
Definition: nim_chatroom_helper.h:1251
std::string value_
元素的内容,长度限制4096字节
Definition: nim_chatroom_helper.h:1255
std::string key_
元素的UniqKey,长度限制128字节
Definition: nim_chatroom_helper.h:1253
聊天室麦序添加、更新选项
Definition: nim_chatroom_helper.h:572
std::string ToJsonString() const
Definition: nim_chatroom_helper.h:580
ChatRoomQueueOfferOption()
Definition: nim_chatroom_helper.h:578
std::string element_accid_
队列元素所属账号,默认不传表示队列元素属于当前操作人,管理员可以指定队列元素归属于其他合法账号
Definition: nim_chatroom_helper.h:577
bool transient_
true 表示当提交这个新元素的用户从聊天室掉线或退出的时候,需要删除这个元素;默认 false 表示不删除
Definition: nim_chatroom_helper.h:575
设置聊天室成员身份标识参数
Definition: nim_chatroom_helper.h:1070
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_chatroom_helper.h:1088
bool opt_
true:是,false:否
Definition: nim_chatroom_helper.h:1076
std::string account_id_
成员ID
Definition: nim_chatroom_helper.h:1072
std::string notify_ext_
通知的扩展字段, 必须为可以解析为Json的非格式化的字符串
Definition: nim_chatroom_helper.h:1078
int level_
暂时不支持
Definition: nim_chatroom_helper.h:1099
ChatRoomSetMemberAttributeParameters()
Definition: nim_chatroom_helper.h:1081
NIMChatRoomMemberAttribute attribute_
身份标识
Definition: nim_chatroom_helper.h:1074
聊天室更新标签
Definition: nim_chatroom_helper.h:1259
std::string ext_
通知扩展字段
Definition: nim_chatroom_helper.h:1267
std::list< std::string > tags_
标签
Definition: nim_chatroom_helper.h:1261
std::string notify_target_tags_
更新标签的通知的目标标签,是一个标签表达式
Definition: nim_chatroom_helper.h:1263
聊天室退出时的信息
Definition: nim_chatroom_helper.h:1274
NIMChatRoomExitReason code_
enum 退出原因的代码
Definition: nim_chatroom_helper.h:1278
std::string notify_ext_
string 附加信息长度限制2048字节
Definition: nim_chatroom_helper.h:1276
机器人信息
Definition: nim_chatroom_helper.h:1313
std::string GetRobotID() const
Definition: nim_chatroom_helper.h:1343
void SetName(const std::string &name)
Definition: nim_chatroom_helper.h:1322
std::string GetName() const
Definition: nim_chatroom_helper.h:1325
void SetIcon(const std::string &icon)
Definition: nim_chatroom_helper.h:1328
void SetIntro(const std::string &intro)
Definition: nim_chatroom_helper.h:1334
void SetUpdateTime(const uint64_t time)
Definition: nim_chatroom_helper.h:1352
std::string GetIntro() const
Definition: nim_chatroom_helper.h:1337
void SetRobotID(const std::string &id)
Definition: nim_chatroom_helper.h:1340
std::string GetIcon() const
Definition: nim_chatroom_helper.h:1331
void SetAccid(const std::string &accid)
Definition: nim_chatroom_helper.h:1316
std::string GetAccid() const
Definition: nim_chatroom_helper.h:1319
uint64_t GetCreateTime() const
Definition: nim_chatroom_helper.h:1349
uint64_t GetUpdateTime() const
Definition: nim_chatroom_helper.h:1355
void SetCreateTime(const uint64_t time)
Definition: nim_chatroom_helper.h:1346
nim_cpp_wrapper_util::Json::Value robot_info_
Definition: nim_chatroom_helper.h:1358