NIM PC Cross Platform SDK
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>
19namespace nim {
20
26class NIM_SDK_CPPWRAPPER_DLL_API Session {
27public:
29 typedef std::function<int32_t(const std::string&)> BadgeCountCallback;
31 typedef std::function<void(nim::NIMResCode, const SessionData&, int)> ChangeCallback;
33 typedef std::function<void(int, const SessionDataList&)> QuerySessionListCallabck;
40 typedef std::function<void(nim::NIMResCode, const std::list<SessionData>& session_data_list, int unread_count)>
44 typedef std::function<void(nim::NIMResCode, const SessionData&)> QuerySessionDataCallback;
46 typedef std::function<void(const StickTopSession&)> SetToStickTopSessionNotifyCallback;
47 typedef std::function<void(const std::string& session_id, nim::NIMSessionType)>
51 typedef std::function<void(const StickTopSession&)> UpdateStickTopSessionNotifyCallback;
53 typedef std::function<void(nim::NIMResCode, const StickTopSession&)> SetToStickTopSessionCallback;
54 typedef std::function<void(nim::NIMResCode, const std::string& session_id, nim::NIMSessionType)>
61
62 typedef std::function<void(nim::NIMResCode, const SessionRoamMsgHasMoreTagInfo& info)>
65 typedef std::function<void(nim::NIMResCode, const std::list<SessionRoamMsgHasMoreTagInfo>& info_list)>
69 typedef std::function<void(nim::NIMResCode)> UpdateHasmoreRoammsgCallback;
71 typedef std::function<void(nim::NIMResCode)> DeleteHasmoreRoammsgCallback;
72 typedef std::function<void(nim::NIMResCode, nim::NIMSessionType, const std::string& session_id)>
82 static void RegChangeCb(const ChangeCallback& cb, const std::string& json_extension = "");
83
91 static void RegBadgeCountCb(const BadgeCountCallback& cb, const std::string& json_extension = "");
92
100 static void QueryLastFewSessionAsync(int limit, const QuerySessionListCallabck& cb, const std::string& json_extension = "");
101
108 static void QueryAllRecentSessionAsync(const QuerySessionListCallabck& cb, const std::string& json_extension = "");
109
119 static void QueryAllRecentSessionAsnc(NIMMessageType last_msg_excluded_type,
120 const QuerySessionListCallabck& cb,
121 const std::string& json_extension = "");
122
132 static void QueryAllRecentSessionAsyncEx(const std::list<NIMMessageType>& last_msg_excluded_type,
133 const QuerySessionListCallabck& cb,
134 const std::string& json_extension = "");
135
149 static bool DeleteRecentSession(nim::NIMSessionType to_type,
150 const std::string& id,
152 const std::string& json_extension = "");
153
167 static bool DeleteRecentSessionEx(nim::NIMSessionType to_type, const std::string& id, const DeleteRecentSessionCallabck& cb, bool delete_roaming);
168
182 static bool DeleteSessionRoamingMessage(nim::NIMSessionType to_type,
183 const std::string& id,
185 const std::string& json_extension = "");
186
195 static void DeleteAllRecentSession(const DeleteAllRecentSessionCallabck& cb, const std::string& json_extension = "");
196
210 static bool SetUnreadCountZeroAsync(nim::NIMSessionType to_type,
211 const std::string& id,
213 const std::string& json_extension = "");
214
226 static bool SetMultiUnreadCountZeroAsync(bool super_team,
227 const std::list<MultiUnreadCountZeroInfo>& unread_zero_info_list,
229
245 static bool SetSessionTop(enum NIMSessionType to_type,
246 const std::string& id,
247 bool top,
248 const ChangeCallback& cb,
249 const std::string& json_extension = "");
250
266 static bool SetSessionExtendData(enum NIMSessionType to_type,
267 const std::string& id,
268 const std::string& data,
269 const ChangeCallback& cb,
270 const std::string& json_extension = "");
271
280 static bool SetAllUnreadCountZeroAsync(const SetUnreadCountZeroCallback& cb, const std::string& json_extension = "");
281
295 static void QuerySessionDataById(NIMSessionType to_type,
296 const std::string& id,
297 const QuerySessionDataCallback& cb,
298 const std::string& json_extension = "");
299
305 static void RegSetToStickTopSessionNotifyCB(const SetToStickTopSessionNotifyCallback& cb);
306
312 static void RegCancelStickTopSessionNotifyCB(const CancelStickTopSessionNotifyCallback& cb);
313
319 static void RegUpdateStickTopSessionNotifyCB(const UpdateStickTopSessionNotifyCallback& cb);
320
328 static void QueryStickTopSessionList(const QueryStickTopSessionListCallback& cb);
329
343 static void SetToStickTopSession(const std::string& session_id,
344 nim::NIMSessionType to_type,
345 const std::string& ext,
347
361 static void UpdateToStickTopSession(const std::string& session_id,
362 nim::NIMSessionType to_type,
363 const std::string& ext,
365
375 static void CancelToStickTopSession(const std::string& session_id, nim::NIMSessionType to_type, const CancelStickTopSessionCallback& cb);
376
386 static void QueryHasmoreRoammsg(const std::string& session_id, nim::NIMSessionType to_type, const QueryHasmoreRoammsgCallback& cb);
387
393 static void QueryAllHasmoreRoammsg(const QueryAllHasmoreRoammsgCallback& cb);
394
401 static void UpdateHasmoreRoammsg(const IMMessage& msg, const UpdateHasmoreRoammsgCallback& cb);
402
410 static void DeleteHasmoreRoammsg(const std::string& session_id, nim::NIMSessionType to_type, const DeleteHasmoreRoammsgCallback& cb);
411
416 static void UnregSessionCb();
417};
418
419} // namespace nim
420
421#endif //_NIM_SDK_CPP_SESSION_H_
会话列表管理功能;主要包括查询会话列表、删除会话列表等功能
Definition: nim_cpp_session.h:26
ChangeCallback DeleteAllRecentSessionCallabck
删除全部会话回调模板
Definition: nim_cpp_session.h:37
ChangeCallback SetUnreadCountZeroCallback
会话未读消息数清零回调模板
Definition: nim_cpp_session.h:39
std::function< void(const std::string &session_id, nim::NIMSessionType)> CancelStickTopSessionNotifyCallback
取消置顶会话通知回调模板
Definition: nim_cpp_session.h:49
ChangeCallback DeleteRecentSessionCallabck
删除会话回调模板
Definition: nim_cpp_session.h:35
std::function< void(int, const SessionDataList &)> QuerySessionListCallabck
查询会话列表回调模板
Definition: nim_cpp_session.h:33
std::function< void(const StickTopSession &)> UpdateStickTopSessionNotifyCallback
更新置顶会话通知回调模板
Definition: nim_cpp_session.h:51
std::function< void(nim::NIMResCode, const std::list< SessionData > &session_data_list, int unread_count)> SetMultiUnreadCountZeroCallback
多条会话未读消息数清零回调模板
Definition: nim_cpp_session.h:42
std::function< void(nim::NIMResCode, nim::NIMSessionType, const std::string &session_id)> DeleteSessionRoammsgCallback
删除会话是漫游消息未拉取信息回调模板
Definition: nim_cpp_session.h:74
std::function< int32_t(const std::string &)> BadgeCountCallback
app角标未读计数通知回调模板 (仅iOS有效)
Definition: nim_cpp_session.h:29
std::function< void(nim::NIMResCode, const StickTopSession &)> SetToStickTopSessionCallback
置顶会话回调模板
Definition: nim_cpp_session.h:53
std::function< void(nim::NIMResCode, const StickTopSessionList &)> QueryStickTopSessionListCallback
查询置顶会话列表回调模板
Definition: nim_cpp_session.h:60
std::function< void(nim::NIMResCode)> DeleteHasmoreRoammsgCallback
删除会话是漫游消息未拉取信息回调模板
Definition: nim_cpp_session.h:71
std::function< void(nim::NIMResCode, const StickTopSession &)> UpdateStickTopSessionCallback
更新置顶会话回调模板
Definition: nim_cpp_session.h:58
std::function< void(nim::NIMResCode, const SessionRoamMsgHasMoreTagInfo &info)> QueryHasmoreRoammsgCallback
查询会话是漫游消息未拉取信息回调模板
Definition: nim_cpp_session.h:64
std::function< void(nim::NIMResCode, const std::list< SessionRoamMsgHasMoreTagInfo > &info_list)> QueryAllHasmoreRoammsgCallback
查询所有漫游消息未拉取完全的会话回调模板
Definition: nim_cpp_session.h:67
std::function< void(nim::NIMResCode, const SessionData &)> QuerySessionDataCallback
会话信息查询结果回调模板
Definition: nim_cpp_session.h:44
std::function< void(nim::NIMResCode, const SessionData &, int)> ChangeCallback
会话变更通知回调模板
Definition: nim_cpp_session.h:31
std::function< void(nim::NIMResCode)> UpdateHasmoreRoammsgCallback
更新会话是漫游消息未拉取信息回调模板
Definition: nim_cpp_session.h:69
std::function< void(nim::NIMResCode, const std::string &session_id, nim::NIMSessionType)> CancelStickTopSessionCallback
取消置顶会话回调模板
Definition: nim_cpp_session.h:56
std::function< void(const StickTopSession &)> SetToStickTopSessionNotifyCallback
置顶会话通知回调模板
Definition: nim_cpp_session.h:46
namespace nim
NIMResCode
Definition: nim_chatroom_res_code_def.h:15
NIMMessageType
Definition: nim_msglog_def.h:269
定义导出宏
NIMSessionType
Definition: nim_session_def.h:16
Session 辅助方法和数据结构定义
Talk 辅助方法和数据结构定义
Definition: nim_session_def.h:59
Definition: nim_talk_helper.h:281
会话数据
Definition: nim_session_helper.h:49
会话列表数据
Definition: nim_session_helper.h:102
Definition: nim_session_helper.h:119
Definition: nim_session_helper.h:135