NIM SDK API  8.5.1
nim_session_helper.h
Go to the documentation of this file.
1 
7 #ifndef _NIM_SDK_CPP_SESSION_HELPER_H_
8 #define _NIM_SDK_CPP_SESSION_HELPER_H_
9 
10 #include <functional>
11 #include <list>
12 #include <string>
13 #include "nim_define_include.h"
15 #include "nim_wrapper_util/nim_json_util.h"
20 namespace nim {
22 struct NIM_SDK_CPPWRAPPER_DLL_API StickTopSessionInfo {
23  bool top_;
24  std::string id_;
25  NIMSessionType type_;
26  std::string ext_;
27  int64_t create_time_;
28  int64_t update_time_;
31  : top_(false)
32  , id_("")
33  , type_(NIMSessionType::kNIMSessionTypeP2P)
34  , ext_("")
35  , create_time_(0)
36  , update_time_(0) {}
37 
38  static std::string ToJsonString(const StickTopSessionInfo& stickTopSessionInfo);
39  static void ToJsonObject(const StickTopSessionInfo& stickTopSessionInfo, nim_cpp_wrapper_util::Json::Value& value);
40 };
41 
43 struct NIM_SDK_CPPWRAPPER_DLL_API SessionData {
44  std::string id_;
45  NIMSessionType type_;
47  NIMSessionCommand command_;
48  std::string msg_id_;
49  std::string msg_sender_accid_;
50  int64_t msg_timetag_;
51  NIMMessageType msg_type_;
52  std::string msg_content_;
53  std::string msg_attach_;
54  NIMMsgLogStatus msg_status_;
55  NIMMsgLogSubStatus msg_sub_status_;
58  std::string extend_data_;
63  : unread_count_(0)
64  , msg_timetag_(0)
65  , type_(kNIMSessionTypeP2P)
66  , command_(kNIMSessionCommandAdd)
67  , msg_type_(kNIMMessageTypeUnknown)
68  , msg_status_(kNIMMsgLogStatusNone)
69  , msg_sub_status_(kNIMMsgLogSubStatusNone)
70  , last_updated_msg_(true)
71  , placed_on_top_(false)
72  , is_robot_session_(false) {}
73 
74  static std::string ToJsonString(const SessionData& sessionData);
75  static void ToJsonObject(const SessionData& sessionData, nim_cpp_wrapper_util::Json::Value& value);
76 };
77 
79 struct NIM_SDK_CPPWRAPPER_DLL_API SessionDataList {
80  int count_;
82  std::list<SessionData> sessions_;
85  : count_(0)
86  , unread_count_(0) {}
87  static std::string ToJsonString(const SessionDataList& sessionData);
88 };
89 struct NIM_SDK_CPPWRAPPER_DLL_API StickTopSession {
92  static std::string ToJsonString(const StickTopSession& stick_session);
93  static void ToJsonObject(const StickTopSession& stick_session, nim_cpp_wrapper_util::Json::Value& value);
94 };
95 
96 struct NIM_SDK_CPPWRAPPER_DLL_API MultiUnreadCountZeroInfo {
97  std::string id_;
98  NIMSessionType type_;
99 };
100 struct NIM_SDK_CPPWRAPPER_DLL_API StickTopSessionList {
101  std::list<StickTopSession> sessions_;
102  static std::string ToJsonString(const StickTopSessionList& stick_session_list);
103 };
110 NIM_SDK_CPPWRAPPER_DLL_API bool ParseSession(const std::string& session_json, SessionData& session);
111 
118 NIM_SDK_CPPWRAPPER_DLL_API void ParseSession(const nim_cpp_wrapper_util::Json::Value& session_json, SessionData& session);
119 
126 NIM_SDK_CPPWRAPPER_DLL_API bool ParseSessionList(const std::string& sessions_json, SessionDataList& session_list);
127 
134 NIM_SDK_CPPWRAPPER_DLL_API bool ParseStickTopSession(const std::string& session_json, StickTopSession& session);
135 
142 NIM_SDK_CPPWRAPPER_DLL_API void ParseStickTopSession(const nim_cpp_wrapper_util::Json::Value& session_json, StickTopSession& session);
143 
150 NIM_SDK_CPPWRAPPER_DLL_API bool ParseStickTopSessionList(const std::string& sessions_json, StickTopSessionList& stick_top_session_list);
151 
152 } // namespace nim
153 
154 #endif //_NIM_SDK_CPP_SESSION_HELPER_H_
nim::StickTopSessionInfo::type_
NIMSessionType type_
Definition: nim_session_helper.h:25
nim::SessionData::msg_content_
std::string msg_content_
Definition: nim_session_helper.h:52
nim::SessionData::placed_on_top_
bool placed_on_top_
Definition: nim_session_helper.h:57
nim::StickTopSessionInfo::id_
std::string id_
Definition: nim_session_helper.h:24
nim::StickTopSessionInfo::ext_
std::string ext_
Definition: nim_session_helper.h:26
nim::ParseStickTopSessionList
NIM_SDK_CPPWRAPPER_DLL_API bool ParseStickTopSessionList(const std::string &sessions_json, StickTopSessionList &stick_top_session_list)
解析置顶会话列表信息
nim::SessionData::msg_timetag_
int64_t msg_timetag_
Definition: nim_session_helper.h:50
nim::ParseStickTopSession
NIM_SDK_CPPWRAPPER_DLL_API bool ParseStickTopSession(const std::string &session_json, StickTopSession &session)
解析置顶会话信息
nim::MultiUnreadCountZeroInfo::type_
NIMSessionType type_
Definition: nim_session_helper.h:98
nim::SessionDataList::count_
int count_
Definition: nim_session_helper.h:80
nim::SessionData::msg_sub_status_
NIMMsgLogSubStatus msg_sub_status_
Definition: nim_session_helper.h:55
nim::MultiUnreadCountZeroInfo
Definition: nim_session_helper.h:96
nim::SessionData::msg_id_
std::string msg_id_
Definition: nim_session_helper.h:48
nim::StickTopSessionInfo::StickTopSessionInfo
StickTopSessionInfo()
Definition: nim_session_helper.h:30
nim::ParseSessionList
NIM_SDK_CPPWRAPPER_DLL_API bool ParseSessionList(const std::string &sessions_json, SessionDataList &session_list)
解析会话列表信息
nim::SessionDataList::unread_count_
int unread_count_
Definition: nim_session_helper.h:81
nim::SessionData::msg_type_
NIMMessageType msg_type_
Definition: nim_session_helper.h:51
nim::StickTopSession::stick_top_info_
StickTopSessionInfo stick_top_info_
Definition: nim_session_helper.h:90
nim::SessionData::command_
NIMSessionCommand command_
Definition: nim_session_helper.h:47
nim::SessionDataList
会话列表数据
Definition: nim_session_helper.h:79
nim::MultiUnreadCountZeroInfo::id_
std::string id_
Definition: nim_session_helper.h:97
nim::SessionData::extend_data_
std::string extend_data_
Definition: nim_session_helper.h:58
nim::SessionData::last_updated_msg_
bool last_updated_msg_
Definition: nim_session_helper.h:56
nim::SessionData::msg_sender_accid_
std::string msg_sender_accid_
Definition: nim_session_helper.h:49
nim::SessionDataList::sessions_
std::list< SessionData > sessions_
Definition: nim_session_helper.h:82
nim
namespace nim
nim::StickTopSessionList::sessions_
std::list< StickTopSession > sessions_
Definition: nim_session_helper.h:101
nim::SessionData::stick_top_info_
StickTopSessionInfo stick_top_info_
Definition: nim_session_helper.h:60
nim::SessionData::msg_attach_
std::string msg_attach_
Definition: nim_session_helper.h:53
nim::ParseSession
NIM_SDK_CPPWRAPPER_DLL_API bool ParseSession(const std::string &session_json, SessionData &session)
解析会话信息
nim::StickTopSessionInfo
会话数据
Definition: nim_session_helper.h:22
nim::SessionData::SessionData
SessionData()
Definition: nim_session_helper.h:62
nim::SessionData::unread_count_
int unread_count_
Definition: nim_session_helper.h:46
nim::StickTopSessionInfo::update_time_
int64_t update_time_
Definition: nim_session_helper.h:28
nim::SessionData::msg_status_
NIMMsgLogStatus msg_status_
Definition: nim_session_helper.h:54
nim::StickTopSessionInfo::create_time_
int64_t create_time_
Definition: nim_session_helper.h:27
nim::StickTopSessionInfo::top_
bool top_
Definition: nim_session_helper.h:23
nim::SessionData::is_robot_session_
bool is_robot_session_
Definition: nim_session_helper.h:59
nim::SessionData::id_
std::string id_
Definition: nim_session_helper.h:44
nim::StickTopSession
Definition: nim_session_helper.h:89
nim::StickTopSessionList
Definition: nim_session_helper.h:100
nim_sdk_cpp_wrapper.h
定义导出宏
nim::SessionData::type_
NIMSessionType type_
Definition: nim_session_helper.h:45
nim::StickTopSession::session_data_
SessionData session_data_
Definition: nim_session_helper.h:91
nim::SessionData
会话数据
Definition: nim_session_helper.h:43