7#ifndef _NIM_SDK_CPP_SYSMSG_HELPER_H_
8#define _NIM_SDK_CPP_SYSMSG_HELPER_H_
65 if (!push_payload_.
empty())
67 if (!push_content_.empty())
71 if (!anti_spam_content_.empty())
73 if (!env_config_.empty())
139 , total_unread_count_(0)
Represents a JSON value.
Definition: value.h:196
bool isMember(const char *key) const
Definition: json_value.cpp:1241
bool isObject() const
Definition: json_value.cpp:1390
bool empty() const
Return true if empty array, empty object, or null; otherwise, false.
Definition: json_value.cpp:908
Int asInt() const
Definition: json_value.cpp:657
String asString() const
Embedded zeroes are possible.
Definition: json_value.cpp:632
bool ParseJsonValue(const std::string &content, nim_cpp_wrapper_util::Json::Value &values)
解析JsonString
Definition: nim_json_util.cpp:70
bool ParseSysMessages(const std::string &sysmsgs_json, std::list< SysMessage > &msgs, int *unread)
解析系统消息或自定义通知
Definition: nim_sysmsg_helper.cpp:28
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
void ParseSysMessageContent(const nim_cpp_wrapper_util::Json::Value &content_json, SysMessage &msg)
解析系统消息或自定义通知的内容
Definition: nim_sysmsg_helper.cpp:45
bool ParseSysMessage(const std::string &sysmsg_json, SysMessage &msg)
解析系统消息或自定义通知
Definition: nim_sysmsg_helper.cpp:12
NIMMessageFeature
Definition: nim_msglog_def.h:337
@ kNIMMessageFeatureDefault
默认
Definition: nim_msglog_def.h:339
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
BoolStatus
Definition: nim_sdk_util.h:22
@ BS_TRUE
true
Definition: nim_sdk_util.h:28
@ BS_NOT_INIT
未初始化
Definition: nim_sdk_util.h:24
@ BS_FALSE
false
Definition: nim_sdk_util.h:26
static const char * kNIMSysMsgKeyMsgId
long 服务器消息id(自定义通知消息,必须填0),发送方不需要填写
Definition: nim_sysmsg_def.h:130
static const char * kNIMSysMsgKeyAntiSpamEnable
int, (功能暂时不开放)是否需要过易盾反垃圾, 0:不需要,1:需要, 默认0
Definition: nim_sysmsg_def.h:150
static const char * kNIMSysMsgKeyLocalNotificationId
string 本地定义的通知 id, 选填, 建议使用uuid
Definition: nim_sysmsg_def.h:136
NIMSysMsgStatus
Definition: nim_sysmsg_def.h:161
@ kNIMSysMsgStatusNone
默认,未读
Definition: nim_sysmsg_def.h:163
static const char * kNIMSysMsgKeyLocalStatus
int 本地定义的系统消息状态,见NIMSysMsgStatus,发送方不需要填写
Definition: nim_sysmsg_def.h:132
static const char * kNIMSysMsgKeyFromAccount
string 自己id,选填
Definition: nim_sysmsg_def.h:124
static const char * kNIMSysMsgKeyCustomSaveFlag
int (可选)自定义通知消息是否存离线:0-不存(只发给在线用户),1-存(可发给离线用户)
Definition: nim_sysmsg_def.h:138
static const char * kNIMSysMsgKeyPushPayload
json string, (可选)第三方自定义的推送属性,必须为可以解析为Json的非格式化的字符串,长度2048
Definition: nim_sysmsg_def.h:142
static const char * kNIMSysMsgKeyPushEnable
int (可选)是否需要推送, 0:不需要,1:需要,默认1
Definition: nim_sysmsg_def.h:144
static const char * kNIMSysMsgKeyAntiSpamContent
string, (功能暂时不开放)(可选)开发者自定义的反垃圾字段
Definition: nim_sysmsg_def.h:152
static const char * kNIMSysMsgKeyPushNeedPrefix
int (可选)推送需要前缀,0:不需要,1:需要,默认0
Definition: nim_sysmsg_def.h:148
static const char * kNIMSysMsgKeyMsg
string 只读字段,SDK不转发该字段
Definition: nim_sysmsg_def.h:126
static const char * kNIMSysMsgKeyEnvConfig
string, (可选) 指向自定义抄送的配置
Definition: nim_sysmsg_def.h:154
static const char * kNIMSysMsgKeyTime
long 时间戳,选填
Definition: nim_sysmsg_def.h:118
static const char * kNIMSysMsgKeyAttach
string 消息内容,规定是可以解析为Json格式的字符串,必须为非格式化形式
Definition: nim_sysmsg_def.h:128
NIMSysMsgType
Definition: nim_sysmsg_def.h:177
@ kNIMSysMsgTypeUnknown
未知类型,本地使用,发送时勿使用,作为默认
Definition: nim_sysmsg_def.h:197
static const char * kNIMSysMsgKeyPushNeedBadge
int (可选)推送是否要做消息计数(角标),0:不需要,1:需要,默认1
Definition: nim_sysmsg_def.h:146
static const char * kNIMSysMsgKeyLocalClientMsgId
string 本地定义的消息 id, 发送方必填,建议使用uuid
Definition: nim_sysmsg_def.h:134
static const char * kNIMSysMsgKeyToAccount
string 接收者id,如果是个人,则是对方用户id,如果是群,则是群id,必填
Definition: nim_sysmsg_def.h:122
static const char * kNIMSysMsgKeyType
int 通知类型,NIMSysMsgType,必填
Definition: nim_sysmsg_def.h:120
static const char * kNIMSysMsgKeyCustomApnsText
string (可选)自定义通知消息推送文本,不填则不推送
Definition: nim_sysmsg_def.h:140
NIMResCode
Definition: public_defines.h:21
系统消息和自定义通知数据
Definition: nim_sysmsg_helper.h:103
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_sysmsg_helper.h:148
std::string sender_accid_
发送者ID
Definition: nim_sysmsg_helper.h:111
int total_unread_count_
总计的通知未读数
Definition: nim_sysmsg_helper.h:128
int64_t id_
通知ID
Definition: nim_sysmsg_helper.h:117
std::string content_
只读,SDK不转发该字段
Definition: nim_sysmsg_helper.h:113
SysMessage()
Definition: nim_sysmsg_helper.h:136
int64_t timetag_
通知时间戳(毫秒)
Definition: nim_sysmsg_helper.h:105
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
组装Json Value
Definition: nim_sysmsg_helper.h:168
SysMessageSetting msg_setting_
消息属性设置
Definition: nim_sysmsg_helper.h:121
NIMSysMsgStatus status_
通知状态
Definition: nim_sysmsg_helper.h:119
std::string client_msg_id_
客户端消息 ID
Definition: nim_sysmsg_helper.h:130
NIMResCode rescode_
通知错误码
Definition: nim_sysmsg_helper.h:124
NIMMessageFeature feature_
通知属性
Definition: nim_sysmsg_helper.h:126
NIMSysMsgType type_
通知类型
Definition: nim_sysmsg_helper.h:107
std::string client_notification_id_
客户端通知 ID
Definition: nim_sysmsg_helper.h:132
std::string receiver_accid_
接收者ID
Definition: nim_sysmsg_helper.h:109
std::string callbac_ext_
v8.2.0 第三方回调返回的自定义字段
Definition: nim_sysmsg_helper.h:134
std::string attach_
通知附件
Definition: nim_sysmsg_helper.h:115
系统消息和自定义通知属性设置
Definition: nim_sysmsg_helper.h:23
nim_cpp_wrapper_util::Json::Value push_payload_
第三方自定义的推送属性,长度2048
Definition: nim_sysmsg_helper.h:33
BoolStatus need_push_
是否需要推送
Definition: nim_sysmsg_helper.h:25
std::string anti_spam_content_
(功能暂时不开放)(可选)开发者自定义的反垃圾字段
Definition: nim_sysmsg_helper.h:39
BoolStatus push_need_prefix_
需要推送昵称
Definition: nim_sysmsg_helper.h:29
SysMessageSetting()
Definition: nim_sysmsg_helper.h:44
std::string push_content_
自定义推送文案,长度限制200字节
Definition: nim_sysmsg_helper.h:35
void ParseMessageSetting(const nim_cpp_wrapper_util::Json::Value &message)
从Json Value解析出消息属性设置
Definition: nim_sysmsg_helper.h:82
void ToJsonValue(nim_cpp_wrapper_util::Json::Value &message) const
组装Json Value字符串
Definition: nim_sysmsg_helper.h:56
std::string env_config_
(可选) 指向自定义抄送的配置
Definition: nim_sysmsg_helper.h:41
BoolStatus need_offline_
是否支持离线消息
Definition: nim_sysmsg_helper.h:31
BoolStatus anti_spam_enable_
(功能暂时不开放)是否需要过易盾反垃圾
Definition: nim_sysmsg_helper.h:37
BoolStatus push_need_badge_
是否要做消息计数
Definition: nim_sysmsg_helper.h:27