NIM SDK API  8.5.0
nim_cpp_session.h
Go to the documentation of this file.
1 
7 #ifndef _NIM_SDK_CPP_SESSION_H_
8 #define _NIM_SDK_CPP_SESSION_H_
9 
10 #include <functional>
11 #include <string>
14 #include "nim_cpp_wrapper/nim_sdk_cpp_wrapper.h"
19 namespace nim {
20 
25 class NIM_SDK_CPPWRAPPER_DLL_API Session {
26 public:
27  typedef std::function<int32_t(const std::string&)> BadgeCountCallback;
28  typedef std::function<void(nim::NIMResCode, const SessionData&, int)> ChangeCallback;
29  typedef std::function<void(int, const SessionDataList&)> QuerySessionListCallabck;
33  typedef std::function<void(nim::NIMResCode, const std::list<SessionData>& session_data_list, int unread_count)>
35  typedef std::function<void(nim::NIMResCode, const SessionData&)> QuerySessionDataCallback;
36  typedef std::function<void(const StickTopSession&)> SetToStickTopSessionNotifyCallback;
37  typedef std::function<void(const std::string& session_id, nim::NIMSessionType)>
39  typedef std::function<void(const StickTopSession&)> UpdateStickTopSessionNotifyCallback;
40  typedef std::function<void(nim::NIMResCode, const StickTopSession&)> SetToStickTopSessionCallback;
41  typedef std::function<void(nim::NIMResCode, const std::string& session_id, nim::NIMSessionType)>
43  typedef std::function<void(nim::NIMResCode, const StickTopSession&)> UpdateStickTopSessionCallback;
44  typedef std::function<void(nim::NIMResCode, const StickTopSessionList&)> QueryStickTopSessionListCallback;
46  typedef std::function<void(nim::NIMResCode, const SessionRoamMsgHasMoreTagInfo& info)>
48  typedef std::function<void(nim::NIMResCode, const std::list<SessionRoamMsgHasMoreTagInfo>& info_list)>
50  typedef std::function<void(nim::NIMResCode)> UpdateHasmoreRoammsgCallback;
51  typedef std::function<void(nim::NIMResCode)> DeleteHasmoreRoammsgCallback;
52  typedef std::function<void(nim::NIMResCode, nim::NIMSessionType, const std::string& session_id)>
61  static void RegChangeCb(const ChangeCallback& cb, const std::string& json_extension = "");
62 
70  static void RegBadgeCountCb(const BadgeCountCallback& cb, const std::string& json_extension = "");
71 
79  static void QueryLastFewSessionAsync(int limit, const QuerySessionListCallabck& cb, const std::string& json_extension = "");
80 
87  static void QueryAllRecentSessionAsync(const QuerySessionListCallabck& cb, const std::string& json_extension = "");
88 
98  static void QueryAllRecentSessionAsync(NIMMessageType last_msg_excluded_type,
99  const QuerySessionListCallabck& cb,
100  const std::string& json_extension = "");
101 
111  static void QueryAllRecentSessionAsyncEx(const std::list<NIMMessageType>& last_msg_excluded_type,
112  const QuerySessionListCallabck& cb,
113  const std::string& json_extension = "");
114 
128  static bool DeleteRecentSession(nim::NIMSessionType to_type,
129  const std::string& id,
130  const DeleteRecentSessionCallabck& cb,
131  const std::string& json_extension = "");
132 
146  static bool DeleteRecentSessionEx(nim::NIMSessionType to_type, const std::string& id, const DeleteRecentSessionCallabck& cb, bool delete_roaming);
147 
161  static bool DeleteSessionRoamingMessage(nim::NIMSessionType to_type,
162  const std::string& id,
164  const std::string& json_extension = "");
165 
174  static void DeleteAllRecentSession(const DeleteAllRecentSessionCallabck& cb, const std::string& json_extension = "");
175 
189  static bool SetUnreadCountZeroAsync(nim::NIMSessionType to_type,
190  const std::string& id,
191  const SetUnreadCountZeroCallback& cb,
192  const std::string& json_extension = "");
193 
205  static bool SetMultiUnreadCountZeroAsync(bool super_team,
206  const std::list<MultiUnreadCountZeroInfo>& unread_zero_info_list,
208 
224  static bool SetSessionTop(enum NIMSessionType to_type,
225  const std::string& id,
226  bool top,
227  const ChangeCallback& cb,
228  const std::string& json_extension = "");
229 
245  static bool SetSessionExtendData(enum NIMSessionType to_type,
246  const std::string& id,
247  const std::string& data,
248  const ChangeCallback& cb,
249  const std::string& json_extension = "");
250 
259  static bool SetAllUnreadCountZeroAsync(const SetUnreadCountZeroCallback& cb, const std::string& json_extension = "");
260 
274  static void QuerySessionDataById(NIMSessionType to_type,
275  const std::string& id,
276  const QuerySessionDataCallback& cb,
277  const std::string& json_extension = "");
278 
284  static void RegSetToStickTopSessionNotifyCB(const SetToStickTopSessionNotifyCallback& cb);
285 
291  static void RegCancelStickTopSessionNotifyCB(const CancelStickTopSessionNotifyCallback& cb);
292 
298  static void RegUpdateStickTopSessionNotifyCB(const UpdateStickTopSessionNotifyCallback& cb);
299 
307  static void QueryStickTopSessionList(const QueryStickTopSessionListCallback& cb);
308 
322  static void SetToStickTopSession(const std::string& session_id,
323  nim::NIMSessionType to_type,
324  const std::string& ext,
325  const SetToStickTopSessionCallback& cb);
326 
340  static void UpdateToStickTopSession(const std::string& session_id,
341  nim::NIMSessionType to_type,
342  const std::string& ext,
344 
354  static void CancelToStickTopSession(const std::string& session_id, nim::NIMSessionType to_type, const CancelStickTopSessionCallback& cb);
355 
365  static void QueryHasmoreRoammsg(const std::string& session_id, nim::NIMSessionType to_type, const QueryHasmoreRoammsgCallback& cb);
366 
372  static void QueryAllHasmoreRoammsg(const QueryAllHasmoreRoammsgCallback& cb);
373 
380  static void UpdateHasmoreRoammsg(const IMMessage& msg, const UpdateHasmoreRoammsgCallback& cb);
381 
389  static void DeleteHasmoreRoammsg(const std::string& session_id, nim::NIMSessionType to_type, const DeleteHasmoreRoammsgCallback& cb);
390 
395  static void UnregSessionCb();
396 };
397 
398 } // namespace nim
399 
400 #endif //_NIM_SDK_CPP_SESSION_H_
nim::Session::QueryAllHasmoreRoammsgCallback
std::function< void(nim::NIMResCode, const std::list< SessionRoamMsgHasMoreTagInfo > &info_list)> QueryAllHasmoreRoammsgCallback
Definition: nim_cpp_session.h:49
nim::Session::CancelStickTopSessionCallback
std::function< void(nim::NIMResCode, const std::string &session_id, nim::NIMSessionType)> CancelStickTopSessionCallback
Definition: nim_cpp_session.h:42
nim::Session::CancelStickTopSessionNotifyCallback
std::function< void(const std::string &session_id, nim::NIMSessionType)> CancelStickTopSessionNotifyCallback
Definition: nim_cpp_session.h:38
nim::Session::UpdateStickTopSessionCallback
std::function< void(nim::NIMResCode, const StickTopSession &)> UpdateStickTopSessionCallback
Definition: nim_cpp_session.h:43
nim::Session::DeleteRecentSessionCallabck
ChangeCallback DeleteRecentSessionCallabck
Definition: nim_cpp_session.h:30
nim::Session::ChangeCallback
std::function< void(nim::NIMResCode, const SessionData &, int)> ChangeCallback
Definition: nim_cpp_session.h:28
nim_talk_helper.h
Talk 辅助方法和数据结构定义
nim::SessionDataList
会话列表数据
Definition: nim_session_helper.h:79
nim::Session::QuerySessionListCallabck
std::function< void(int, const SessionDataList &)> QuerySessionListCallabck
Definition: nim_cpp_session.h:29
nim
namespace nim
nim::Session::BadgeCountCallback
std::function< int32_t(const std::string &)> BadgeCountCallback
Definition: nim_cpp_session.h:27
nim::Session::SetUnreadCountZeroCallback
ChangeCallback SetUnreadCountZeroCallback
Definition: nim_cpp_session.h:32
nim::Session::DeleteSessionRoammsgCallback
std::function< void(nim::NIMResCode, nim::NIMSessionType, const std::string &session_id)> DeleteSessionRoammsgCallback
Definition: nim_cpp_session.h:53
nim::Session::DeleteAllRecentSessionCallabck
ChangeCallback DeleteAllRecentSessionCallabck
Definition: nim_cpp_session.h:31
nim::Session::SetToStickTopSessionCallback
std::function< void(nim::NIMResCode, const StickTopSession &)> SetToStickTopSessionCallback
Definition: nim_cpp_session.h:40
nim::Session::SetToStickTopSessionNotifyCallback
std::function< void(const StickTopSession &)> SetToStickTopSessionNotifyCallback
Definition: nim_cpp_session.h:36
nim_session_helper.h
Session 辅助方法和数据结构定义
nim::Session::UpdateHasmoreRoammsgCallback
std::function< void(nim::NIMResCode)> UpdateHasmoreRoammsgCallback
Definition: nim_cpp_session.h:50
nim::Session::QueryHasmoreRoammsgCallback
std::function< void(nim::NIMResCode, const SessionRoamMsgHasMoreTagInfo &info)> QueryHasmoreRoammsgCallback
Definition: nim_cpp_session.h:47
nim::Session::QueryStickTopSessionListCallback
std::function< void(nim::NIMResCode, const StickTopSessionList &)> QueryStickTopSessionListCallback
Definition: nim_cpp_session.h:44
nim::Session::DeleteHasmoreRoammsgCallback
std::function< void(nim::NIMResCode)> DeleteHasmoreRoammsgCallback
Definition: nim_cpp_session.h:51
nim::Session::UpdateStickTopSessionNotifyCallback
std::function< void(const StickTopSession &)> UpdateStickTopSessionNotifyCallback
Definition: nim_cpp_session.h:39
nim::StickTopSession
Definition: nim_session_helper.h:89
nim::Session::QuerySessionDataCallback
std::function< void(nim::NIMResCode, const SessionData &)> QuerySessionDataCallback
Definition: nim_cpp_session.h:35
nim::Session::SetMultiUnreadCountZeroCallback
std::function< void(nim::NIMResCode, const std::list< SessionData > &session_data_list, int unread_count)> SetMultiUnreadCountZeroCallback
Definition: nim_cpp_session.h:34
nim::Session
会话列表管理功能;主要包括查询会话列表、删除会话列表等功能
Definition: nim_cpp_session.h:25
nim::StickTopSessionList
Definition: nim_session_helper.h:100
nim::IMMessage
Definition: nim_talk_helper.h:232
nim::SessionData
会话数据
Definition: nim_session_helper.h:43