NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_msg_helper.h
浏览该文件的文档.
1
7#ifndef _NIM_SDK_CPP_MESSAGE_HELPER_H_
8#define _NIM_SDK_CPP_MESSAGE_HELPER_H_
9
10#include <functional>
11#include <list>
12#include <string>
14#include "nim_define_include.h"
16
21namespace nim {
22
26 std::string talk_id_;
28 std::string msg_id_;
34 int64_t msg_timetag_;
38 std::string anti_spam_res_;
39
40 std::string ToJsonString() const {
42 values[kNIMMsgKeyLocalTalkId] = talk_id_;
43 values[kNIMSendAckKeyMsgId] = msg_id_;
44 values[kNIMSendAckKeyMsgIdServer] = msg_id_server_;
45 values[kNIMSendAckKeyRescode] = rescode_;
46 values[kNIMSendAckKeyTimetag] = msg_timetag_;
47 values[kNIMSendAckKeyCallbackExt] = third_party_callback_ext_;
48 values[kNIMSendAckKeyAntiSpamRes] = anti_spam_res_;
49 return nim::GetJsonStringWithNoStyled(values);
50 }
51
54 values[kNIMMsgKeyLocalTalkId] = talk_id_;
55 values[kNIMSendAckKeyMsgId] = msg_id_;
56 values[kNIMSendAckKeyMsgIdServer] = msg_id_server_;
57 values[kNIMSendAckKeyRescode] = rescode_;
58 values[kNIMSendAckKeyTimetag] = msg_timetag_;
59 values[kNIMSendAckKeyCallbackExt] = third_party_callback_ext_;
60 values[kNIMSendAckKeyAntiSpamRes] = anti_spam_res_;
61 return values;
62 }
63};
64
68 std::string from_id_;
70 std::string to_id_;
72 std::string msg_id_;
74 std::string notify_;
76 std::string from_nick_;
78 std::string operator_id_;
90 std::string attach_;
92 std::string callback_ext_;
94 : notify_timetag_(0)
95 , msglog_exist_(true)
96 , msglog_timetag_(0) {}
97};
98
106NIM_SDK_CPPWRAPPER_DLL_API bool ParseRecallMsgNotify(const std::string json_value, RecallMsgNotify& notify);
107
114NIM_SDK_CPPWRAPPER_DLL_API bool ParseRecallMsgNotify(const std::string& notify_json, std::list<RecallMsgNotify>& notifys);
115
122NIM_SDK_CPPWRAPPER_DLL_API bool ParseSendMessageAck(const std::string& arc_json, SendMessageArc& arc);
123
124} // namespace nim
125
126#endif //_NIM_SDK_CPP_MESSAGE_HELPER_H_
Represents a JSON value.
Definition: value.h:196
namespace nim
bool ParseRecallMsgNotify(const nim_cpp_wrapper_util::Json::Value &json_value, RecallMsgNotify &notify)
Definition: nim_msg_helper.cpp:14
bool ParseSendMessageAck(const std::string &arc_json, SendMessageArc &arc)
解析发送消息回执
Definition: nim_msg_helper.cpp:50
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
NIM 公共数据类型定义总的包含文件
JSON辅助方法
NIMMessageFeature
Definition: nim_msglog_def.h:298
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
NIMSessionType
Definition: nim_session_def.h:16
static const char * kNIMSendAckKeyCallbackExt
string,第三方回调回来的自定义扩展字段 v7.8
Definition: nim_talk_def.h:304
static const char * kNIMMsgKeyLocalTalkId
string,会话id,发送方选填,接收方收到的是消息发送方id
Definition: nim_talk_def.h:269
static const char * kNIMSendAckKeyTimetag
long,消息时间戳(毫秒),收到ack包时更新上层缓存的消息时间戳
Definition: nim_talk_def.h:302
static const char * kNIMSendAckKeyAntiSpamRes
string,易盾反垃圾返回的结果字段
Definition: nim_talk_def.h:306
static const char * kNIMSendAckKeyMsgIdServer
long,服务器消息id
Definition: nim_talk_def.h:296
static const char * kNIMSendAckKeyRescode
int,消息错误码(NIMResCode)
Definition: nim_talk_def.h:300
static const char * kNIMSendAckKeyMsgId
string,客户端消息id
Definition: nim_talk_def.h:294
NIMResCode
Definition: public_defines.h:21
#define true
Definition: stdbool.h:30
消息撤回通知
Definition: nim_msg_helper.h:66
int64_t msglog_timetag_
撤回的消息的消息时间戳
Definition: nim_msg_helper.h:88
NIMSessionType session_type_
会话类型
Definition: nim_msg_helper.h:80
std::string to_id_
消息接收方ID
Definition: nim_msg_helper.h:70
std::string notify_
自定义通知文案
Definition: nim_msg_helper.h:74
std::string callback_ext_
v8.2.0 第三方回调返回的字定义字段
Definition: nim_msg_helper.h:92
std::string from_nick_
消息发送方昵称
Definition: nim_msg_helper.h:76
std::string operator_id_
消息的操作者,比哪谁撤消了消息
Definition: nim_msg_helper.h:78
NIMMessageFeature notify_feature_
通知的种类
Definition: nim_msg_helper.h:84
std::string msg_id_
客户端消息ID
Definition: nim_msg_helper.h:72
RecallMsgNotify()
Definition: nim_msg_helper.h:93
std::string attach_
v8.2.0 透传的附件信息
Definition: nim_msg_helper.h:90
bool msglog_exist_
客户端消息本地是否存在
Definition: nim_msg_helper.h:86
std::string from_id_
消息发送方ID
Definition: nim_msg_helper.h:68
int64_t notify_timetag_
通知时间戳
Definition: nim_msg_helper.h:82
发送消息回执
Definition: nim_msg_helper.h:24
std::string ToJsonString() const
Definition: nim_msg_helper.h:40
std::string talk_id_
会话ID
Definition: nim_msg_helper.h:26
NIMResCode rescode_
错误码
Definition: nim_msg_helper.h:32
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
Definition: nim_msg_helper.h:52
std::string anti_spam_res_
易盾反垃圾返回的结果字段
Definition: nim_msg_helper.h:38
int64_t msg_timetag_
消息时间戳
Definition: nim_msg_helper.h:34
std::string msg_id_
消息ID
Definition: nim_msg_helper.h:28
std::string third_party_callback_ext_
第三方回调回来的自定义扩展字段
Definition: nim_msg_helper.h:36
uint64_t msg_id_server_
消息服务器ID
Definition: nim_msg_helper.h:30