NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_session_online_service_helper.h
浏览该文件的文档.
1
7#ifndef _NIM_CPP_SESSION_ONLINE_SERVICE_HELPER_H_
8#define _NIM_CPP_SESSION_ONLINE_SERVICE_HELPER_H_
9
10#include <functional>
11#include <list>
12#include <string>
16#include "nim_define_include.h"
22namespace nim {
24public:
28 : last_message_("")
29 , last_message_type_(0) {}
31 std::string id_;
35 std::string ext_;
37 std::string last_message_;
39 uint64_t update_time_{0};
42 // 返回普通消息 auto last_msg = SessionInfo.GetLastMessage<0>();
43 template <int type>
44 auto GetLastMessage() const -> typename std::enable_if<type == 0, IMMessage>::type {
45 IMMessage msg;
46 ParseReceiveMessage(last_message_, msg);
47 return msg;
48 }
49 // 返回消息撤回通知auto last_msg = SessionInfo.GetLastMessage<1>();
50 template <int type>
51 auto GetLastMessage() const -> typename std::enable_if<type == 1, RecallMsgNotify>::type {
52 RecallMsgNotify recall_notify_msg;
53 ParseRecallMsgNotify(last_message_, recall_notify_msg);
54 return recall_notify_msg;
55 }
56 };
58 typedef std::list<SessionInfo> SessionList;
59
68 };
70 void AddSession(nim::NIMSessionType /*to_type */, std::string /*session_id */);
72 std::list<std::pair<nim::NIMSessionType /*to_type */, std::string /*session_id */>> delete_list_;
73 };
80 static bool ParseSessionInfo(const std::string& session_json, SessionInfo& session);
81
88 static bool ParseQuerySessionListResult(const std::string& sessions_json, QuerySessionListResult& result);
89
95 static std::string DeleteSessionParamToJsonString(const DeleteSessionParam& param);
96};
97} // namespace nim
98
99#endif //_NIM_CPP_SESSION_ONLINE_SERVICE_HELPER_H_
Definition: nim_session_online_service_helper.h:23
std::list< SessionInfo > SessionList
会话列表
Definition: nim_session_online_service_helper.h:58
namespace nim
bool ParseRecallMsgNotify(const nim_cpp_wrapper_util::Json::Value &json_value, RecallMsgNotify &notify)
Definition: nim_msg_helper.cpp:14
NIM 公共数据类型定义总的包含文件
JSON辅助方法
Message 通用辅助方法和数据结构定义
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
NIMSessionType
Definition: nim_session_def.h:16
Talk 辅助方法和数据结构定义
NIMResCode
Definition: public_defines.h:21
Definition: nim_talk_helper.h:305
消息撤回通知
Definition: nim_msg_helper.h:66
Definition: nim_session_online_service_helper.h:69
std::list< std::pair< nim::NIMSessionType, std::string > > delete_list_
list 要删除的会话
Definition: nim_session_online_service_helper.h:72
会话服务 查询会话列表应答数据定义
Definition: nim_session_online_service_helper.h:61
bool has_more_
是否还有会话数据
Definition: nim_session_online_service_helper.h:67
SessionList session_list_
会话列表
Definition: nim_session_online_service_helper.h:65
NIMResCode res_code
返回的错误码 成功:200
Definition: nim_session_online_service_helper.h:63
会话服务 会话数据定义
Definition: nim_session_online_service_helper.h:26
auto GetLastMessage() const -> typename std::enable_if< type==1, RecallMsgNotify >::type
Definition: nim_session_online_service_helper.h:51
SessionInfo()
Definition: nim_session_online_service_helper.h:27
auto GetLastMessage() const -> typename std::enable_if< type==0
int last_message_type_
最后一条消息的类型 0表示普通消息,1表示消息撤回通知
Definition: nim_session_online_service_helper.h:41
NIMSessionType type_
会话类型
Definition: nim_session_online_service_helper.h:33
std::string id_
会话ID
Definition: nim_session_online_service_helper.h:31
return msg
Definition: nim_session_online_service_helper.h:47
std::string ext_
自定的扩展字段
Definition: nim_session_online_service_helper.h:35
std::string last_message_
最后一条会话 json string
Definition: nim_session_online_service_helper.h:37