NIMSDK-iOS
载入中...
搜索中...
未找到
NIMQChatMessage.h
浏览该文件的文档.
1//
2// NIMQChatMessage.h
3// NIMLib
4//
5// Created by Netease.
6// Copyright © 2022 Netease. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
10
11#import "NIMMessage.h"
12
18NS_ASSUME_NONNULL_BEGIN
19
20/**
21 * 消息处理状态
22 */
23typedef NS_ENUM(NSInteger, NIMQChatMessageStatus) {
24 /**
25 * 初始状态
26 * @discussion
27 */
29
30 /**
31 * 已撤回
32 * @discussion
33 */
35
36 /**
37 * 已删除
38 * @discussion
39 */
41
42 /**
43 * 自定义
44 * @discussion 自定义状态值必须大于10000
45 */
47};
48
49/**
50 * 消息引用类型
51 */
52typedef NS_ENUM(NSInteger, NIMQChatMessageReferType) {
53 /**
54 * 回复的
55 * @discussion
56 */
58
59 /**
60 * Thread
61 * @discussion
62 */
64
65 /**
66 * 所有
67 * @discussion
68 */
70};
71
72/**
73 * 消息结构
74 */
75@interface NIMQChatMessage : NSObject
76
77/**
78 * 消息类型
79 */
80@property (nonatomic,assign,readonly) NIMMessageType messageType;
81
82/**
83 * 消息所属会话
84 */
85@property (nullable,nonatomic,copy,readonly) NIMSession *session;
86
87/**
88 * 消息ID,唯一标识
89 */
90@property (nonatomic,copy,readonly) NSString *messageId;
91
92/**
93 * 消息服务端ID
94 */
95@property (nonatomic,copy,readonly) NSString *serverID;
96
97/**
98 * 消息文本
99 * @discussion 所有消息类型都支持
100 */
101@property (nullable,nonatomic,copy) NSString *text;
102
103/**
104 * 消息附件内容
105 */
106@property (nullable,nonatomic,strong) id<NIMMessageObject> messageObject;
107
108/**
109 * 消息附件原始字符串内容
110 */
111@property (nullable, nonatomic, copy, readonly) NSString *rawAttachContent;
112
113/**
114 * 消息设置
115 * @discussion 可以通过这个字段制定当前消息的各种设置
116 */
117@property (nullable,nonatomic,strong) NIMMessageSetting *setting;
118
119/**
120 * 消息推送文案,长度限制500字,撤回消息时该字段无效
121 */
122@property (nullable,nonatomic,copy) NSString *apnsContent;
123
124/**
125 * 消息推送Payload
126 * @discussion 可以通过这个字段定义消息推送 Payload ,支持字段参考苹果技术文档,长度限制 2K,撤回消息时该字段无效
127 */
128@property (nullable,nonatomic,copy) NSDictionary *apnsPayload;
129
130/**
131 * 服务器扩展
132 * @discussion 客户端可以设置这个字段,这个字段将在本地存储且发送至对端,上层需要保证 NSDictionary 可以转换为 JSON,长度限制 1K
133 */
134@property (nullable,nonatomic,copy) NSDictionary *remoteExt;
135
136/**
137 * 客户端本地扩展
138 * @discussion 客户端可以设置这个字段,这个字段只在本地存储,不会发送至对端,上层需要保证 NSDictionary 可以转换为 JSON
139 */
140@property (nullable,nonatomic,copy) NSDictionary *localExt;
141
142/**
143 * 消息发送时间
144 * @discussion 发送成功后将被服务器自动修正
145 */
146@property (nonatomic,assign) NSTimeInterval timestamp;
147
148/**
149 * 消息投递状态 仅针对发送的消息
150 */
151@property (nonatomic,assign,readonly) NIMMessageDeliveryState deliveryState;
152
153/**
154 * 消息附件下载状态 仅针对收到的消息
155 */
156@property (nonatomic,assign,readonly) NIMMessageAttachmentDownloadState attachmentDownloadState;
157
158/**
159 * 是否是收到的消息
160 * @discussion
161 */
162@property (nonatomic,assign,readonly) BOOL isReceivedMsg;
163
164/**
165 * 是否是往外发的消息
166 * @discussion
167 */
168@property (nonatomic,assign,readonly) BOOL isOutgoingMsg;
169
170/**
171 * 消息是否标记为已删除
172 * @discussion
173 */
174@property (nonatomic,assign,readonly) BOOL isDeleted;
175
176/**
177 * 消息是否标记为已撤回
178 * @discussion
179 */
180@property (nonatomic,assign,readonly) BOOL isRevoked;
181
182/**
183 * 消息处理状态
184 */
185@property (nonatomic,assign) NIMQChatMessageStatus status;
186
187/**
188 * 消息来源
189 */
190@property (nullable,nonatomic,copy) NSString *from;
191
192/**
193 * 消息发送者名字
194 * @discussion
195 */
196@property (nullable,nonatomic,copy,readonly) NSString *senderName;
197
198/**
199 * 发送者客户端类型
200 */
201@property (nonatomic,assign,readonly) NIMLoginClientType senderClientType;
202
203/**
204 * 圈组频道ID
205 */
206@property (nonatomic,readonly) unsigned long long qchatChannelId;
207
208/**
209 * 圈组服务器ID
210 */
211@property (nonatomic,readonly) unsigned long long qchatServerId;
212
213/**
214 * 是否艾特所有人
215 * @discussion
216 */
217@property(nonatomic, assign) BOOL mentionedAll;
218
219/**
220 * 被艾特的人的accid列表
221 * @discussion
222 */
223@property(nonatomic, copy) NSArray<NSString *> *mentionedAccids;
224
225/**
226 * 被艾特的身份组的ID列表
227 * @discussion
228 */
229@property(nonatomic, copy) NSArray<NSNumber *> *mentionedRoleidList;
230
231/**
232 * 消息更新时间
233 * @discussion
234 */
235@property(nonatomic, assign) NSTimeInterval updateTimestamp;
236
237
238/**
239* 环境变量
240* @discussion 环境变量,用于指向不同的抄送、第三方回调等配置
241*/
242@property (nullable,nonatomic,copy) NSString *env;
243
244/**
245 * 回复消息引用
246 * @discussion
247 */
248@property(nullable, nonatomic, copy, readonly) NIMQChatMessageRefer *replyRefer;
249
250/**
251 * thread消息引用
252 * @discussion
253 */
254@property(nullable, nonatomic, copy, readonly) NIMQChatMessageRefer *threadRefer;
255
256/**
257 * 是否来自缓存
258 * @discussion
259 */
260@property (nonatomic,assign,readonly) BOOL fromCache;
261
262/**
263 * 易盾反垃圾设置
264 */
265@property (nullable, nonatomic, copy) NIMQChatMessageAntispamSetting *yidunAntiSpamSetting;
266
267/**
268 * 易盾反垃圾返回的结果字段
269 */
270@property (nullable, nonatomic, copy) NIMQChatMessageAntispamResult *yidunAntiSpamResult;
271
272/**
273 * 第三方回调回来的自定义扩展字段
274 */
275@property (nonatomic,copy,readonly) NSString *callbackExt;
276
277/**
278 * 消息更新内容
279 * @discussion 如果是更新的消息,里面有具体更新内容
280 */
281@property (nullable, nonatomic, strong) NIMQChatMessageUpdateContent *updateContent;
282
283/**
284 * 消息更新操作信息
285 * @discussion 如果是更新的消息,里面有具体操作信息
286 */
287@property (nullable, nonatomic, strong) NIMQChatMessageUpdateOperatorInfo *updateOperatorInfo;
288
289/**
290 * 消息子类型, 大于0的int NSNumber包装值
291 */
292@property (nonatomic, strong) NSNumber *subType;
293
294@end
295
296NS_ASSUME_NONNULL_END
NIMMessageType
Definition: NIMGlobalDefs.h:17
NIMLoginClientType
Definition: NIMLoginClient.h:17
NIMMessageDeliveryState
Definition: NIMMessage.h:38
NIMMessageAttachmentDownloadState
Definition: NIMMessage.h:56
NIMQChatMessageStatus
Definition: NIMQChatMessage.h:23
@ NIMQChatMessageStatusInit
Definition: NIMQChatMessage.h:28
@ NIMQChatMessageStatusCustom
Definition: NIMQChatMessage.h:46
@ NIMQChatMessageStatusRevoked
Definition: NIMQChatMessage.h:34
@ NIMQChatMessageStatusDeleted
Definition: NIMQChatMessage.h:40
NIMQChatMessageReferType
Definition: NIMQChatMessage.h:52
@ NIMQChatMessageReferTypeThread
Definition: NIMQChatMessage.h:63
@ NIMQChatMessageReferTypeAll
Definition: NIMQChatMessage.h:69
@ NIMQChatMessageReferTypeReply
Definition: NIMQChatMessage.h:57
Definition: NIMMessageSetting.h:17
Definition: NIMQChatMessageAntispamResult.h:16
Definition: NIMQChatMessageAntispamSetting.h:16
Definition: NIMQChatMessage.h:76
NIMLoginClientType senderClientType
Definition: NIMQChatMessage.h:201
BOOL isRevoked
Definition: NIMQChatMessage.h:180
NIMQChatMessageRefer * replyRefer
Definition: NIMQChatMessage.h:248
NSArray< NSString * > * mentionedAccids
Definition: NIMQChatMessage.h:223
NSNumber * subType
Definition: NIMQChatMessage.h:292
NIMQChatMessageUpdateContent * updateContent
Definition: NIMQChatMessage.h:281
unsigned long long qchatServerId
Definition: NIMQChatMessage.h:211
NIMMessageSetting * setting
Definition: NIMQChatMessage.h:117
BOOL mentionedAll
Definition: NIMQChatMessage.h:217
NIMQChatMessageUpdateOperatorInfo * updateOperatorInfo
Definition: NIMQChatMessage.h:287
NIMMessageAttachmentDownloadState attachmentDownloadState
Definition: NIMQChatMessage.h:156
NSDictionary * remoteExt
Definition: NIMQChatMessage.h:134
NIMSession * session
Definition: NIMQChatMessage.h:85
NSArray< NSNumber * > * mentionedRoleidList
Definition: NIMQChatMessage.h:229
NIMMessageType messageType
Definition: NIMQChatMessage.h:80
NSString * from
Definition: NIMQChatMessage.h:190
NSString * apnsContent
Definition: NIMQChatMessage.h:122
NSString * rawAttachContent
Definition: NIMQChatMessage.h:111
NIMQChatMessageAntispamResult * yidunAntiSpamResult
Definition: NIMQChatMessage.h:270
NSString * callbackExt
Definition: NIMQChatMessage.h:275
id< NIMMessageObject > messageObject
Definition: NIMQChatMessage.h:106
BOOL isDeleted
Definition: NIMQChatMessage.h:174
NSString * serverID
Definition: NIMQChatMessage.h:95
NSTimeInterval updateTimestamp
Definition: NIMQChatMessage.h:235
NSString * env
Definition: NIMQChatMessage.h:242
NSDictionary * apnsPayload
Definition: NIMQChatMessage.h:128
NIMQChatMessageStatus status
Definition: NIMQChatMessage.h:185
NIMQChatMessageRefer * threadRefer
Definition: NIMQChatMessage.h:254
NIMMessageDeliveryState deliveryState
Definition: NIMQChatMessage.h:151
BOOL isOutgoingMsg
Definition: NIMQChatMessage.h:168
BOOL isReceivedMsg
Definition: NIMQChatMessage.h:162
NSString * text
Definition: NIMQChatMessage.h:101
NIMQChatMessageAntispamSetting * yidunAntiSpamSetting
Definition: NIMQChatMessage.h:265
NSString * messageId
Definition: NIMQChatMessage.h:90
BOOL fromCache
Definition: NIMQChatMessage.h:260
NSTimeInterval timestamp
Definition: NIMQChatMessage.h:146
NSString * senderName
Definition: NIMQChatMessage.h:196
unsigned long long qchatChannelId
Definition: NIMQChatMessage.h:206
NSDictionary * localExt
Definition: NIMQChatMessage.h:140
Definition: NIMQChatMessageRefer.h:17
Definition: NIMQChatMessageUpdateContent.h:19
Definition: NIMQChatMessageUpdateContent.h:43
Definition: NIMSession.h:49