mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.2 KiB
C
77 lines
3.2 KiB
C
5 years ago
|
//
|
||
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
||
|
//
|
||
|
|
||
4 years ago
|
#import <SessionMessagingKit/OWSReadTracking.h>
|
||
|
#import <SessionMessagingKit/TSMessage.h>
|
||
5 years ago
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
5 years ago
|
@class SNProtoEnvelope;
|
||
5 years ago
|
|
||
|
typedef NS_ENUM(int32_t, TSErrorMessageType) {
|
||
|
TSErrorMessageNoSession,
|
||
|
// DEPRECATED: We no longer create TSErrorMessageWrongTrustedIdentityKey, but
|
||
|
// persisted legacy messages could exist indefinitly.
|
||
|
TSErrorMessageWrongTrustedIdentityKey,
|
||
|
TSErrorMessageInvalidKeyException,
|
||
|
// unused
|
||
|
TSErrorMessageMissingKeyId,
|
||
|
TSErrorMessageInvalidMessage,
|
||
|
// unused
|
||
|
TSErrorMessageDuplicateMessage,
|
||
|
TSErrorMessageInvalidVersion,
|
||
|
TSErrorMessageNonBlockingIdentityChange,
|
||
|
TSErrorMessageUnknownContactBlockOffer,
|
||
|
TSErrorMessageGroupCreationFailed,
|
||
|
};
|
||
|
|
||
|
@interface TSErrorMessage : TSMessage <OWSReadTracking>
|
||
|
|
||
|
- (instancetype)initMessageWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
|
messageBody:(nullable NSString *)body
|
||
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
||
|
expiresInSeconds:(uint32_t)expiresInSeconds
|
||
|
expireStartedAt:(uint64_t)expireStartedAt
|
||
|
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
|
||
|
contactShare:(nullable OWSContact *)contact
|
||
|
linkPreview:(nullable OWSLinkPreview *)linkPreview NS_UNAVAILABLE;
|
||
|
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
|
messageBody:(nullable NSString *)body
|
||
|
attachmentIds:(NSArray<NSString *> *)attachmentIds
|
||
|
expiresInSeconds:(uint32_t)expiresInSeconds
|
||
|
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
|
||
|
|
||
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
||
|
|
||
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
||
|
inThread:(nullable TSThread *)thread
|
||
|
failedMessageType:(TSErrorMessageType)errorMessageType
|
||
|
recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER;
|
||
|
|
||
5 years ago
|
+ (instancetype)corruptedMessageWithEnvelope:(SNProtoEnvelope *)envelope
|
||
5 years ago
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
|
|
||
|
+ (instancetype)corruptedMessageInUnknownThread;
|
||
|
|
||
5 years ago
|
+ (instancetype)invalidVersionWithEnvelope:(SNProtoEnvelope *)envelope
|
||
5 years ago
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
|
|
||
5 years ago
|
+ (instancetype)invalidKeyExceptionWithEnvelope:(SNProtoEnvelope *)envelope
|
||
5 years ago
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
|
|
||
5 years ago
|
+ (instancetype)missingSessionWithEnvelope:(SNProtoEnvelope *)envelope
|
||
5 years ago
|
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
|
|
||
|
+ (instancetype)nonblockingIdentityChangeInThread:(TSThread *)thread recipientId:(NSString *)recipientId;
|
||
|
|
||
|
@property (nonatomic, readonly) TSErrorMessageType errorType;
|
||
|
@property (nullable, nonatomic, readonly) NSString *recipientId;
|
||
|
|
||
|
@end
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|