NIM PC Cross Platform SDK
nim_msg_helper.h
Go to the documentation of this file.
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
24struct NIM_SDK_CPPWRAPPER_DLL_API SendMessageArc {
26 std::string talk_id_;
28 std::string msg_id_;
32 int64_t msg_timetag_;
36 std::string anti_spam_res_;
37
38 std::string ToJsonString() const {
40 values[kNIMMsgKeyLocalTalkId] = talk_id_;
41 values[kNIMSendAckKeyMsgId] = msg_id_;
42 values[kNIMSendAckKeyRescode] = rescode_;
43 values[kNIMSendAckKeyTimetag] = msg_timetag_;
44 values[kNIMSendAckKeyCallbackExt] = third_party_callback_ext_;
45 values[kNIMSendAckKeyAntiSpamRes] = anti_spam_res_;
46 return nim::GetJsonStringWithNoStyled(values);
47 }
48
49 nim_cpp_wrapper_util::Json::Value ToJsonObject() const {
51 values[kNIMMsgKeyLocalTalkId] = talk_id_;
52 values[kNIMSendAckKeyMsgId] = msg_id_;
53 values[kNIMSendAckKeyRescode] = rescode_;
54 values[kNIMSendAckKeyTimetag] = msg_timetag_;
55 values[kNIMSendAckKeyCallbackExt] = third_party_callback_ext_;
56 values[kNIMSendAckKeyAntiSpamRes] = anti_spam_res_;
57 return values;
58 }
59};
60
62struct NIM_SDK_CPPWRAPPER_DLL_API RecallMsgNotify {
64 std::string from_id_;
66 std::string to_id_;
68 std::string msg_id_;
70 std::string notify_;
72 std::string from_nick_;
74 std::string operator_id_;
86 std::string attach_;
88 std::string callback_ext_;
90 : notify_timetag_(0)
91 , msglog_exist_(true)
92 , msglog_timetag_(0) {}
93};
94
102NIM_SDK_CPPWRAPPER_DLL_API bool ParseRecallMsgNotify(const std::string json_value, RecallMsgNotify& notify);
103
110NIM_SDK_CPPWRAPPER_DLL_API bool ParseRecallMsgNotify(const std::string& notify_json, std::list<RecallMsgNotify>& notifys);
111
118NIM_SDK_CPPWRAPPER_DLL_API bool ParseSendMessageAck(const std::string& arc_json, SendMessageArc& arc);
119
120} // namespace nim
121
122#endif //_NIM_SDK_CPP_MESSAGE_HELPER_H_
Represents a JSON value.
Definition: value.h:196
namespace nim
bool ParseSendMessageAck(const std::string &arc_json, SendMessageArc &arc)
解析发送消息回执
Definition: nim_msg_helper.cpp:51
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
NIMResCode
Definition: nim_chatroom_res_code_def.h:15
NIM 公共数据类型定义总的包含文件
JSON辅助方法
NIMMessageFeature
Definition: nim_msglog_def.h:298
定义导出宏
NIMSessionType
Definition: nim_session_def.h:16
static const char * kNIMSendAckKeyCallbackExt
string,第三方回调回来的自定义扩展字段 v7.8
Definition: nim_talk_def.h:280
static const char * kNIMMsgKeyLocalTalkId
string,会话id,发送方选填,接收方收到的是消息发送方id
Definition: nim_talk_def.h:257
static const char * kNIMSendAckKeyTimetag
long,消息时间戳(毫秒),收到ack包时更新上层缓存的消息时间戳
Definition: nim_talk_def.h:278
static const char * kNIMSendAckKeyAntiSpamRes
string,易盾反垃圾返回的结果字段
Definition: nim_talk_def.h:282
static const char * kNIMSendAckKeyRescode
int,消息错误码(NIMResCode)
Definition: nim_talk_def.h:276
static const char * kNIMSendAckKeyMsgId
string,客户端消息id
Definition: nim_talk_def.h:272
消息撤回通知
Definition: nim_msg_helper.h:62
int64_t msglog_timetag_
撤回的消息的消息时间戳
Definition: nim_msg_helper.h:84
NIMSessionType session_type_
会话类型
Definition: nim_msg_helper.h:76
std::string to_id_
消息接收方ID
Definition: nim_msg_helper.h:66
std::string notify_
自定义通知文案
Definition: nim_msg_helper.h:70
std::string callback_ext_
v8.2.0 第三方回调返回的字定义字段
Definition: nim_msg_helper.h:88
std::string from_nick_
消息发送方昵称
Definition: nim_msg_helper.h:72
std::string operator_id_
消息的操作者,比哪谁撤消了消息
Definition: nim_msg_helper.h:74
NIMMessageFeature notify_feature_
通知的种类
Definition: nim_msg_helper.h:80
std::string msg_id_
客户端消息ID
Definition: nim_msg_helper.h:68
std::string attach_
v8.2.0 透传的附件信息
Definition: nim_msg_helper.h:86
bool msglog_exist_
客户端消息本地是否存在
Definition: nim_msg_helper.h:82
std::string from_id_
消息发送方ID
Definition: nim_msg_helper.h:64
int64_t notify_timetag_
通知时间戳
Definition: nim_msg_helper.h:78
发送消息回执
Definition: nim_msg_helper.h:24
std::string talk_id_
会话ID
Definition: nim_msg_helper.h:26
NIMResCode rescode_
错误码
Definition: nim_msg_helper.h:30
std::string anti_spam_res_
易盾反垃圾返回的结果字段
Definition: nim_msg_helper.h:36
int64_t msg_timetag_
消息时间戳
Definition: nim_msg_helper.h:32
std::string msg_id_
消息ID
Definition: nim_msg_helper.h:28
std::string third_party_callback_ext_
第三方回调回来的自定义扩展字段
Definition: nim_msg_helper.h:34