mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-31 18:02:20 +00:00
no message
This commit is contained in:
parent
f982523cb8
commit
e94ad28ed3
19
MTProtoKit/MTBadMsgNotificationMessage.h
Normal file
19
MTProtoKit/MTBadMsgNotificationMessage.h
Normal file
@ -0,0 +1,19 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTBadMsgNotificationMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t badMessageId;
|
||||
@property (nonatomic, readonly) int32_t badMessageSeqNo;
|
||||
@property (nonatomic, readonly) int32_t errorCode;
|
||||
|
||||
- (instancetype)initWithBadMessageId:(int64_t)badMessageId badMessageSeqNo:(int32_t)badMessageSeqNo errorCode:(int32_t)errorCode;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTBadServerSaltNotificationMessage : MTBadMsgNotificationMessage
|
||||
|
||||
@property (nonatomic, readonly) int64_t nextServerSalt;
|
||||
|
||||
- (instancetype)initWithBadMessageId:(int64_t)badMessageId badMessageSeqNo:(int32_t)badMessageSeqNo errorCode:(int32_t)errorCode nextServerSalt:(int64_t)nextServerSalt;
|
||||
|
||||
@end
|
31
MTProtoKit/MTBadMsgNotificationMessage.m
Normal file
31
MTProtoKit/MTBadMsgNotificationMessage.m
Normal file
@ -0,0 +1,31 @@
|
||||
#import "MTBadMsgNotificationMessage.h"
|
||||
|
||||
@implementation MTBadMsgNotificationMessage
|
||||
|
||||
- (instancetype)initWithBadMessageId:(int64_t)badMessageId badMessageSeqNo:(int32_t)badMessageSeqNo errorCode:(int32_t)errorCode
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_badMessageId = badMessageId;
|
||||
_badMessageSeqNo = badMessageSeqNo;
|
||||
_errorCode = errorCode;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTBadServerSaltNotificationMessage
|
||||
|
||||
- (instancetype)initWithBadMessageId:(int64_t)badMessageId badMessageSeqNo:(int32_t)badMessageSeqNo errorCode:(int32_t)errorCode nextServerSalt:(int64_t)nextServerSalt
|
||||
{
|
||||
self = [super initWithBadMessageId:badMessageId badMessageSeqNo:badMessageSeqNo errorCode:errorCode];
|
||||
if (self != nil)
|
||||
{
|
||||
_nextServerSalt = nextServerSalt;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -12,6 +12,7 @@
|
||||
|
||||
@interface MTBuffer (TL)
|
||||
|
||||
- (void)appendTLBytes:(NSData *)bytes;
|
||||
- (void)appendTLString:(NSString *)string;
|
||||
|
||||
@end
|
@ -48,13 +48,11 @@ static inline int roundUp(int numToRound, int multiple)
|
||||
|
||||
@implementation MTBuffer (TL)
|
||||
|
||||
- (void)appendTLString:(NSString *)string
|
||||
- (void)appendTLBytes:(NSData *)bytes
|
||||
{
|
||||
NSData *stringData = [string dataUsingEncoding:NSUTF8StringEncoding];
|
||||
int32_t length = (int32_t)bytes.length;
|
||||
|
||||
int32_t length = (int32_t)stringData.length;
|
||||
|
||||
if (stringData == nil || length == 0)
|
||||
if (bytes == nil || length == 0)
|
||||
{
|
||||
[self appendInt32:0];
|
||||
return;
|
||||
@ -77,11 +75,16 @@ static inline int roundUp(int numToRound, int multiple)
|
||||
paddingBytes = roundUp(length + 1, 4) - (length + 1);
|
||||
}
|
||||
|
||||
[self appendBytes:stringData.bytes length:length];
|
||||
[self appendBytes:bytes.bytes length:length];
|
||||
|
||||
uint8_t tmp = 0;
|
||||
for (int i = 0; i < paddingBytes; i++)
|
||||
[self appendBytes:&tmp length:1];
|
||||
}
|
||||
|
||||
- (void)appendTLString:(NSString *)string
|
||||
{
|
||||
[self appendTLBytes:[string dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
19
MTProtoKit/MTBufferReader.h
Normal file
19
MTProtoKit/MTBufferReader.h
Normal file
@ -0,0 +1,19 @@
|
||||
#import "MTBuffer.h"
|
||||
|
||||
@interface MTBufferReader : NSObject
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data;
|
||||
|
||||
- (bool)readBytes:(void *)bytes length:(NSUInteger)length;
|
||||
- (bool)readInt32:(int32_t *)value;
|
||||
- (bool)readInt64:(int64_t *)value;
|
||||
- (NSData *)readRest;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTBufferReader (TL)
|
||||
|
||||
- (bool)readTLString:(__autoreleasing NSString **)value;
|
||||
- (bool)readTLBytes:(__autoreleasing NSData **)value;
|
||||
|
||||
@end
|
126
MTProtoKit/MTBufferReader.m
Normal file
126
MTProtoKit/MTBufferReader.m
Normal file
@ -0,0 +1,126 @@
|
||||
#import "MTBufferReader.h"
|
||||
|
||||
@interface MTBufferReader ()
|
||||
{
|
||||
NSData *_data;
|
||||
NSUInteger _offset;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTBufferReader
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_data = data;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (bool)readBytes:(void *)bytes length:(NSUInteger)length
|
||||
{
|
||||
if (_offset + length > _data.length)
|
||||
return false;
|
||||
if (bytes != NULL)
|
||||
memcpy(bytes, _data.bytes + _offset, length);
|
||||
_offset += length;
|
||||
return true;
|
||||
}
|
||||
|
||||
- (bool)readInt32:(int32_t *)value
|
||||
{
|
||||
return [self readBytes:value length:4];
|
||||
}
|
||||
|
||||
- (bool)readInt64:(int64_t *)value
|
||||
{
|
||||
return [self readBytes:value length:8];
|
||||
}
|
||||
|
||||
- (NSData *)readRest
|
||||
{
|
||||
return [_data subdataWithRange:NSMakeRange(_offset, _data.length - _offset)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
static inline int roundUpInput(int32_t numToRound, int32_t multiple)
|
||||
{
|
||||
if (multiple == 0)
|
||||
{
|
||||
return numToRound;
|
||||
}
|
||||
|
||||
int remainder = numToRound % multiple;
|
||||
if (remainder == 0)
|
||||
{
|
||||
return numToRound;
|
||||
}
|
||||
|
||||
return numToRound + multiple - remainder;
|
||||
}
|
||||
|
||||
@implementation MTBufferReader (TL)
|
||||
|
||||
- (bool)readTLString:(__autoreleasing NSString **)value
|
||||
{
|
||||
NSData *bytes = nil;
|
||||
if ([self readTLBytes:&bytes])
|
||||
{
|
||||
if (value)
|
||||
*value = [[NSString alloc] initWithData:bytes encoding:NSUTF8StringEncoding];
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
- (bool)readTLBytes:(__autoreleasing NSData **)value
|
||||
{
|
||||
uint8_t tmp = 0;
|
||||
if ([self readBytes:&tmp length:1])
|
||||
{
|
||||
NSUInteger paddingBytes = 0;
|
||||
|
||||
int32_t length = tmp;
|
||||
if (length == 254)
|
||||
{
|
||||
length = 0;
|
||||
|
||||
if (![self readBytes:((uint8_t *)&length) + 1 length:3])
|
||||
return false;
|
||||
|
||||
length >>= 8;
|
||||
|
||||
paddingBytes = roundUpInput(length, 4) - length;
|
||||
}
|
||||
else
|
||||
{
|
||||
paddingBytes = roundUpInput(length + 1, 4) - (length + 1);
|
||||
}
|
||||
|
||||
uint8_t *bytes = (uint8_t *)malloc(length);
|
||||
if (![self readBytes:bytes length:length])
|
||||
return false;
|
||||
|
||||
NSData *result = [NSData dataWithBytesNoCopy:bytes length:length freeWhenDone:true];
|
||||
|
||||
for (int i = 0; i < paddingBytes; i++)
|
||||
{
|
||||
if (![self readBytes:&tmp length:1])
|
||||
return false;
|
||||
}
|
||||
|
||||
if (value)
|
||||
*value = result;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@end
|
9
MTProtoKit/MTDatacenterAddressListData.h
Normal file
9
MTProtoKit/MTDatacenterAddressListData.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTDatacenterAddressListData : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray *addressList;
|
||||
|
||||
- (instancetype)initWithAddressList:(NSArray *)addressList;
|
||||
|
||||
@end
|
15
MTProtoKit/MTDatacenterAddressListData.m
Normal file
15
MTProtoKit/MTDatacenterAddressListData.m
Normal file
@ -0,0 +1,15 @@
|
||||
#import "MTDatacenterAddressListData.h"
|
||||
|
||||
@implementation MTDatacenterAddressListData
|
||||
|
||||
- (instancetype)initWithAddressList:(NSArray *)addressList
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_addressList = addressList;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -21,6 +21,12 @@
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
#import <MTProtoKit/MTEncryption.h>
|
||||
|
||||
#import <MTProtoKit/MTInternalMessageParser.h>
|
||||
#import <MTProtoKit/MTServerDhInnerDataMessage.h>
|
||||
#import <MTProtoKit/MTResPqMessage.h>
|
||||
#import <MTProtoKit/MTServerDhParamsMessage.h>
|
||||
#import <MTProtoKit/MTSetClientDhParamsResponseMessage.h>
|
||||
|
||||
static NSDictionary *selectPublicKey(NSArray *fingerprints)
|
||||
{
|
||||
static NSArray *serverPublicKeys = nil;
|
||||
@ -179,7 +185,7 @@ typedef enum {
|
||||
[reqPqBuffer appendInt32:(int32_t)0x60469778];
|
||||
[reqPqBuffer appendBytes:_nonce.bytes length:_nonce.length];
|
||||
|
||||
MTOutgoingMessage *message = [[MTOutgoingMessage alloc] initWithData:reqPqBuffer.data messageId:_currentStageMessageId messageSeqNo:_currentStageMessageSeqNo];
|
||||
MTOutgoingMessage *message = [[MTOutgoingMessage alloc] initWithData:reqPqBuffer.data metadata:@"reqPq" messageId:_currentStageMessageId messageSeqNo:_currentStageMessageSeqNo];
|
||||
return [[MTMessageTransaction alloc] initWithMessagePayload:@[message] completion:^(NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
{
|
||||
if (_stage == MTDatacenterAuthStagePQ && messageInternalIdToTransactionId[message.internalId] != nil && messageInternalIdToPreparedMessage[message.internalId] != nil)
|
||||
@ -193,10 +199,16 @@ typedef enum {
|
||||
}
|
||||
case MTDatacenterAuthStageReqDH:
|
||||
{
|
||||
id reqDh = [mtProto.context.serialization reqDhParams:_nonce serverNonce:_serverNonce p:_dhP q:_dhQ publicKeyFingerprint:_dhPublicKeyFingerprint encryptedData:_dhEncryptedData];
|
||||
NSData *reqDhData = [mtProto.context.serialization serializeMessage:reqDh];
|
||||
MTBuffer *reqDhBuffer = [[MTBuffer alloc] init];
|
||||
[reqDhBuffer appendInt32:(int32_t)0xd712e4be];
|
||||
[reqDhBuffer appendBytes:_nonce.bytes length:_nonce.length];
|
||||
[reqDhBuffer appendBytes:_serverNonce.bytes length:_serverNonce.length];
|
||||
[reqDhBuffer appendTLBytes:_dhP];
|
||||
[reqDhBuffer appendTLBytes:_dhQ];
|
||||
[reqDhBuffer appendInt64:_dhPublicKeyFingerprint];
|
||||
[reqDhBuffer appendTLBytes:_dhEncryptedData];
|
||||
|
||||
MTOutgoingMessage *message = [[MTOutgoingMessage alloc] initWithData:reqDhData messageId:_currentStageMessageId messageSeqNo:_currentStageMessageSeqNo];
|
||||
MTOutgoingMessage *message = [[MTOutgoingMessage alloc] initWithData:reqDhBuffer.data metadata:@"reqDh" messageId:_currentStageMessageId messageSeqNo:_currentStageMessageSeqNo];
|
||||
return [[MTMessageTransaction alloc] initWithMessagePayload:@[message] completion:^(NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
{
|
||||
if (_stage == MTDatacenterAuthStageReqDH && messageInternalIdToTransactionId[message.internalId] != nil && messageInternalIdToPreparedMessage[message.internalId] != nil)
|
||||
@ -210,10 +222,13 @@ typedef enum {
|
||||
}
|
||||
case MTDatacenterAuthStageKeyVerification:
|
||||
{
|
||||
id setClientDhParams = [mtProto.context.serialization setDhParams:_nonce serverNonce:_serverNonce encryptedData:_encryptedClientData];
|
||||
NSData *setClientDhParamsData = [mtProto.context.serialization serializeMessage:setClientDhParams];
|
||||
MTBuffer *setDhParamsBuffer = [[MTBuffer alloc] init];
|
||||
[setDhParamsBuffer appendInt32:(int32_t)0xf5045f1f];
|
||||
[setDhParamsBuffer appendBytes:_nonce.bytes length:_nonce.length];
|
||||
[setDhParamsBuffer appendBytes:_serverNonce.bytes length:_serverNonce.length];
|
||||
[setDhParamsBuffer appendTLBytes:_encryptedClientData];
|
||||
|
||||
MTOutgoingMessage *message = [[MTOutgoingMessage alloc] initWithData:setClientDhParamsData messageId:_currentStageMessageId messageSeqNo:_currentStageMessageSeqNo];
|
||||
MTOutgoingMessage *message = [[MTOutgoingMessage alloc] initWithData:setDhParamsBuffer.data metadata:@"setDhParams" messageId:_currentStageMessageId messageSeqNo:_currentStageMessageSeqNo];
|
||||
return [[MTMessageTransaction alloc] initWithMessagePayload:@[message] completion:^(NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
{
|
||||
if (_stage == MTDatacenterAuthStageKeyVerification && messageInternalIdToTransactionId[message.internalId] != nil && messageInternalIdToPreparedMessage[message.internalId] != nil)
|
||||
@ -235,11 +250,13 @@ typedef enum {
|
||||
|
||||
- (void)mtProto:(MTProto *)mtProto receivedMessage:(MTIncomingMessage *)message
|
||||
{
|
||||
if (_stage == MTDatacenterAuthStagePQ && [mtProto.context.serialization isMessageResPq:message.body])
|
||||
if (_stage == MTDatacenterAuthStagePQ && [message.body isKindOfClass:[MTResPqMessage class]])
|
||||
{
|
||||
if ([_nonce isEqualToData:[mtProto.context.serialization resPqNonce:message.body]])
|
||||
MTResPqMessage *resPqMessage = message.body;
|
||||
|
||||
if ([_nonce isEqualToData:resPqMessage.nonce])
|
||||
{
|
||||
NSDictionary *publicKey = selectPublicKey([mtProto.context.serialization resPqServerPublicKeyFingerprints:message.body]);
|
||||
NSDictionary *publicKey = selectPublicKey(resPqMessage.serverPublicKeyFingerprints);
|
||||
if (publicKey == nil)
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p couldn't find valid server public key]", self);
|
||||
@ -247,7 +264,7 @@ typedef enum {
|
||||
}
|
||||
else
|
||||
{
|
||||
NSData *pqBytes = [mtProto.context.serialization resPqPq:message.body];
|
||||
NSData *pqBytes = resPqMessage.pq;
|
||||
|
||||
uint64_t pq = 0;
|
||||
for (int i = 0; i < (int)pqBytes.length; i++)
|
||||
@ -265,7 +282,7 @@ typedef enum {
|
||||
return;
|
||||
}
|
||||
|
||||
_serverNonce = [mtProto.context.serialization resPqServerNonce:message.body];
|
||||
_serverNonce = resPqMessage.serverNonce;
|
||||
|
||||
NSMutableData *pBytes = [[NSMutableData alloc] init];
|
||||
uint64_t p = factP;
|
||||
@ -291,8 +308,16 @@ typedef enum {
|
||||
SecRandomCopyBytes(kSecRandomDefault, 32, nonceBytes);
|
||||
_newNonce = [[NSData alloc] initWithBytes:nonceBytes length:32];
|
||||
|
||||
id innerData = [mtProto.context.serialization pqInnerData:_nonce serverNonce:_serverNonce pq:pqBytes p:_dhP q:_dhQ newNonce:_newNonce];
|
||||
NSData *innerDataBytes = [mtProto.context.serialization serializeMessage:innerData];
|
||||
MTBuffer *innerDataBuffer = [[MTBuffer alloc] init];
|
||||
[innerDataBuffer appendInt32:(int32_t)0x83c95aec];
|
||||
[innerDataBuffer appendTLBytes:pqBytes];
|
||||
[innerDataBuffer appendTLBytes:_dhP];
|
||||
[innerDataBuffer appendTLBytes:_dhQ];
|
||||
[innerDataBuffer appendBytes:_nonce.bytes length:_nonce.length];
|
||||
[innerDataBuffer appendBytes:_serverNonce.bytes length:_serverNonce.length];
|
||||
[innerDataBuffer appendBytes:_newNonce.bytes length:_newNonce.length];
|
||||
|
||||
NSData *innerDataBytes = innerDataBuffer.data;
|
||||
|
||||
NSMutableData *dataWithHash = [[NSMutableData alloc] init];
|
||||
[dataWithHash appendData:MTSha1(innerDataBytes)];
|
||||
@ -332,11 +357,13 @@ typedef enum {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_stage == MTDatacenterAuthStageReqDH && [mtProto.context.serialization isMessageServerDhParams:message.body])
|
||||
else if (_stage == MTDatacenterAuthStageReqDH && [message.body isKindOfClass:[MTServerDhParamsMessage class]])
|
||||
{
|
||||
if ([_nonce isEqualToData:[mtProto.context.serialization serverDhParamsNonce:message.body]] && [_serverNonce isEqualToData:[mtProto.context.serialization serverDhParamsServerNonce:message.body]])
|
||||
MTServerDhParamsMessage *serverDhParamsMessage = message.body;
|
||||
|
||||
if ([_nonce isEqualToData:serverDhParamsMessage.nonce] && [_serverNonce isEqualToData:serverDhParamsMessage.serverNonce])
|
||||
{
|
||||
if ([mtProto.context.serialization isMessageServerDhParamsOk:message.body])
|
||||
if ([serverDhParamsMessage isKindOfClass:[MTServerDhParamsOkMessage class]])
|
||||
{
|
||||
NSMutableData *tmpAesKey = [[NSMutableData alloc] init];
|
||||
|
||||
@ -367,7 +394,7 @@ typedef enum {
|
||||
NSData *newNonce0_4 = [[NSData alloc] initWithBytes:((uint8_t *)_newNonce.bytes) length:4];
|
||||
[tmpAesIv appendData:newNonce0_4];
|
||||
|
||||
NSData *answerWithHash = MTAesDecrypt([mtProto.context.serialization serverDhParamsOkEncryptedAnswer:message.body], tmpAesKey, tmpAesIv);
|
||||
NSData *answerWithHash = MTAesDecrypt(((MTServerDhParamsOkMessage *)serverDhParamsMessage).encryptedResponse, tmpAesKey, tmpAesIv);
|
||||
NSData *answerHash = [[NSData alloc] initWithBytes:((uint8_t *)answerWithHash.bytes) length:20];
|
||||
|
||||
NSMutableData *answerData = [[NSMutableData alloc] initWithBytes:(((uint8_t *)answerWithHash.bytes) + 20) length:(answerWithHash.length - 20)];
|
||||
@ -392,12 +419,9 @@ typedef enum {
|
||||
return;
|
||||
}
|
||||
|
||||
NSInputStream *answerIs = [NSInputStream inputStreamWithData:answerData];
|
||||
[answerIs open];
|
||||
id dhInnerData = [mtProto.context.serialization parseMessage:answerIs responseParsingBlock:nil];
|
||||
[answerIs close];
|
||||
MTServerDhInnerDataMessage *dhInnerData = [MTInternalMessageParser parseMessage:answerData];
|
||||
|
||||
if (![mtProto.context.serialization isMessageServerDhInnerData:dhInnerData])
|
||||
if (![dhInnerData isKindOfClass:[MTServerDhInnerDataMessage class]])
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p couldn't parse decoded DH params]", self);
|
||||
[self reset:mtProto];
|
||||
@ -405,7 +429,7 @@ typedef enum {
|
||||
return;
|
||||
}
|
||||
|
||||
if (![_nonce isEqualToData:[mtProto.context.serialization serverDhInnerDataNonce:dhInnerData]])
|
||||
if (![_nonce isEqualToData:dhInnerData.nonce])
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH nonce]", self);
|
||||
[self reset:mtProto];
|
||||
@ -413,7 +437,7 @@ typedef enum {
|
||||
return;
|
||||
}
|
||||
|
||||
if (![_serverNonce isEqualToData:[mtProto.context.serialization serverDhInnerDataServerNonce:dhInnerData]])
|
||||
if (![_serverNonce isEqualToData:dhInnerData.serverNonce])
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH server nonce]", self);
|
||||
[self reset:mtProto];
|
||||
@ -421,7 +445,7 @@ typedef enum {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t innerDataG = [mtProto.context.serialization serverDhInnerDataG:dhInnerData];
|
||||
int32_t innerDataG = dhInnerData.g;
|
||||
if (innerDataG < 0 || !MTCheckIsSafeG((unsigned int)innerDataG))
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH g]", self);
|
||||
@ -430,8 +454,8 @@ typedef enum {
|
||||
return;
|
||||
}
|
||||
|
||||
NSData *innerDataGA = [mtProto.context.serialization serverDhInnerDataGA:dhInnerData];
|
||||
NSData *innerDataDhPrime = [mtProto.context.serialization serverDhInnerDataDhPrime:dhInnerData];
|
||||
NSData *innerDataGA = dhInnerData.gA;
|
||||
NSData *innerDataDhPrime = dhInnerData.dhPrime;
|
||||
if (!MTCheckIsSafeGAOrB(innerDataGA, innerDataDhPrime))
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH g_a]", self);
|
||||
@ -481,8 +505,15 @@ typedef enum {
|
||||
|
||||
_authInfo = [[MTDatacenterAuthInfo alloc] initWithAuthKey:authKey authKeyId:authKeyId saltSet:@[[[MTDatacenterSaltInfo alloc] initWithSalt:*((int64_t *)serverSaltData.bytes) firstValidMessageId:((int64_t)message.timestamp) * 4294967296 lastValidMessageId:((int64_t)(message.timestamp + 29.0 * 60.0)) * 4294967296]] authKeyAttributes:nil];
|
||||
|
||||
id clientInnerData = [mtProto.context.serialization clientDhInnerData:_nonce serverNonce:_serverNonce g_b:g_b retryId:0];
|
||||
NSData *clientInnerDataBytes = [mtProto.context.serialization serializeMessage:clientInnerData];
|
||||
//client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:bytes = Client_DH_Inner_Data;
|
||||
MTBuffer *clientDhInnerDataBuffer = [[MTBuffer alloc] init];
|
||||
[clientDhInnerDataBuffer appendInt32:(int32_t)0x6643b654];
|
||||
[clientDhInnerDataBuffer appendBytes:_nonce.bytes length:_nonce.length];
|
||||
[clientDhInnerDataBuffer appendBytes:_serverNonce.bytes length:_serverNonce.length];
|
||||
[clientDhInnerDataBuffer appendInt64:0];
|
||||
[clientDhInnerDataBuffer appendTLBytes:g_b];
|
||||
|
||||
NSData *clientInnerDataBytes = clientDhInnerDataBuffer.data;
|
||||
|
||||
NSMutableData *clientDataWithHash = [[NSMutableData alloc] init];
|
||||
[clientDataWithHash appendData:MTSha1(clientInnerDataBytes)];
|
||||
@ -509,9 +540,11 @@ typedef enum {
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_stage == MTDatacenterAuthStageKeyVerification && [mtProto.context.serialization isMessageSetClientDhParamsAnswer:message.body])
|
||||
else if (_stage == MTDatacenterAuthStageKeyVerification && [message.body isKindOfClass:[MTSetClientDhParamsResponseMessage class]])
|
||||
{
|
||||
if ([_nonce isEqualToData:[mtProto.context.serialization setClientDhParamsNonce:message.body]] && [_serverNonce isEqualToData:[mtProto.context.serialization setClientDhParamsServerNonce:message.body]])
|
||||
MTSetClientDhParamsResponseMessage *setClientDhParamsResponseMessage = message.body;
|
||||
|
||||
if ([_nonce isEqualToData:setClientDhParamsResponseMessage.nonce] && [_serverNonce isEqualToData:setClientDhParamsResponseMessage.serverNonce])
|
||||
{
|
||||
NSData *authKeyAuxHashFull = MTSha1(_authInfo.authKey);
|
||||
NSData *authKeyAuxHash = [[NSData alloc] initWithBytes:((uint8_t *)authKeyAuxHashFull.bytes) length:8];
|
||||
@ -540,9 +573,9 @@ typedef enum {
|
||||
NSData *newNonceHash3Full = MTSha1(newNonce3);
|
||||
NSData *newNonceHash3 = [[NSData alloc] initWithBytes:(((uint8_t *)newNonceHash3Full.bytes) + newNonceHash3Full.length - 16) length:16];
|
||||
|
||||
if ([mtProto.context.serialization isMessageSetClientDhParamsAnswerOk:message.body])
|
||||
if ([setClientDhParamsResponseMessage isKindOfClass:[MTSetClientDhParamsResponseOkMessage class]])
|
||||
{
|
||||
if (![newNonceHash1 isEqualToData:[mtProto.context.serialization setClientDhParamsNewNonceHash1:message.body]])
|
||||
if (![newNonceHash1 isEqualToData:((MTSetClientDhParamsResponseOkMessage *)setClientDhParamsResponseMessage).nextNonceHash1])
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH answer nonce hash 1]", self);
|
||||
[self reset:mtProto];
|
||||
@ -559,9 +592,9 @@ typedef enum {
|
||||
[delegate authMessageServiceCompletedWithAuthInfo:_authInfo];
|
||||
}
|
||||
}
|
||||
else if ([mtProto.context.serialization isMessageSetClientDhParamsAnswerRetry:message.body])
|
||||
else if ([setClientDhParamsResponseMessage isKindOfClass:[MTSetClientDhParamsResponseRetryMessage class]])
|
||||
{
|
||||
if (![newNonceHash2 isEqualToData:[mtProto.context.serialization setClientDhParamsNewNonceHash2:message.body]])
|
||||
if (![newNonceHash2 isEqualToData:((MTSetClientDhParamsResponseRetryMessage *)setClientDhParamsResponseMessage).nextNonceHash2])
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH answer nonce hash 2]", self);
|
||||
[self reset:mtProto];
|
||||
@ -572,9 +605,9 @@ typedef enum {
|
||||
[self reset:mtProto];
|
||||
}
|
||||
}
|
||||
else if ([mtProto.context.serialization isMessageSetClientDhParamsAnswerFail:message.body])
|
||||
else if ([setClientDhParamsResponseMessage isKindOfClass:[MTSetClientDhParamsResponseFailMessage class]])
|
||||
{
|
||||
if (![newNonceHash3 isEqualToData:[mtProto.context.serialization setClientDhParamsNewNonceHash3:message.body]])
|
||||
if (![newNonceHash3 isEqualToData:((MTSetClientDhParamsResponseFailMessage *)setClientDhParamsResponseMessage).nextNonceHash3])
|
||||
{
|
||||
MTLog(@"[MTDatacenterAuthMessageService#%p invalid DH answer nonce hash 3]", self);
|
||||
[self reset:mtProto];
|
||||
|
@ -13,6 +13,7 @@
|
||||
#import <MTProtoKit/MTProto.h>
|
||||
#import <MTProtoKit/MTRequestMessageService.h>
|
||||
#import <MTProtoKit/MTRequest.h>
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
|
||||
@interface MTDatacenterTransferAuthAction () <MTContextChangeListener>
|
||||
{
|
||||
@ -96,17 +97,22 @@
|
||||
|
||||
MTRequest *request = [[MTRequest alloc] init];
|
||||
|
||||
request.body = [context.serialization exportAuthorization:(int32_t)_destinationDatacenterId];
|
||||
NSData *exportAuthRequestData = nil;
|
||||
MTExportAuthorizationResponseParser responseParser = [[context.serialization exportAuthorization:(int32_t)_destinationDatacenterId data:&exportAuthRequestData] copy];
|
||||
|
||||
[request setPayload:exportAuthRequestData metadata:@"exportAuthorization" responseParser:responseParser];
|
||||
|
||||
__weak MTDatacenterTransferAuthAction *weakSelf = self;
|
||||
[request setCompleted:^(id result, __unused NSTimeInterval timestamp, id error)
|
||||
[request setCompleted:^(MTExportedAuthorizationData *result, __unused NSTimeInterval timestamp, id error)
|
||||
{
|
||||
__strong MTDatacenterTransferAuthAction *strongSelf = weakSelf;
|
||||
if (strongSelf == nil)
|
||||
return;
|
||||
|
||||
if (error == nil)
|
||||
[strongSelf beginTransferWithId:[context.serialization exportedAuthorizationId:result] data:[context.serialization exportedAuthorizationBytes:result]];
|
||||
{
|
||||
[strongSelf beginTransferWithId:result.authorizationId data:result.authorizationBytes];
|
||||
}
|
||||
else
|
||||
[strongSelf fail];
|
||||
}];
|
||||
@ -127,7 +133,12 @@
|
||||
|
||||
MTRequest *request = [[MTRequest alloc] init];
|
||||
|
||||
request.body = [context.serialization importAuthorization:dataId bytes:authData];
|
||||
NSData *importAuthRequestData = [_context.serialization importAuthorization:dataId bytes:authData];
|
||||
|
||||
[request setPayload:importAuthRequestData metadata:@"importAuthorization" responseParser:^id (NSData *data)
|
||||
{
|
||||
return @true;
|
||||
}];
|
||||
|
||||
NSInteger destinationDatacenterId = _destinationDatacenterId;
|
||||
id authToken = _authToken;
|
||||
|
29
MTProtoKit/MTDestroySessionResponseMessage.h
Normal file
29
MTProtoKit/MTDestroySessionResponseMessage.h
Normal file
@ -0,0 +1,29 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTDestroySessionResponseMessage : NSObject
|
||||
|
||||
@end
|
||||
|
||||
@interface MTDestroySessionResponseOkMessage : MTDestroySessionResponseMessage
|
||||
|
||||
@property (nonatomic, readonly) int64_t sessionId;
|
||||
|
||||
- (instancetype)initWithSessionId:(int64_t)sessionId;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTDestroySessionResponseNoneMessage : MTDestroySessionResponseMessage
|
||||
|
||||
@property (nonatomic, readonly) int64_t sessionId;
|
||||
|
||||
- (instancetype)initWithSessionId:(int64_t)sessionId;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTDestroySessionMultipleResponseMessage : MTDestroySessionResponseMessage
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *responsesData;
|
||||
|
||||
- (instancetype)initWithResponses:(NSData *)responsesData;
|
||||
|
||||
@end
|
47
MTProtoKit/MTDestroySessionResponseMessage.m
Normal file
47
MTProtoKit/MTDestroySessionResponseMessage.m
Normal file
@ -0,0 +1,47 @@
|
||||
#import "MTDestroySessionResponseMessage.h"
|
||||
|
||||
@implementation MTDestroySessionResponseMessage
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTDestroySessionResponseOkMessage
|
||||
|
||||
- (instancetype)initWithSessionId:(int64_t)sessionId
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_sessionId = sessionId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTDestroySessionResponseNoneMessage
|
||||
|
||||
- (instancetype)initWithSessionId:(int64_t)sessionId
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_sessionId = sessionId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTDestroySessionMultipleResponseMessage
|
||||
|
||||
- (instancetype)initWithResponses:(NSData *)responsesData
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_responsesData = responsesData;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -103,15 +103,19 @@
|
||||
[_mtProto addMessageService:_requestService];
|
||||
|
||||
MTRequest *request = [[MTRequest alloc] init];
|
||||
request.body = [context.serialization getConfig];
|
||||
|
||||
NSData *getConfigData = nil;
|
||||
MTRequestDatacenterAddressListParser responseParser = [_context.serialization requestDatacenterAddressList:_targetDatacenterId data:&getConfigData];
|
||||
|
||||
[request setPayload:getConfigData metadata:@"getConfig" responseParser:responseParser];
|
||||
|
||||
__weak MTDiscoverDatacenterAddressAction *weakSelf = self;
|
||||
[request setCompleted:^(id result, __unused NSTimeInterval completionTimestamp, id error)
|
||||
[request setCompleted:^(MTDatacenterAddressListData *result, __unused NSTimeInterval completionTimestamp, id error)
|
||||
{
|
||||
__strong MTDiscoverDatacenterAddressAction *strongSelf = weakSelf;
|
||||
|
||||
if (error == nil)
|
||||
[strongSelf getConfigSuccess:[context.serialization datacenterAddressListFromConfig:result datacenterId:_datacenterId]];
|
||||
[strongSelf getConfigSuccess:result.addressList];
|
||||
else
|
||||
[strongSelf getConfigFailed];
|
||||
}];
|
||||
|
24
MTProtoKit/MTDropRpcResultMessage.h
Normal file
24
MTProtoKit/MTDropRpcResultMessage.h
Normal file
@ -0,0 +1,24 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTDropRpcResultMessage : NSObject
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface MTDropRpcResultUnknownMessage : MTDropRpcResultMessage
|
||||
|
||||
@end
|
||||
|
||||
@interface MTDropRpcResultDroppedRunningMessage : MTDropRpcResultMessage
|
||||
|
||||
@end
|
||||
|
||||
@interface MTDropRpcResultDroppedMessage : MTDropRpcResultMessage
|
||||
|
||||
@property (nonatomic, readonly) int64_t messageId;
|
||||
@property (nonatomic, readonly) int32_t seqNo;
|
||||
@property (nonatomic, readonly) int32_t size;
|
||||
|
||||
- (instancetype)initWithMessageId:(int64_t)messageId seqNo:(int32_t)seqNo size:(int32_t)size;
|
||||
|
||||
@end
|
29
MTProtoKit/MTDropRpcResultMessage.m
Normal file
29
MTProtoKit/MTDropRpcResultMessage.m
Normal file
@ -0,0 +1,29 @@
|
||||
#import "MTDropRpcResultMessage.h"
|
||||
|
||||
@implementation MTDropRpcResultMessage
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTDropRpcResultUnknownMessage
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTDropRpcResultDroppedRunningMessage
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTDropRpcResultDroppedMessage
|
||||
|
||||
- (instancetype)initWithMessageId:(int64_t)messageId seqNo:(int32_t)seqNo size:(int32_t)size
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageId = messageId;
|
||||
_seqNo = seqNo;
|
||||
_size = size;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
10
MTProtoKit/MTExportedAuthorizationData.h
Normal file
10
MTProtoKit/MTExportedAuthorizationData.h
Normal file
@ -0,0 +1,10 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTExportedAuthorizationData : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *authorizationBytes;
|
||||
@property (nonatomic, readonly) int32_t authorizationId;
|
||||
|
||||
- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId;
|
||||
|
||||
@end
|
16
MTProtoKit/MTExportedAuthorizationData.m
Normal file
16
MTProtoKit/MTExportedAuthorizationData.m
Normal file
@ -0,0 +1,16 @@
|
||||
#import "MTExportedAuthorizationData.h"
|
||||
|
||||
@implementation MTExportedAuthorizationData
|
||||
|
||||
- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_authorizationBytes = authorizationBytes;
|
||||
_authorizationId = authorizationId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
21
MTProtoKit/MTFutureSaltsMessage.h
Normal file
21
MTProtoKit/MTFutureSaltsMessage.h
Normal file
@ -0,0 +1,21 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTFutureSalt : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int32_t validSince;
|
||||
@property (nonatomic, readonly) int32_t validUntil;
|
||||
@property (nonatomic, readonly) int64_t salt;
|
||||
|
||||
- (instancetype)initWithValidSince:(int32_t)validSince validUntil:(int32_t)validUntil salt:(int64_t)salt;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTFutureSaltsMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t requestMessageId;
|
||||
@property (nonatomic, readonly) int32_t now;
|
||||
@property (nonatomic, strong, readonly) NSArray *salts;
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessageId now:(int32_t)now salts:(NSArray *)salts;
|
||||
|
||||
@end
|
33
MTProtoKit/MTFutureSaltsMessage.m
Normal file
33
MTProtoKit/MTFutureSaltsMessage.m
Normal file
@ -0,0 +1,33 @@
|
||||
#import "MTFutureSaltsMessage.h"
|
||||
|
||||
@implementation MTFutureSalt
|
||||
|
||||
- (instancetype)initWithValidSince:(int32_t)validSince validUntil:(int32_t)validUntil salt:(int64_t)salt
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_validSince = validSince;
|
||||
_validUntil = validUntil;
|
||||
_salt = salt;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTFutureSaltsMessage
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessageId now:(int32_t)now salts:(NSArray *)salts
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_requestMessageId = requestMessageId;
|
||||
_now = now;
|
||||
_salts = salts;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -24,6 +24,9 @@
|
||||
#import <MTProtoKit/MTHttpWorkerBehaviour.h>
|
||||
#import <MTProtoKit/MTHttpWorker.h>
|
||||
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
#import <MTProtoKit/MTPongMessage.h>
|
||||
|
||||
@interface MTHttpTransport () <MTHttpWorkerBehaviourDelegate, MTHttpWorkerDelegate, MTContextChangeListener>
|
||||
{
|
||||
MTDatacenterAddress *_address;
|
||||
@ -408,17 +411,24 @@
|
||||
|
||||
if (_currentActualizationPingId != 0)
|
||||
{
|
||||
id ping = [self.context.serialization ping:_currentActualizationPingId];
|
||||
MTBuffer *pingBuffer = [[MTBuffer alloc] init];
|
||||
[pingBuffer appendInt32:(int32_t)0x7abe77ec];
|
||||
[pingBuffer appendInt64:_currentActualizationPingId];
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithBody:ping];
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:pingBuffer.data metadata:@"ping"];
|
||||
outgoingMessage.requiresConfirmation = false;
|
||||
transportSpecificTransaction = [[MTMessageTransaction alloc] initWithMessagePayload:@[outgoingMessage] completion:nil];
|
||||
transportSpecificTransaction.requiresEncryption = true;
|
||||
}
|
||||
else if (!activeWorkersWithLongPollingFound)
|
||||
{
|
||||
id httpWait = [self.context.serialization httpWaitWithMaxDelay:50 waitAfter:50 maxWait:25000];
|
||||
MTOutgoingMessage *actualizationPingMessage = [[MTOutgoingMessage alloc] initWithBody:httpWait];
|
||||
MTBuffer *httpWaitBuffer = [[MTBuffer alloc] init];
|
||||
[httpWaitBuffer appendInt32:(int32_t)0x9299359f];
|
||||
[httpWaitBuffer appendInt32:50];
|
||||
[httpWaitBuffer appendInt32:50];
|
||||
[httpWaitBuffer appendInt32:25000];
|
||||
|
||||
MTOutgoingMessage *actualizationPingMessage = [[MTOutgoingMessage alloc] initWithData:httpWaitBuffer.data metadata:@"httpWait"];
|
||||
actualizationPingMessage.requiresConfirmation = false;
|
||||
transportSpecificTransaction = [[MTMessageTransaction alloc] initWithMessagePayload:@[actualizationPingMessage] completion:^(__unused NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
{
|
||||
@ -533,11 +543,11 @@
|
||||
|
||||
- (void)mtProto:(MTProto *)__unused mtProto receivedMessage:(MTIncomingMessage *)incomingMessage
|
||||
{
|
||||
if ([self.context.serialization isMessagePong:incomingMessage.body])
|
||||
if ([incomingMessage.body isKindOfClass:[MTPongMessage class]])
|
||||
{
|
||||
[[MTHttpTransport httpTransportQueue] dispatchOnQueue:^
|
||||
{
|
||||
if (_currentActualizationPingId != 0 && [self.context.serialization pongPingId:incomingMessage.body] == _currentActualizationPingId)
|
||||
if (_currentActualizationPingId != 0 && ((MTPongMessage *)incomingMessage.body).pingId == _currentActualizationPingId)
|
||||
{
|
||||
_currentActualizationPingId = 0;
|
||||
|
||||
|
@ -347,13 +347,6 @@ static inline int roundUpInput(int numToRound, int multiple)
|
||||
[_wrappedInputStream read:((uint8_t *)&length) + 1 maxLength:3];
|
||||
length >>= 8;
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# error "Big endian is not implemented"
|
||||
#else
|
||||
# error "Unknown byte order"
|
||||
#endif
|
||||
|
||||
paddingBytes = roundUpInput(length, 4) - length;
|
||||
}
|
||||
else
|
||||
|
7
MTProtoKit/MTInternalMessageParser.h
Normal file
7
MTProtoKit/MTInternalMessageParser.h
Normal file
@ -0,0 +1,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTInternalMessageParser : NSObject
|
||||
|
||||
+ (id)parseMessage:(NSData *)data;
|
||||
|
||||
@end
|
564
MTProtoKit/MTInternalMessageParser.m
Normal file
564
MTProtoKit/MTInternalMessageParser.m
Normal file
@ -0,0 +1,564 @@
|
||||
#import "MTInternalMessageParser.h"
|
||||
|
||||
#import <MTProtoKit/MTBufferReader.h>
|
||||
|
||||
#import <MTProtoKit/MTResPqMessage.h>
|
||||
#import <MTProtoKit/MTRpcResultMessage.h>
|
||||
#import <MTProtoKit/MTRpcError.h>
|
||||
#import <MTProtoKit/MTDropRpcResultMessage.h>
|
||||
#import <MTProtoKit/MTServerDhParamsMessage.h>
|
||||
#import <MTProtoKit/MTServerDhInnerDataMessage.h>
|
||||
#import <MTProtoKit/MTSetClientDhParamsResponseMessage.h>
|
||||
#import <MTProtoKit/MTMsgsAckMessage.h>
|
||||
#import <MTProtoKit/MTMsgsStateReqMessage.h>
|
||||
#import <MTProtoKit/MtMsgsStateInfoMessage.h>
|
||||
#import <MTProtoKit/MTMsgDetailedInfoMessage.h>
|
||||
#import <MTProtoKit/MTMsgAllInfoMessage.h>
|
||||
#import <MTProtoKit/MTMessage.h>
|
||||
#import <MTProtoKit/MTMsgResendReqMessage.h>
|
||||
#import <MTProtoKit/MTBadMsgNotificationMessage.h>
|
||||
#import <MTProtoKit/MTPingMessage.h>
|
||||
#import <MTProtoKit/MTPongMessage.h>
|
||||
#import <MTProtoKit/MTNewSessionCreatedMessage.h>
|
||||
#import <MTProtoKit/MTDestroySessionResponseMessage.h>
|
||||
#import <MTProtoKit/MTMsgContainerMessage.h>
|
||||
#import <MTProtoKit/MTFutureSaltsMessage.h>
|
||||
|
||||
@implementation MTInternalMessageParser
|
||||
|
||||
+ (id)parseMessage:(NSData *)data
|
||||
{
|
||||
MTBufferReader *reader = [[MTBufferReader alloc] initWithData:data];
|
||||
|
||||
int32_t signature = 0;
|
||||
if ([reader readInt32:&signature])
|
||||
{
|
||||
switch (signature)
|
||||
{
|
||||
case (int32_t)0x05162463:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSData *pq = nil;
|
||||
if (![reader readTLBytes:&pq])
|
||||
return nil;
|
||||
|
||||
if (![reader readInt32:NULL])
|
||||
return nil;
|
||||
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *serverPublicKeyFingerprints = [[NSMutableArray alloc] init];
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int64_t fingerprint = 0;
|
||||
if (![reader readInt64:&fingerprint])
|
||||
return nil;
|
||||
[serverPublicKeyFingerprints addObject:@(fingerprint)];
|
||||
}
|
||||
|
||||
return [[MTResPqMessage alloc] initWithNonce:nonce serverNonce:serverNonce pq:pq serverPublicKeyFingerprints:serverPublicKeyFingerprints];
|
||||
}
|
||||
case (int32_t)0x79cb045d:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *nextNonceHash = [[NSMutableData alloc] init];
|
||||
[nextNonceHash setLength:16];
|
||||
if (![reader readBytes:nextNonceHash.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
return [[MTServerDhParamsFailMessage alloc] initWithNonce:nonce serverNonce:serverNonce nextNonceHash:nextNonceHash];
|
||||
}
|
||||
case (int32_t)0xd0e8075c:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSData *encryptedResponse = nil;
|
||||
if (![reader readTLBytes:&encryptedResponse])
|
||||
return nil;
|
||||
|
||||
return [[MTServerDhParamsOkMessage alloc] initWithNonce:nonce serverNonce:serverNonce encryptedResponse:encryptedResponse];
|
||||
}
|
||||
case (int32_t)0xb5890dba:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
int32_t g = 0;
|
||||
if (![reader readInt32:&g])
|
||||
return nil;
|
||||
|
||||
NSData *dhPrime = nil;
|
||||
if (![reader readTLBytes:&dhPrime])
|
||||
return nil;
|
||||
|
||||
NSData *gA = nil;
|
||||
if (![reader readTLBytes:&gA])
|
||||
return nil;
|
||||
|
||||
int32_t serverTime = 0;
|
||||
if (![reader readInt32:&serverTime])
|
||||
return nil;
|
||||
|
||||
return [[MTServerDhInnerDataMessage alloc] initWithNonce:nonce serverNonce:serverNonce g:g dhPrime:dhPrime gA:gA serverTime:serverTime];
|
||||
}
|
||||
case (int32_t)0x3bcbf734:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *nextNonceHash1 = [[NSMutableData alloc] init];
|
||||
[nextNonceHash1 setLength:16];
|
||||
if (![reader readBytes:nextNonceHash1.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
return [[MTSetClientDhParamsResponseOkMessage alloc] initWithNonce:nonce serverNonce:serverNonce nextNonceHash1:nextNonceHash1];
|
||||
}
|
||||
case (int32_t)0x46dc1fb9:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *nextNonceHash2 = [[NSMutableData alloc] init];
|
||||
[nextNonceHash2 setLength:16];
|
||||
if (![reader readBytes:nextNonceHash2.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
return [[MTSetClientDhParamsResponseRetryMessage alloc] initWithNonce:nonce serverNonce:serverNonce nextNonceHash2:nextNonceHash2];
|
||||
}
|
||||
case (int32_t)0xa69dae02:
|
||||
{
|
||||
NSMutableData *nonce = [[NSMutableData alloc] init];
|
||||
[nonce setLength:16];
|
||||
if (![reader readBytes:nonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *serverNonce = [[NSMutableData alloc] init];
|
||||
[serverNonce setLength:16];
|
||||
if (![reader readBytes:serverNonce.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
NSMutableData *nextNonceHash3 = [[NSMutableData alloc] init];
|
||||
[nextNonceHash3 setLength:16];
|
||||
if (![reader readBytes:nextNonceHash3.mutableBytes length:16])
|
||||
return nil;
|
||||
|
||||
return [[MTSetClientDhParamsResponseFailMessage alloc] initWithNonce:nonce serverNonce:serverNonce nextNonceHash3:nextNonceHash3];
|
||||
}
|
||||
case (int32_t)0xf35c6d01:
|
||||
{
|
||||
int64_t requestMessageId = 0;
|
||||
if (![reader readInt64:&requestMessageId])
|
||||
return nil;
|
||||
|
||||
NSData *responseData = [reader readRest];
|
||||
|
||||
return [[MTRpcResultMessage alloc] initWithRequestMessageId:requestMessageId data:responseData];
|
||||
}
|
||||
case (int32_t)0x2144ca19:
|
||||
{
|
||||
int32_t errorCode = 0;
|
||||
if (![reader readInt32:&errorCode])
|
||||
return nil;
|
||||
|
||||
NSString *errorDescription = @"";
|
||||
if (![reader readTLString:&errorDescription])
|
||||
return nil;
|
||||
|
||||
return [[MTRpcError alloc] initWithErrorCode:errorCode errorDescription:errorDescription];
|
||||
}
|
||||
case (int32_t)0x5e2ad36e:
|
||||
{
|
||||
return [[MTDropRpcResultUnknownMessage alloc] init];
|
||||
}
|
||||
case (int32_t)0xcd78e586:
|
||||
{
|
||||
return [[MTDropRpcResultDroppedRunningMessage alloc] init];
|
||||
}
|
||||
case (int32_t)0xa43ad8b7:
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
|
||||
int32_t seqNo = 0;
|
||||
if (![reader readInt32:&seqNo])
|
||||
return nil;
|
||||
|
||||
int32_t size = 0;
|
||||
if (![reader readInt32:&size])
|
||||
return nil;
|
||||
|
||||
return [[MTDropRpcResultDroppedMessage alloc] initWithMessageId:messageId seqNo:seqNo size:size];
|
||||
}
|
||||
case (int32_t)0xda69fb52:
|
||||
{
|
||||
if (![reader readInt32:NULL])
|
||||
return nil;
|
||||
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *messageIds = [[NSMutableArray alloc] init];
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
[messageIds addObject:@(messageId)];
|
||||
}
|
||||
|
||||
return [[MTMsgsStateReqMessage alloc] initWithMessageIds:messageIds];
|
||||
}
|
||||
case (int32_t)0x04deb57d:
|
||||
{
|
||||
int64_t requestMessageId = 0;
|
||||
if (![reader readInt64:&requestMessageId])
|
||||
return nil;
|
||||
|
||||
NSData *info = nil;
|
||||
if (![reader readTLBytes:&info])
|
||||
return nil;
|
||||
|
||||
return [[MTMsgsStateInfoMessage alloc] initWithRequestMessageId:requestMessageId info:info];
|
||||
}
|
||||
case (int32_t)0x276d3ec6:
|
||||
{
|
||||
int64_t requestMessageId = 0;
|
||||
if (![reader readInt64:&requestMessageId])
|
||||
return nil;
|
||||
|
||||
int64_t responseMessageId = 0;
|
||||
if (![reader readInt64:&responseMessageId])
|
||||
return nil;
|
||||
|
||||
int32_t responseLength = 0;
|
||||
if (![reader readInt32:&responseLength])
|
||||
return nil;
|
||||
|
||||
int32_t status = 0;
|
||||
if (![reader readInt32:&status])
|
||||
return nil;
|
||||
|
||||
return [[MTMsgDetailedResponseInfoMessage alloc] initWithRequestMessageId:requestMessageId responseMessageId:responseMessageId responseLength:responseLength status:status];
|
||||
}
|
||||
case (int32_t)0x809db6df:
|
||||
{
|
||||
int64_t responseMessageId = 0;
|
||||
if (![reader readInt64:&responseMessageId])
|
||||
return nil;
|
||||
|
||||
int32_t responseLength = 0;
|
||||
if (![reader readInt32:&responseLength])
|
||||
return nil;
|
||||
|
||||
int32_t status = 0;
|
||||
if (![reader readInt32:&status])
|
||||
return nil;
|
||||
|
||||
return [[MTMsgDetailedInfoMessage alloc] initWithResponseMessageId:responseMessageId responseLength:responseLength status:status];
|
||||
}
|
||||
case (int32_t)0x8cc0d131:
|
||||
{
|
||||
if (![reader readInt32:NULL])
|
||||
return nil;
|
||||
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *messageIds = [[NSMutableArray alloc] init];
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
[messageIds addObject:@(messageId)];
|
||||
}
|
||||
|
||||
NSData *info = nil;
|
||||
if (![reader readTLBytes:&info])
|
||||
return nil;
|
||||
|
||||
return [[MTMsgAllInfoMessage alloc] initWithMessageIds:messageIds info:info];
|
||||
}
|
||||
case (int32_t)0xe06046b2:
|
||||
{
|
||||
int32_t messageSignature = 0;
|
||||
if (![reader readInt32:&messageSignature] || messageSignature != (int32_t)0x5bb8e511)
|
||||
return nil;
|
||||
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
|
||||
int32_t seqNo = 0;
|
||||
if (![reader readInt32:&seqNo])
|
||||
return nil;
|
||||
|
||||
int32_t length = 0;
|
||||
if (![reader readInt32:&length])
|
||||
return nil;
|
||||
|
||||
NSData *data = [reader readRest];
|
||||
if (data.length != (NSUInteger)length)
|
||||
return nil;
|
||||
|
||||
return [[MTMessage alloc] initWithMessageId:messageId seqNo:seqNo data:data];
|
||||
}
|
||||
case (int32_t)0x7d861a08:
|
||||
{
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *messageIds = [[NSMutableArray alloc] init];
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
[messageIds addObject:@(messageId)];
|
||||
}
|
||||
|
||||
return [[MTMsgResendReqMessage alloc] initWithMessageIds:messageIds];
|
||||
}
|
||||
case (int32_t)0xa7eff811:
|
||||
{
|
||||
int64_t badMessageId = 0;
|
||||
if (![reader readInt64:&badMessageId])
|
||||
return nil;
|
||||
|
||||
int32_t badMessageSeqNo = 0;
|
||||
if (![reader readInt32:&badMessageSeqNo])
|
||||
return nil;
|
||||
|
||||
int32_t errorCode = 0;
|
||||
if (![reader readInt32:&errorCode])
|
||||
return nil;
|
||||
|
||||
return [[MTBadMsgNotificationMessage alloc] initWithBadMessageId:badMessageId badMessageSeqNo:badMessageSeqNo errorCode:errorCode];
|
||||
}
|
||||
case (int32_t)0xedab447b:
|
||||
{
|
||||
int64_t badMessageId = 0;
|
||||
if (![reader readInt64:&badMessageId])
|
||||
return nil;
|
||||
|
||||
int32_t badMessageSeqNo = 0;
|
||||
if (![reader readInt32:&badMessageSeqNo])
|
||||
return nil;
|
||||
|
||||
int32_t errorCode = 0;
|
||||
if (![reader readInt32:&errorCode])
|
||||
return nil;
|
||||
|
||||
int64_t nextServerSalt = 0;
|
||||
if (![reader readInt64:&nextServerSalt])
|
||||
return nil;
|
||||
|
||||
return [[MTBadServerSaltNotificationMessage alloc] initWithBadMessageId:badMessageId badMessageSeqNo:badMessageSeqNo errorCode:errorCode nextServerSalt:nextServerSalt];
|
||||
}
|
||||
case (int32_t)0x62d6b459:
|
||||
{
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *messageIds = [[NSMutableArray alloc] init];
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
[messageIds addObject:@(messageId)];
|
||||
}
|
||||
|
||||
return [[MTMsgsAckMessage alloc] initWithMessageIds:messageIds];
|
||||
}
|
||||
case (int32_t)0x7abe77ec:
|
||||
{
|
||||
int64_t pingId = 0;
|
||||
if (![reader readInt64:&pingId])
|
||||
return nil;
|
||||
|
||||
return [[MTPingMessage alloc] initWithPingId:pingId];
|
||||
}
|
||||
case (int32_t)0x347773c5:
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
|
||||
int64_t pingId = 0;
|
||||
if (![reader readInt64:&pingId])
|
||||
return nil;
|
||||
|
||||
return [[MTPongMessage alloc] initWithMessageId:messageId pingId:pingId];
|
||||
}
|
||||
case (int32_t)0x9ec20908:
|
||||
{
|
||||
int64_t firstMessageId = 0;
|
||||
if (![reader readInt64:&firstMessageId])
|
||||
return nil;
|
||||
|
||||
int64_t uniqueId = 0;
|
||||
if (![reader readInt64:&uniqueId])
|
||||
return nil;
|
||||
|
||||
int64_t serverSalt = 0;
|
||||
if (![reader readInt64:&serverSalt])
|
||||
return nil;
|
||||
|
||||
return [[MTNewSessionCreatedMessage alloc] initWithFirstMessageId:firstMessageId uniqueId:uniqueId serverSalt:serverSalt];
|
||||
}
|
||||
case (int32_t)0xe22045fc:
|
||||
{
|
||||
int64_t sessionId = 0;
|
||||
if (![reader readInt64:&sessionId])
|
||||
return nil;
|
||||
|
||||
return [[MTDestroySessionResponseOkMessage alloc] initWithSessionId:sessionId];
|
||||
}
|
||||
case (int32_t)0x62d350c9:
|
||||
{
|
||||
int64_t sessionId = 0;
|
||||
if (![reader readInt64:&sessionId])
|
||||
return nil;
|
||||
|
||||
return [[MTDestroySessionResponseNoneMessage alloc] initWithSessionId:sessionId];
|
||||
}
|
||||
case (int32_t)0xfb95abcd:
|
||||
{
|
||||
NSData *responsesData = [reader readRest];
|
||||
|
||||
return [[MTDestroySessionMultipleResponseMessage alloc] initWithResponses:responsesData];
|
||||
}
|
||||
case (int32_t)0x73f1f8dc:
|
||||
{
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *messages = [[NSMutableArray alloc] init];
|
||||
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int64_t messageId = 0;
|
||||
if (![reader readInt64:&messageId])
|
||||
return nil;
|
||||
|
||||
int32_t seqNo = 0;
|
||||
if (![reader readInt32:&seqNo])
|
||||
return nil;
|
||||
|
||||
int32_t length = 0;
|
||||
if (![reader readInt32:&length])
|
||||
return nil;
|
||||
|
||||
if (length < 0 || length > 16 * 1024 * 1024)
|
||||
return nil;
|
||||
|
||||
NSMutableData *messageData = [[NSMutableData alloc] init];
|
||||
[messageData setLength:(NSUInteger)length];
|
||||
if (![reader readBytes:messageData.mutableBytes length:(NSUInteger)length])
|
||||
return nil;
|
||||
|
||||
[messages addObject:[[MTMessage alloc] initWithMessageId:messageId seqNo:seqNo data:messageData]];
|
||||
}
|
||||
|
||||
return [[MTMsgContainerMessage alloc] initWithMessages:messages];
|
||||
}
|
||||
case (int32_t)0xae500895:
|
||||
{
|
||||
int64_t requestMessageId = 0;
|
||||
if (![reader readInt64:&requestMessageId])
|
||||
return nil;
|
||||
|
||||
int32_t now = 0;
|
||||
if (![reader readInt32:&now])
|
||||
return nil;
|
||||
|
||||
int32_t count = 0;
|
||||
if (![reader readInt32:&count])
|
||||
return nil;
|
||||
|
||||
NSMutableArray *salts = [[NSMutableArray alloc] init];
|
||||
|
||||
for (int32_t i = 0; i < count; i++)
|
||||
{
|
||||
int32_t validSince = 0;
|
||||
if (![reader readInt32:&validSince])
|
||||
return nil;
|
||||
|
||||
int32_t validUntil = 0;
|
||||
if (![reader readInt32:&validUntil])
|
||||
return nil;
|
||||
|
||||
int64_t salt = 0;
|
||||
if (![reader readInt64:&salt])
|
||||
return nil;
|
||||
|
||||
[salts addObject:[[MTFutureSalt alloc] initWithValidSince:validSince validUntil:validUntil salt:salt]];
|
||||
}
|
||||
|
||||
return [[MTFutureSaltsMessage alloc] initWithRequestMessageId:requestMessageId now:now salts:salts];
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
11
MTProtoKit/MTMessage.h
Normal file
11
MTProtoKit/MTMessage.h
Normal file
@ -0,0 +1,11 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t messageId;
|
||||
@property (nonatomic, readonly) int32_t seqNo;
|
||||
@property (nonatomic, strong, readonly) NSData *data;
|
||||
|
||||
- (instancetype)initWithMessageId:(int64_t)messageId seqNo:(int32_t)seqNo data:(NSData *)data;
|
||||
|
||||
@end
|
17
MTProtoKit/MTMessage.m
Normal file
17
MTProtoKit/MTMessage.m
Normal file
@ -0,0 +1,17 @@
|
||||
#import "MTMessage.h"
|
||||
|
||||
@implementation MTMessage
|
||||
|
||||
- (instancetype)initWithMessageId:(int64_t)messageId seqNo:(int32_t)seqNo data:(NSData *)data
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageId = messageId;
|
||||
_seqNo = seqNo;
|
||||
_data = data;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -35,6 +35,4 @@
|
||||
- (void)mtProtoConnectionContextUpdateStateChanged:(MTProto *)mtProto isUpdatingConnectionContext:(bool)isUpdatingConnectionContext;
|
||||
- (void)mtProtoServiceTasksStateChanged:(MTProto *)mtProto isPerformingServiceTasks:(bool)isPerformingServiceTasks;
|
||||
|
||||
- (int32_t)possibleSignatureForResult:(int64_t)messageId found:(bool *)found;
|
||||
|
||||
@end
|
||||
|
10
MTProtoKit/MTMsgAllInfoMessage.h
Normal file
10
MTProtoKit/MTMsgAllInfoMessage.h
Normal file
@ -0,0 +1,10 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgAllInfoMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray *messageIds;
|
||||
@property (nonatomic, strong, readonly) NSData *info;
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds info:(NSData *)info;
|
||||
|
||||
@end
|
16
MTProtoKit/MTMsgAllInfoMessage.m
Normal file
16
MTProtoKit/MTMsgAllInfoMessage.m
Normal file
@ -0,0 +1,16 @@
|
||||
#import "MTMsgAllInfoMessage.h"
|
||||
|
||||
@implementation MTMsgAllInfoMessage
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds info:(NSData *)info
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageIds = messageIds;
|
||||
_info = info;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
9
MTProtoKit/MTMsgContainerMessage.h
Normal file
9
MTProtoKit/MTMsgContainerMessage.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgContainerMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray *messages;
|
||||
|
||||
- (instancetype)initWithMessages:(NSArray *)messages;
|
||||
|
||||
@end
|
15
MTProtoKit/MTMsgContainerMessage.m
Normal file
15
MTProtoKit/MTMsgContainerMessage.m
Normal file
@ -0,0 +1,15 @@
|
||||
#import "MTMsgContainerMessage.h"
|
||||
|
||||
@implementation MTMsgContainerMessage
|
||||
|
||||
- (instancetype)initWithMessages:(NSArray *)messages
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messages = messages;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
19
MTProtoKit/MTMsgDetailedInfoMessage.h
Normal file
19
MTProtoKit/MTMsgDetailedInfoMessage.h
Normal file
@ -0,0 +1,19 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgDetailedInfoMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t responseMessageId;
|
||||
@property (nonatomic, readonly) int32_t responseLength;
|
||||
@property (nonatomic, readonly) int32_t status;
|
||||
|
||||
- (instancetype)initWithResponseMessageId:(int64_t)responseMessageId responseLength:(int32_t)responseLength status:(int32_t)status;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTMsgDetailedResponseInfoMessage : MTMsgDetailedInfoMessage
|
||||
|
||||
@property (nonatomic, readonly) int64_t requestMessageId;
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessageId responseMessageId:(int64_t)responseMessageId responseLength:(int32_t)responseLength status:(int32_t)status;
|
||||
|
||||
@end
|
31
MTProtoKit/MTMsgDetailedInfoMessage.m
Normal file
31
MTProtoKit/MTMsgDetailedInfoMessage.m
Normal file
@ -0,0 +1,31 @@
|
||||
#import "MTMsgDetailedInfoMessage.h"
|
||||
|
||||
@implementation MTMsgDetailedInfoMessage
|
||||
|
||||
- (instancetype)initWithResponseMessageId:(int64_t)responseMessageId responseLength:(int32_t)responseLength status:(int32_t)status
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_responseMessageId = responseMessageId;
|
||||
_responseLength = responseLength;
|
||||
_status = status;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTMsgDetailedResponseInfoMessage
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessageId responseMessageId:(int64_t)responseMessageId responseLength:(int32_t)responseLength status:(int32_t)status
|
||||
{
|
||||
self = [super initWithResponseMessageId:responseMessageId responseLength:responseLength status:status];
|
||||
if (self != nil)
|
||||
{
|
||||
_requestMessageId = requestMessageId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
9
MTProtoKit/MTMsgResendReqMessage.h
Normal file
9
MTProtoKit/MTMsgResendReqMessage.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgResendReqMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray *messageIds;
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds;
|
||||
|
||||
@end
|
15
MTProtoKit/MTMsgResendReqMessage.m
Normal file
15
MTProtoKit/MTMsgResendReqMessage.m
Normal file
@ -0,0 +1,15 @@
|
||||
#import "MTMsgResendReqMessage.h"
|
||||
|
||||
@implementation MTMsgResendReqMessage
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageIds = messageIds;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
9
MTProtoKit/MTMsgsAckMessage.h
Normal file
9
MTProtoKit/MTMsgsAckMessage.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgsAckMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray *messageIds;
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds;
|
||||
|
||||
@end
|
15
MTProtoKit/MTMsgsAckMessage.m
Normal file
15
MTProtoKit/MTMsgsAckMessage.m
Normal file
@ -0,0 +1,15 @@
|
||||
#import "MTMsgsAckMessage.h"
|
||||
|
||||
@implementation MTMsgsAckMessage
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageIds = messageIds;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
10
MTProtoKit/MTMsgsStateInfoMessage.h
Normal file
10
MTProtoKit/MTMsgsStateInfoMessage.h
Normal file
@ -0,0 +1,10 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgsStateInfoMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t requestMessageId;
|
||||
@property (nonatomic, strong, readonly) NSData *info;
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessageId info:(NSData *)info;
|
||||
|
||||
@end
|
16
MTProtoKit/MTMsgsStateInfoMessage.m
Normal file
16
MTProtoKit/MTMsgsStateInfoMessage.m
Normal file
@ -0,0 +1,16 @@
|
||||
#import "MTMsgsStateInfoMessage.h"
|
||||
|
||||
@implementation MTMsgsStateInfoMessage
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessageId info:(NSData *)info
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_requestMessageId = requestMessageId;
|
||||
_info = info;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
9
MTProtoKit/MTMsgsStateReqMessage.h
Normal file
9
MTProtoKit/MTMsgsStateReqMessage.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTMsgsStateReqMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSArray *messageIds;
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds;
|
||||
|
||||
@end
|
15
MTProtoKit/MTMsgsStateReqMessage.m
Normal file
15
MTProtoKit/MTMsgsStateReqMessage.m
Normal file
@ -0,0 +1,15 @@
|
||||
#import "MTMsgsStateReqMessage.h"
|
||||
|
||||
@implementation MTMsgsStateReqMessage
|
||||
|
||||
- (instancetype)initWithMessageIds:(NSArray *)messageIds
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageIds = messageIds;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
11
MTProtoKit/MTNewSessionCreatedMessage.h
Normal file
11
MTProtoKit/MTNewSessionCreatedMessage.h
Normal file
@ -0,0 +1,11 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTNewSessionCreatedMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t firstMessageId;
|
||||
@property (nonatomic, readonly) int64_t uniqueId;
|
||||
@property (nonatomic, readonly) int64_t serverSalt;
|
||||
|
||||
- (instancetype)initWithFirstMessageId:(int64_t)firstMessageId uniqueId:(int64_t)uniqueId serverSalt:(int64_t)serverSalt;
|
||||
|
||||
@end
|
17
MTProtoKit/MTNewSessionCreatedMessage.m
Normal file
17
MTProtoKit/MTNewSessionCreatedMessage.m
Normal file
@ -0,0 +1,17 @@
|
||||
#import "MTNewSessionCreatedMessage.h"
|
||||
|
||||
@implementation MTNewSessionCreatedMessage
|
||||
|
||||
- (instancetype)initWithFirstMessageId:(int64_t)firstMessageId uniqueId:(int64_t)uniqueId serverSalt:(int64_t)serverSalt
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_firstMessageId = firstMessageId;
|
||||
_uniqueId = uniqueId;
|
||||
_serverSalt = serverSalt;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -12,6 +12,7 @@
|
||||
|
||||
@property (nonatomic, strong, readonly) id internalId;
|
||||
@property (nonatomic, strong, readonly) NSData *data;
|
||||
@property (nonatomic, strong, readonly) id metadata;
|
||||
@property (nonatomic, readonly) int64_t messageId;
|
||||
@property (nonatomic, readonly) int32_t messageSeqNo;
|
||||
@property (nonatomic) bool requiresConfirmation;
|
||||
@ -21,7 +22,7 @@
|
||||
|
||||
@property (nonatomic, copy) id (^dynamicDecorator)(NSData *currentData, NSMutableDictionary *messageInternalIdToPreparedMessage);
|
||||
|
||||
- (instancetype)initWithData:(id)data;
|
||||
- (instancetype)initWithData:(id)data messageId:(int64_t)messageId messageSeqNo:(int32_t)messageSeqNo;
|
||||
- (instancetype)initWithData:(NSData *)data metadata:(id)metadata;
|
||||
- (instancetype)initWithData:(NSData *)data metadata:(id)metadata messageId:(int64_t)messageId messageSeqNo:(int32_t)messageSeqNo;
|
||||
|
||||
@end
|
||||
|
@ -50,18 +50,19 @@
|
||||
|
||||
@implementation MTOutgoingMessage
|
||||
|
||||
- (instancetype)initWithData:(id)data
|
||||
- (instancetype)initWithData:(NSData *)data metadata:(id)metadata
|
||||
{
|
||||
return [self initWithData:data messageId:0 messageSeqNo:0];
|
||||
return [self initWithData:data metadata:metadata messageId:0 messageSeqNo:0];
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(id)data messageId:(int64_t)messageId messageSeqNo:(int32_t)messageSeqNo
|
||||
- (instancetype)initWithData:(NSData *)data metadata:(id)metadata messageId:(int64_t)messageId messageSeqNo:(int32_t)messageSeqNo
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_internalId = [[MTOutgoingMessageInternalId alloc] init];
|
||||
_data = data;
|
||||
_metadata = metadata;
|
||||
_messageId = messageId;
|
||||
_messageSeqNo = messageSeqNo;
|
||||
_requiresConfirmation = true;
|
||||
|
9
MTProtoKit/MTPingMessage.h
Normal file
9
MTProtoKit/MTPingMessage.h
Normal file
@ -0,0 +1,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTPingMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t pingId;
|
||||
|
||||
- (instancetype)initWithPingId:(int64_t)pingId;
|
||||
|
||||
@end
|
15
MTProtoKit/MTPingMessage.m
Normal file
15
MTProtoKit/MTPingMessage.m
Normal file
@ -0,0 +1,15 @@
|
||||
#import "MTPingMessage.h"
|
||||
|
||||
@implementation MTPingMessage
|
||||
|
||||
- (instancetype)initWithPingId:(int64_t)pingId
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_pingId = pingId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
10
MTProtoKit/MTPongMessage.h
Normal file
10
MTProtoKit/MTPongMessage.h
Normal file
@ -0,0 +1,10 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTPongMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t messageId;
|
||||
@property (nonatomic, readonly) int64_t pingId;
|
||||
|
||||
- (instancetype)initWithMessageId:(int64_t)messageId pingId:(int64_t)pingId;
|
||||
|
||||
@end
|
16
MTProtoKit/MTPongMessage.m
Normal file
16
MTProtoKit/MTPongMessage.m
Normal file
@ -0,0 +1,16 @@
|
||||
#import "MTPongMessage.h"
|
||||
|
||||
@implementation MTPongMessage
|
||||
|
||||
- (instancetype)initWithMessageId:(int64_t)messageId pingId:(int64_t)pingId
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_messageId = messageId;
|
||||
_pingId = pingId;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -40,6 +40,16 @@
|
||||
#import <MTProtoKit/MTSerialization.h>
|
||||
#import <MTProtoKit/MTEncryption.h>
|
||||
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
#import <MTProtoKit/MTInternalMessageParser.h>
|
||||
#import <MTProtoKit/MTMsgContainerMessage.h>
|
||||
#import <MTProtoKit/MTMessage.h>
|
||||
#import <MTProtoKit/MTBadMsgNotificationMessage.h>
|
||||
#import <MTProtoKit/MTMsgsAckMessage.h>
|
||||
#import <MTProtoKit/MTMsgDetailedInfoMessage.h>
|
||||
#import <MTProtoKit/MTNewSessionCreatedMessage.h>
|
||||
#import <MTProtoKit/MTPongMessage.h>
|
||||
|
||||
typedef enum {
|
||||
MTProtoStateAwaitingDatacenterScheme = 1,
|
||||
MTProtoStateAwaitingDatacenterAuthorization = 2,
|
||||
@ -674,6 +684,16 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
}];
|
||||
}
|
||||
|
||||
- (NSString *)outgoingMessageDescription:(MTOutgoingMessage *)message
|
||||
{
|
||||
return [[NSString alloc] initWithFormat:@"%@ (%" PRId64 "/%" PRId32 ")", message.metadata, message.messageId, message.messageSeqNo];
|
||||
}
|
||||
|
||||
- (NSString *)incomingMessageDescription:(MTIncomingMessage *)message
|
||||
{
|
||||
return [[NSString alloc] initWithFormat:@"%@ (%" PRId64")", message.body, message.messageId];
|
||||
}
|
||||
|
||||
- (void)transportReadyForTransaction:(MTTransport *)transport transportSpecificTransaction:(MTMessageTransaction *)transportSpecificTransaction forceConfirmations:(bool)forceConfirmations transactionReady:(void (^)(NSArray *))transactionReady
|
||||
{
|
||||
[[MTProto managerQueue] dispatchOnQueue:^
|
||||
@ -732,8 +752,16 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
NSArray *scheduledMessageConfirmations = [transactionSessionInfo scheduledMessageConfirmations];
|
||||
if (scheduledMessageConfirmations.count != 0)
|
||||
{
|
||||
NSData *msgsAckData = [_context.serialization serializeMessage:[_context.serialization msgsAck:scheduledMessageConfirmations]];
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:msgsAckData];
|
||||
MTBuffer *msgsAckBuffer = [[MTBuffer alloc] init];
|
||||
[msgsAckBuffer appendInt32:(int32_t)0x62d6b459];
|
||||
[msgsAckBuffer appendInt32:481674261];
|
||||
[msgsAckBuffer appendInt32:(int32_t)scheduledMessageConfirmations.count];
|
||||
for (NSNumber *nMessageId in scheduledMessageConfirmations)
|
||||
{
|
||||
[msgsAckBuffer appendInt64:(int64_t)[nMessageId longLongValue]];
|
||||
}
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:msgsAckBuffer.data metadata:@"msgsAck"];
|
||||
outgoingMessage.requiresConfirmation = false;
|
||||
|
||||
[messageTransactions addObject:[[MTMessageTransaction alloc] initWithMessagePayload:@[outgoingMessage] completion:^(__unused NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
@ -794,7 +822,7 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
messageSeqNo = outgoingMessage.messageSeqNo;
|
||||
}
|
||||
|
||||
MTLog(@"[MTProto#%p preparing %@]", self, [_context.serialization messageDescription:messageData messageId:messageId messageSeqNo:messageSeqNo]);
|
||||
MTLog(@"[MTProto#%p preparing %@]", self, [self outgoingMessageDescription:outgoingMessage]);
|
||||
|
||||
if (!monotonityViolated || _useUnauthorizedMode)
|
||||
{
|
||||
@ -1038,12 +1066,15 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
int64_t randomId = 0;
|
||||
arc4random_buf(&randomId, 8);
|
||||
|
||||
id ping = [_context.serialization ping:randomId];
|
||||
NSData *messageData = [_context.serialization serializeMessage:ping];
|
||||
MTBuffer *pingBuffer = [[MTBuffer alloc] init];
|
||||
[pingBuffer appendInt32:(int32_t)0x7abe77ec];
|
||||
[pingBuffer appendInt64:randomId];
|
||||
|
||||
NSData *messageData = pingBuffer.data;
|
||||
|
||||
MTOutputStream *decryptedOs = [[MTOutputStream alloc] init];
|
||||
|
||||
MTLog(@"[MTProto#%x sending time fix %@ (%" PRId64 "/%" PRId32 ")]", self, NSStringFromClass([ping class]), timeFixMessageId, timeFixSeqNo);
|
||||
MTLog(@"[MTProto#%x sending time fix ping (%" PRId64 "/%" PRId32 ")]", self, timeFixMessageId, timeFixSeqNo);
|
||||
|
||||
[decryptedOs writeInt64:[_authInfo authSaltForMessageId:timeFixMessageId]]; // salt
|
||||
[decryptedOs writeInt64:_sessionInfo.sessionId];
|
||||
@ -1603,6 +1634,15 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
return decryptedData;
|
||||
}
|
||||
|
||||
- (id)parseMessage:(NSData *)data
|
||||
{
|
||||
id internalMessage = [MTInternalMessageParser parseMessage:data];
|
||||
if (internalMessage != nil)
|
||||
return internalMessage;
|
||||
|
||||
return [_context.serialization parseMessage:data];
|
||||
}
|
||||
|
||||
- (NSArray *)_parseIncomingMessages:(NSData *)data dataMessageId:(out int64_t *)dataMessageId parseError:(out bool *)parseError
|
||||
{
|
||||
MTInputStream *is = [[MTInputStream alloc] initWithData:data];
|
||||
@ -1693,26 +1733,17 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
}
|
||||
}
|
||||
|
||||
id topObject = [_context.serialization parseMessage:[is wrappedInputStream] responseParsingBlock:^int32_t (int64_t requestMessageId, bool *requestFound)
|
||||
NSMutableData *topMessageData = [[NSMutableData alloc] init];
|
||||
uint8_t buffer[128];
|
||||
while (true)
|
||||
{
|
||||
for (id<MTMessageService> messageService in _messageServices)
|
||||
{
|
||||
if ([messageService respondsToSelector:@selector(possibleSignatureForResult:found:)])
|
||||
{
|
||||
bool found = false;
|
||||
int32_t possibleSignature = [messageService possibleSignatureForResult:requestMessageId found:&found];
|
||||
if (found)
|
||||
{
|
||||
if (requestFound != NULL)
|
||||
*requestFound = true;
|
||||
return possibleSignature;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}];
|
||||
NSInteger readBytes = [[is wrappedInputStream] read:buffer maxLength:128];
|
||||
if (readBytes <= 0)
|
||||
break;
|
||||
[topMessageData appendBytes:buffer length:readBytes];
|
||||
}
|
||||
|
||||
id topObject = [self parseMessage:topMessageData];
|
||||
if (topObject == nil)
|
||||
{
|
||||
if (parseError != NULL)
|
||||
@ -1725,35 +1756,39 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
NSMutableArray *messages = [[NSMutableArray alloc] init];
|
||||
NSTimeInterval timestamp = embeddedMessageId / 4294967296.0;
|
||||
|
||||
if ([_context.serialization isMessageContainer:topObject])
|
||||
if ([topObject isKindOfClass:[MTMsgContainerMessage class]])
|
||||
{
|
||||
for (id subObject in [_context.serialization containerMessages:topObject])
|
||||
for (MTMessage *subMessage in ((MTMsgContainerMessage *)topObject).messages)
|
||||
{
|
||||
if ([_context.serialization isMessageProtoMessage:subObject])
|
||||
id subObject = [self parseMessage:subMessage.data];
|
||||
if (subObject == nil)
|
||||
{
|
||||
int64_t subMessageId = 0;
|
||||
int32_t subMessageSeqNo = 0;
|
||||
int32_t subMessageLength = 0;
|
||||
id subMessageBody = [_context.serialization protoMessageBody:subObject messageId:&subMessageId seqNo:&subMessageSeqNo length:&subMessageLength];
|
||||
[messages addObject:[[MTIncomingMessage alloc] initWithMessageId:subMessageId seqNo:subMessageSeqNo salt:embeddedSalt timestamp:timestamp size:subMessageLength body:subMessageBody]];
|
||||
}
|
||||
if ([_context.serialization isMessageProtoCopyMessage:subObject])
|
||||
{
|
||||
int64_t subMessageId = 0;
|
||||
int32_t subMessageSeqNo = 0;
|
||||
int32_t subMessageLength = 0;
|
||||
id subMessageBody = [_context.serialization protoCopyMessageBody:subObject messageId:&subMessageId seqNo:&subMessageSeqNo length:&subMessageLength];
|
||||
[messages addObject:[[MTIncomingMessage alloc] initWithMessageId:subMessageId seqNo:subMessageSeqNo salt:embeddedSalt timestamp:timestamp size:subMessageLength body:subMessageBody]];
|
||||
if (parseError != NULL)
|
||||
*parseError = true;
|
||||
return nil;
|
||||
}
|
||||
|
||||
int64_t subMessageId = subMessage.messageId;
|
||||
int32_t subMessageSeqNo = subMessage.seqNo;
|
||||
int32_t subMessageLength = (int32_t)subMessage.data.length;
|
||||
[messages addObject:[[MTIncomingMessage alloc] initWithMessageId:subMessageId seqNo:subMessageSeqNo salt:embeddedSalt timestamp:timestamp size:subMessageLength body:subObject]];
|
||||
}
|
||||
}
|
||||
else if ([_context.serialization isMessageProtoCopyMessage:topObject])
|
||||
else if ([topObject isKindOfClass:[MTMessage class]])
|
||||
{
|
||||
int64_t subMessageId = 0;
|
||||
int32_t subMessageSeqNo = 0;
|
||||
int32_t subMessageLength = 0;
|
||||
id subMessageBody = [_context.serialization protoCopyMessageBody:topObject messageId:&subMessageId seqNo:&subMessageSeqNo length:&subMessageLength];
|
||||
[messages addObject:[[MTIncomingMessage alloc] initWithMessageId:subMessageId seqNo:subMessageSeqNo salt:embeddedSalt timestamp:timestamp size:subMessageLength body:subMessageBody]];
|
||||
MTMessage *message = topObject;
|
||||
id subObject = [self parseMessage:message.data];
|
||||
if (subObject == nil)
|
||||
{
|
||||
if (parseError != NULL)
|
||||
*parseError = true;
|
||||
return nil;
|
||||
}
|
||||
|
||||
int64_t subMessageId = message.messageId;
|
||||
int32_t subMessageSeqNo = message.seqNo;
|
||||
int32_t subMessageLength = (int32_t)message.data.length;
|
||||
[messages addObject:[[MTIncomingMessage alloc] initWithMessageId:subMessageId seqNo:subMessageSeqNo salt:embeddedSalt timestamp:timestamp size:subMessageLength body:subObject]];
|
||||
}
|
||||
else
|
||||
[messages addObject:[[MTIncomingMessage alloc] initWithMessageId:embeddedMessageId seqNo:embeddedSeqNo salt:embeddedSalt timestamp:timestamp size:topMessageSize body:topObject]];
|
||||
@ -1774,7 +1809,7 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
return;
|
||||
}
|
||||
|
||||
MTLog(@"[MTProto#%p received %@]", self, [_context.serialization messageDescription:incomingMessage.body messageId:incomingMessage.messageId messageSeqNo:incomingMessage.seqNo]);
|
||||
MTLog(@"[MTProto#%p received %@]", self, [self incomingMessageDescription:incomingMessage]);
|
||||
|
||||
[_sessionInfo setMessageProcessed:incomingMessage.messageId];
|
||||
if (!_useUnauthorizedMode && incomingMessage.seqNo % 2 != 0)
|
||||
@ -1785,13 +1820,15 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
[self requestTransportTransaction];
|
||||
}
|
||||
|
||||
if (!_useUnauthorizedMode && [_context.serialization isMessageBadMsgNotification:incomingMessage.body])
|
||||
if (!_useUnauthorizedMode && [incomingMessage.body isKindOfClass:[MTBadMsgNotificationMessage class]])
|
||||
{
|
||||
int64_t badMessageId = [_context.serialization badMessageBadMessageId:incomingMessage.body];
|
||||
MTBadMsgNotificationMessage *badMsgNotification = incomingMessage.body;
|
||||
|
||||
int64_t badMessageId = badMsgNotification.badMessageId;
|
||||
|
||||
NSArray *containerMessageIds = [_sessionInfo messageIdsInContainer:badMessageId];
|
||||
|
||||
if ([_context.serialization isMessageBadServerSaltNotification:incomingMessage.body])
|
||||
if ([badMsgNotification isKindOfClass:[MTBadServerSaltNotificationMessage class]])
|
||||
{
|
||||
if (_timeFixContext != nil && badMessageId == _timeFixContext.messageId)
|
||||
{
|
||||
@ -1811,7 +1848,7 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
}
|
||||
else*/
|
||||
{
|
||||
int64_t validSalt = [_context.serialization badMessageNewServerSalt:incomingMessage.body];
|
||||
int64_t validSalt = ((MTBadServerSaltNotificationMessage *)badMsgNotification).nextServerSalt;
|
||||
NSTimeInterval timeDifference = incomingMessage.messageId / 4294967296.0 - [[NSDate date] timeIntervalSince1970];
|
||||
[self completeTimeSync];
|
||||
[self timeSyncInfoChanged:timeDifference saltList:@[[[MTDatacenterSaltInfo alloc] initWithSalt:validSalt firstValidMessageId:incomingMessage.messageId lastValidMessageId:incomingMessage.messageId + (4294967296 * 30 * 60)]]];
|
||||
@ -1822,7 +1859,7 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ([_context.serialization badMessageErrorCode:incomingMessage.body])
|
||||
switch (badMsgNotification.errorCode)
|
||||
{
|
||||
case 16:
|
||||
case 17:
|
||||
@ -1878,9 +1915,9 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
if ([self canAskForTransactions] || [self canAskForServiceTransactions])
|
||||
[self requestTransportTransaction];
|
||||
}
|
||||
else if ([_context.serialization isMessageMsgsAck:incomingMessage.body])
|
||||
else if ([incomingMessage.body isKindOfClass:[MTMsgsAckMessage class]])
|
||||
{
|
||||
NSArray *messageIds = [_context.serialization msgsAckMessageIds:incomingMessage.body];
|
||||
NSArray *messageIds = ((MTMsgsAckMessage *)incomingMessage.body).messageIds;
|
||||
|
||||
for (NSInteger i = (NSInteger)_messageServices.count - 1; i >= 0; i--)
|
||||
{
|
||||
@ -1890,13 +1927,15 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
[messageService mtProto:self messageDeliveryConfirmed:messageIds];
|
||||
}
|
||||
}
|
||||
else if ([_context.serialization isMessageDetailedInfo:incomingMessage.body])
|
||||
else if ([incomingMessage.body isKindOfClass:[MTMsgDetailedInfoMessage class]])
|
||||
{
|
||||
MTMsgDetailedInfoMessage *detailedInfoMessage = incomingMessage.body;
|
||||
|
||||
bool shouldRequest = false;
|
||||
|
||||
if ([_context.serialization isMessageDetailedResponseInfo:incomingMessage.body])
|
||||
if ([detailedInfoMessage isKindOfClass:[MTMsgDetailedResponseInfoMessage class]])
|
||||
{
|
||||
int64_t requestMessageId = [_context.serialization detailedInfoResponseRequestMessageId:incomingMessage.body];
|
||||
int64_t requestMessageId = ((MTMsgDetailedResponseInfoMessage *)detailedInfoMessage).requestMessageId;
|
||||
|
||||
MTLog(@"[MTProto#%p detailed info %" PRId64 " is for %" PRId64 "", self, incomingMessage.messageId, requestMessageId);
|
||||
|
||||
@ -1916,16 +1955,16 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
shouldRequest = true;
|
||||
|
||||
if (shouldRequest)
|
||||
[self requestMessageWithId:[_context.serialization detailedInfoResponseMessageId:incomingMessage.body]];
|
||||
[self requestMessageWithId:detailedInfoMessage.responseMessageId];
|
||||
else
|
||||
{
|
||||
[_sessionInfo scheduleMessageConfirmation:[_context.serialization detailedInfoResponseMessageId:incomingMessage.body] size:(NSInteger)[_context.serialization detailedInfoResponseMessageLength:incomingMessage.body]];
|
||||
[_sessionInfo scheduleMessageConfirmation:detailedInfoMessage.responseMessageId size:(NSInteger)detailedInfoMessage.responseLength];
|
||||
[self requestTransportTransaction];
|
||||
}
|
||||
}
|
||||
else if ([_context.serialization isMessageNewSession:incomingMessage.body])
|
||||
else if ([incomingMessage.body isKindOfClass:[MTNewSessionCreatedMessage class]])
|
||||
{
|
||||
int64_t firstValidMessageId = [_context.serialization messageNewSessionFirstValidMessageId:incomingMessage.body];
|
||||
int64_t firstValidMessageId = ((MTNewSessionCreatedMessage *)incomingMessage.body).firstMessageId;
|
||||
|
||||
for (NSInteger i = (NSInteger)_messageServices.count - 1; i >= 0; i--)
|
||||
{
|
||||
@ -1945,7 +1984,7 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
|
||||
[messageService mtProto:self receivedMessage:incomingMessage];
|
||||
}
|
||||
|
||||
if (_timeFixContext != nil && [_context.serialization isMessagePong:incomingMessage.body] && [_context.serialization pongMessageId:incomingMessage.body] == _timeFixContext.messageId)
|
||||
if (_timeFixContext != nil && [incomingMessage.body isKindOfClass:[MTPongMessage class]] && ((MTPongMessage *)incomingMessage.body).messageId == _timeFixContext.messageId)
|
||||
{
|
||||
_timeFixContext = nil;
|
||||
[self completeTimeSync];
|
||||
|
@ -9,22 +9,29 @@
|
||||
@class MTRequestContext;
|
||||
@class MTRequestErrorContext;
|
||||
|
||||
#import <MTProtoKit/MTRpcError.h>
|
||||
|
||||
@interface MTRequest : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) id internalId;
|
||||
|
||||
@property (nonatomic) NSData *data;
|
||||
@property (nonatomic, strong, readonly) NSData *payload;
|
||||
@property (nonatomic, strong, readonly) id metadata;
|
||||
@property (nonatomic, strong, readonly) id (^responseParser)(NSData *);
|
||||
|
||||
@property (nonatomic, strong) NSArray *decorators;
|
||||
@property (nonatomic, strong) MTRequestContext *requestContext;
|
||||
@property (nonatomic, strong) MTRequestErrorContext *errorContext;
|
||||
@property (nonatomic) bool hasHighPriority;
|
||||
@property (nonatomic) bool dependsOnPasswordEntry;
|
||||
|
||||
@property (nonatomic, copy) void (^completed)(id result, NSTimeInterval completionTimestamp, id error);
|
||||
@property (nonatomic, copy) void (^completed)(id result, NSTimeInterval completionTimestamp, MTRpcError *error);
|
||||
@property (nonatomic, copy) void (^progressUpdated)(float progress, NSUInteger packetLength);
|
||||
@property (nonatomic, copy) void (^acknowledgementReceived)();
|
||||
|
||||
@property (nonatomic, copy) bool (^shouldContinueExecutionWithErrorContext)(MTRequestErrorContext *errorContext);
|
||||
@property (nonatomic, copy) bool (^shouldDependOnRequest)(MTRequest *anotherRequest);
|
||||
|
||||
- (void)setPayload:(NSData *)payload metadata:(id)metadata responseParser:(id (^)(NSData *))responseParser;
|
||||
|
||||
@end
|
||||
|
@ -61,4 +61,11 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setPayload:(NSData *)payload metadata:(id)metadata responseParser:(id (^)(NSData *))responseParser
|
||||
{
|
||||
_payload = payload;
|
||||
_metadata = metadata;
|
||||
_responseParser = [responseParser copy];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -26,6 +26,11 @@
|
||||
#import <MTProtoKit/MTDatacenterAuthInfo.h>
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
|
||||
#import <MTProtoKit/MTInternalMessageParser.h>
|
||||
#import <MTProtoKit/MTRpcResultMessage.h>
|
||||
#import <MTProtoKit/MTRpcError.h>
|
||||
#import <MTProtoKit/MTDropRpcResultMessage.h>
|
||||
|
||||
@interface MTRequestMessageService ()
|
||||
{
|
||||
MTContext *_context;
|
||||
@ -266,7 +271,7 @@
|
||||
|
||||
- (NSData *)decorateRequestData:(MTRequest *)request initializeApi:(bool)initializeApi unresolvedDependencyOnRequestInternalId:(__autoreleasing id *)unresolvedDependencyOnRequestInternalId
|
||||
{
|
||||
NSData *currentData = request.data;
|
||||
NSData *currentData = request.payload;
|
||||
|
||||
if (initializeApi && _apiEnvironment != nil)
|
||||
{
|
||||
@ -356,26 +361,30 @@
|
||||
messageSeqNo = request.requestContext.messageSeqNo;
|
||||
}
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:[self decorateRequestData:request initializeApi:requestsWillInitializeApi unresolvedDependencyOnRequestInternalId:&autoreleasingUnresolvedDependencyOnRequestInternalId] messageId:messageId messageSeqNo:messageSeqNo];
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:[self decorateRequestData:request initializeApi:requestsWillInitializeApi unresolvedDependencyOnRequestInternalId:&autoreleasingUnresolvedDependencyOnRequestInternalId] metadata:request.metadata messageId:messageId messageSeqNo:messageSeqNo];
|
||||
outgoingMessage.needsQuickAck = request.acknowledgementReceived != nil;
|
||||
outgoingMessage.hasHighPriority = request.hasHighPriority;
|
||||
|
||||
id unresolvedDependencyOnRequestInternalId = autoreleasingUnresolvedDependencyOnRequestInternalId;
|
||||
if (unresolvedDependencyOnRequestInternalId != nil)
|
||||
{
|
||||
id<MTSerialization> serialization = _serialization;
|
||||
|
||||
outgoingMessage.dynamicDecorator = ^id (id currentBody, NSDictionary *messageInternalIdToPreparedMessage)
|
||||
outgoingMessage.dynamicDecorator = ^id (NSData *currentData, NSDictionary *messageInternalIdToPreparedMessage)
|
||||
{
|
||||
id messageInternalId = requestInternalIdToMessageInternalId[unresolvedDependencyOnRequestInternalId];
|
||||
if (messageInternalId != nil)
|
||||
{
|
||||
MTPreparedMessage *preparedMessage = messageInternalIdToPreparedMessage[messageInternalId];
|
||||
if (preparedMessage != nil)
|
||||
return [serialization invokeAfterMessageId:preparedMessage.messageId query:currentBody];
|
||||
{
|
||||
MTBuffer *invokeAfterBuffer = [[MTBuffer alloc] init];
|
||||
[invokeAfterBuffer appendInt32:(int32_t)0xcb9f372d];
|
||||
[invokeAfterBuffer appendInt64:preparedMessage.messageId];
|
||||
[invokeAfterBuffer appendBytes:currentData.bytes length:currentData.length];
|
||||
return invokeAfterBuffer.data;
|
||||
}
|
||||
}
|
||||
|
||||
return currentBody;
|
||||
return currentData;
|
||||
};
|
||||
}
|
||||
|
||||
@ -392,9 +401,11 @@
|
||||
if (dropMessageIdToMessageInternalId == nil)
|
||||
dropMessageIdToMessageInternalId = [[NSMutableDictionary alloc] init];
|
||||
|
||||
NSData *dropAnswerData = [_serialization serializeMessage:[_serialization dropAnswerToMessageId:dropContext.dropMessageId]];
|
||||
MTBuffer *dropAnswerBuffer = [[MTBuffer alloc] init];
|
||||
[dropAnswerBuffer appendInt32:(int32_t)0x58e4a740];
|
||||
[dropAnswerBuffer appendInt64:dropContext.dropMessageId];
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:dropAnswerData messageId:dropContext.messageId messageSeqNo:dropContext.messageSeqNo];
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:dropAnswerBuffer.data metadata:@"dropAnswer" messageId:dropContext.messageId messageSeqNo:dropContext.messageSeqNo];
|
||||
outgoingMessage.requiresConfirmation = false;
|
||||
dropMessageIdToMessageInternalId[@(dropContext.dropMessageId)] = outgoingMessage.internalId;
|
||||
[messages addObject:outgoingMessage];
|
||||
@ -436,15 +447,19 @@
|
||||
|
||||
- (void)mtProto:(MTProto *)__unused mtProto receivedMessage:(MTIncomingMessage *)message
|
||||
{
|
||||
if ([_serialization isMessageRpcResult:message.body])
|
||||
if ([message.body isKindOfClass:[MTRpcResultMessage class]])
|
||||
{
|
||||
if ([_serialization isRpcDroppedAnswer:message.body])
|
||||
MTRpcResultMessage *rpcResultMessage = message.body;
|
||||
|
||||
id maybeInternalMessage = [MTInternalMessageParser parseMessage:rpcResultMessage.data];
|
||||
|
||||
if ([maybeInternalMessage isKindOfClass:[MTDropRpcResultMessage class]])
|
||||
{
|
||||
NSInteger index = -1;
|
||||
for (MTDropResponseContext *dropContext in _dropReponseContexts)
|
||||
{
|
||||
index++;
|
||||
if (dropContext.messageId == [_serialization rpcDropedAnswerDropMessageId:message.body])
|
||||
if (dropContext.messageId == rpcResultMessage.requestMessageId)
|
||||
{
|
||||
[_dropReponseContexts removeObjectAtIndex:(NSUInteger)index];
|
||||
break;
|
||||
@ -453,9 +468,6 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
int64_t requestMessageId = 0;
|
||||
id rpcResult = [_serialization rpcResultBody:message.body requestMessageId:&requestMessageId];
|
||||
|
||||
bool requestFound = false;
|
||||
|
||||
int index = -1;
|
||||
@ -463,18 +475,34 @@
|
||||
{
|
||||
index++;
|
||||
|
||||
if (request.requestContext != nil && request.requestContext.messageId == requestMessageId)
|
||||
if (request.requestContext != nil && request.requestContext.messageId == rpcResultMessage.requestMessageId)
|
||||
{
|
||||
requestFound = true;
|
||||
|
||||
bool restartRequest = false;
|
||||
|
||||
bool resultIsError = false;
|
||||
id object = [_serialization rpcResult:rpcResult requestBody:request.body isError:&resultIsError];
|
||||
id rpcResult = nil;
|
||||
MTRpcError *rpcError = nil;
|
||||
|
||||
MTLog(@"[MTRequestMessageService#%p response for %" PRId64 " is %@]", self, request.requestContext.messageId, [object class] == nil ? @"nil" : NSStringFromClass([object class]));
|
||||
if ([maybeInternalMessage isKindOfClass:[MTRpcError class]])
|
||||
rpcError = maybeInternalMessage;
|
||||
else
|
||||
{
|
||||
rpcResult = request.responseParser(rpcResultMessage.data);
|
||||
if (rpcResult == nil)
|
||||
rpcError = [[MTRpcError alloc] initWithErrorCode:400 errorDescription:@"INTERNAL_INVALID_RESPONSE"];
|
||||
}
|
||||
|
||||
if (object != nil && !resultIsError && request.requestContext.willInitializeApi)
|
||||
if (rpcResult != nil)
|
||||
{
|
||||
MTLog(@"[MTRequestMessageService#%p response for %" PRId64 " is %@]", self, request.requestContext.messageId, rpcResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
MTLog(@"[MTRequestMessageService#%p response for %" PRId64 " is error: %d: %@]", self, request.requestContext.messageId, (int)rpcError.errorCode, rpcError.errorDescription);
|
||||
}
|
||||
|
||||
if (rpcResult != nil && request.requestContext.willInitializeApi)
|
||||
{
|
||||
MTDatacenterAuthInfo *authInfo = [_context authInfoForDatacenterWithId:mtProto.datacenterId];
|
||||
|
||||
@ -488,15 +516,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (resultIsError)
|
||||
if (rpcError != nil)
|
||||
{
|
||||
MTLog(@"[MTRequestMessageService#%p in response to %" PRId64 " %@]", self, request.requestContext.messageId, [_serialization rpcErrorDescription:object]);
|
||||
|
||||
int32_t errorCode = [_serialization rpcErrorCode:object];
|
||||
NSString *errorText = [_serialization rpcErrorText:object];
|
||||
if (errorCode == 401)
|
||||
if (rpcError.errorCode == 401)
|
||||
{
|
||||
if ([errorText rangeOfString:@"SESSION_PASSWORD_NEEDED"].location != NSNotFound)
|
||||
if ([rpcError.errorDescription rangeOfString:@"SESSION_PASSWORD_NEEDED"].location != NSNotFound)
|
||||
{
|
||||
[_context updatePasswordInputRequiredForDatacenterWithId:mtProto.datacenterId required:true];
|
||||
}
|
||||
@ -507,7 +531,7 @@
|
||||
[delegate requestMessageServiceAuthorizationRequired:self];
|
||||
}
|
||||
}
|
||||
else if (errorCode == -500 || errorCode == 500)
|
||||
else if (rpcError.errorCode == -500 || rpcError.errorCode == 500)
|
||||
{
|
||||
if (request.errorContext == nil)
|
||||
request.errorContext = [[MTRequestErrorContext alloc] init];
|
||||
@ -519,16 +543,16 @@
|
||||
request.errorContext.minimalExecuteTime = MAX(request.errorContext.minimalExecuteTime, MTAbsoluteSystemTime() + 2.0);
|
||||
}
|
||||
}
|
||||
else if (errorCode == 420)
|
||||
else if (rpcError.errorCode == 420)
|
||||
{
|
||||
if (request.errorContext == nil)
|
||||
request.errorContext = [[MTRequestErrorContext alloc] init];
|
||||
|
||||
if ([errorText rangeOfString:@"FLOOD_WAIT_"].location != NSNotFound)
|
||||
if ([rpcError.errorDescription rangeOfString:@"FLOOD_WAIT_"].location != NSNotFound)
|
||||
{
|
||||
int errorWaitTime = 0;
|
||||
|
||||
NSScanner *scanner = [[NSScanner alloc] initWithString:errorText];
|
||||
NSScanner *scanner = [[NSScanner alloc] initWithString:rpcError.errorDescription];
|
||||
[scanner scanUpToString:@"FLOOD_WAIT_" intoString:nil];
|
||||
[scanner scanString:@"FLOOD_WAIT_" intoString:nil];
|
||||
if ([scanner scanInt:&errorWaitTime])
|
||||
@ -546,7 +570,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (errorCode == 400 && [errorText rangeOfString:@"CONNECTION_NOT_INITED"].location != NSNotFound)
|
||||
else if (rpcError.errorCode == 400 && [rpcError.errorDescription rangeOfString:@"CONNECTION_NOT_INITED"].location != NSNotFound)
|
||||
{
|
||||
[_context performBatchUpdates:^
|
||||
{
|
||||
@ -572,7 +596,7 @@
|
||||
else
|
||||
{
|
||||
if (request.completed)
|
||||
request.completed(resultIsError ? nil : object, message.timestamp, resultIsError ? object : nil);
|
||||
request.completed(rpcResult, message.timestamp, rpcError);
|
||||
|
||||
[_requests removeObjectAtIndex:(NSUInteger)index];
|
||||
}
|
||||
@ -745,7 +769,7 @@
|
||||
[mtProto requestTransportTransaction];
|
||||
}
|
||||
|
||||
- (int32_t)possibleSignatureForResult:(int64_t)messageId found:(bool *)found
|
||||
/*- (int32_t)possibleSignatureForResult:(int64_t)messageId found:(bool *)found
|
||||
{
|
||||
for (MTRequest *request in _requests)
|
||||
{
|
||||
@ -770,6 +794,6 @@
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
@end
|
||||
|
12
MTProtoKit/MTResPqMessage.h
Normal file
12
MTProtoKit/MTResPqMessage.h
Normal file
@ -0,0 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTResPqMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nonce;
|
||||
@property (nonatomic, strong, readonly) NSData *serverNonce;
|
||||
@property (nonatomic, strong, readonly) NSData *pq;
|
||||
@property (nonatomic, strong, readonly) NSArray *serverPublicKeyFingerprints;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce pq:(NSData *)pq serverPublicKeyFingerprints:(NSArray *)serverPublicKeyFingerprints;
|
||||
|
||||
@end
|
18
MTProtoKit/MTResPqMessage.m
Normal file
18
MTProtoKit/MTResPqMessage.m
Normal file
@ -0,0 +1,18 @@
|
||||
#import "MTResPqMessage.h"
|
||||
|
||||
@implementation MTResPqMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce pq:(NSData *)pq serverPublicKeyFingerprints:(NSArray *)serverPublicKeyFingerprints
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_nonce = nonce;
|
||||
_serverNonce = serverNonce;
|
||||
_pq = pq;
|
||||
_serverPublicKeyFingerprints = serverPublicKeyFingerprints;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -15,6 +15,8 @@
|
||||
#import <MTProtoKit/MTOutgoingMessage.h>
|
||||
#import <MTProtoKit/MTPreparedMessage.h>
|
||||
#import <MTProtoKit/MTIncomingMessage.h>
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
#import <MTProtoKit/MTMsgsStateInfoMessage.h>
|
||||
|
||||
@interface MTResendMessageService ()
|
||||
{
|
||||
@ -51,7 +53,15 @@
|
||||
{
|
||||
_currentRequestTransactionId = nil;
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithBody:[mtProto.context.serialization resendMessagesRequest:@[@(_messageId)]]];
|
||||
MTBuffer *resendRequestBuffer = [[MTBuffer alloc] init];
|
||||
[resendRequestBuffer appendInt32:(int32_t)0x7d861a08];
|
||||
[resendRequestBuffer appendInt32:481674261];
|
||||
[resendRequestBuffer appendInt32:1];
|
||||
[resendRequestBuffer appendInt64:_messageId];
|
||||
|
||||
NSData *resentMessagesRequestData = resendRequestBuffer.data;
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:resentMessagesRequestData metadata:@"resendMessages"];
|
||||
outgoingMessage.requiresConfirmation = false;
|
||||
|
||||
return [[MTMessageTransaction alloc] initWithMessagePayload:@[outgoingMessage] completion:^(NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
@ -123,7 +133,7 @@
|
||||
if ([delegate respondsToSelector:@selector(resendMessageServiceCompleted:)])
|
||||
[delegate resendMessageServiceCompleted:self];
|
||||
}
|
||||
else if ([mtProto.context.serialization isMessageMsgsStateInfo:message.body forInfoRequestMessageId:_currentRequestMessageId])
|
||||
else if ([message.body isKindOfClass:[MTMsgsStateInfoMessage class]] && ((MTMsgsStateInfoMessage *)message.body).requestMessageId)
|
||||
{
|
||||
id<MTResendMessageServiceDelegate> delegate = _delegate;
|
||||
if ([delegate respondsToSelector:@selector(resendMessageServiceCompleted:)])
|
||||
|
10
MTProtoKit/MTRpcError.h
Normal file
10
MTProtoKit/MTRpcError.h
Normal file
@ -0,0 +1,10 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTRpcError : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int32_t errorCode;
|
||||
@property (nonatomic, strong, readonly) NSString *errorDescription;
|
||||
|
||||
- (instancetype)initWithErrorCode:(int32_t)errorCode errorDescription:(NSString *)errorDescription;
|
||||
|
||||
@end
|
16
MTProtoKit/MTRpcError.m
Normal file
16
MTProtoKit/MTRpcError.m
Normal file
@ -0,0 +1,16 @@
|
||||
#import "MTRpcError.h"
|
||||
|
||||
@implementation MTRpcError
|
||||
|
||||
- (instancetype)initWithErrorCode:(int32_t)errorCode errorDescription:(NSString *)errorDescription
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_errorCode = errorCode;
|
||||
_errorDescription = errorDescription;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
12
MTProtoKit/MTRpcResultMessage.h
Normal file
12
MTProtoKit/MTRpcResultMessage.h
Normal file
@ -0,0 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class MTRpcError;
|
||||
|
||||
@interface MTRpcResultMessage : NSObject
|
||||
|
||||
@property (nonatomic, readonly) int64_t requestMessageId;
|
||||
@property (nonatomic, strong, readonly) NSData *data;
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessagId data:(NSData *)data;
|
||||
|
||||
@end
|
16
MTProtoKit/MTRpcResultMessage.m
Normal file
16
MTProtoKit/MTRpcResultMessage.m
Normal file
@ -0,0 +1,16 @@
|
||||
#import "MTRpcResultMessage.h"
|
||||
|
||||
@implementation MTRpcResultMessage
|
||||
|
||||
- (instancetype)initWithRequestMessageId:(int64_t)requestMessagId data:(NSData *)data
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_requestMessageId = requestMessagId;
|
||||
_data = data;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -8,114 +8,21 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <MTProtoKit/MTExportedAuthorizationData.h>
|
||||
#import <MTProtoKit/MTDatacenterAddressListData.h>
|
||||
|
||||
typedef MTExportedAuthorizationData *(^MTExportAuthorizationResponseParser)(NSData *);
|
||||
typedef MTDatacenterAddressListData *(^MTRequestDatacenterAddressListParser)(NSData *);
|
||||
|
||||
@protocol MTSerialization <NSObject>
|
||||
|
||||
- (NSUInteger)currentLayer;
|
||||
|
||||
- (NSData *)serializeMessage:(id)message;
|
||||
- (id)parseMessage:(NSInputStream *)is responseParsingBlock:(int32_t (^)(int64_t, bool *))responseParsingBlock;
|
||||
- (NSString *)messageDescription:(NSData *)messageData messageId:(int64_t)messageId messageSeqNo:(int32_t)messageSeqNo;
|
||||
- (id)parseMessage:(NSData *)data;
|
||||
|
||||
- (id)reqDhParams:(NSData *)nonce serverNonce:(NSData *)serverNonce p:(NSData *)p q:(NSData *)q publicKeyFingerprint:(int64_t)publicKeyFingerprint encryptedData:(NSData *)encryptedData;
|
||||
- (id)setDhParams:(NSData *)nonce serverNonce:(NSData *)serverNonce encryptedData:(NSData *)encryptedData;
|
||||
- (MTExportAuthorizationResponseParser)exportAuthorization:(int32_t)datacenterId data:(__autoreleasing NSData **)data;
|
||||
- (NSData *)importAuthorization:(int32_t)authId bytes:(NSData *)bytes;
|
||||
|
||||
- (id)pqInnerData:(NSData *)nonce serverNonce:(NSData *)serverNonce pq:(NSData *)pq p:(NSData *)p q:(NSData *)q newNonce:(NSData *)newNonce;
|
||||
- (id)clientDhInnerData:(NSData *)nonce serverNonce:(NSData *)serverNonce g_b:(NSData *)g_b retryId:(int32_t)retryId;
|
||||
|
||||
- (bool)isMessageResPq:(id)message;
|
||||
- (NSData *)resPqNonce:(id)message;
|
||||
- (NSData *)resPqServerNonce:(id)message;
|
||||
- (NSData *)resPqPq:(id)message;
|
||||
- (NSArray *)resPqServerPublicKeyFingerprints:(id)message;
|
||||
|
||||
- (bool)isMessageServerDhParams:(id)message;
|
||||
- (NSData *)serverDhParamsNonce:(id)message;
|
||||
- (NSData *)serverDhParamsServerNonce:(id)message;
|
||||
- (bool)isMessageServerDhParamsOk:(id)message;
|
||||
- (NSData *)serverDhParamsOkEncryptedAnswer:(id)message;
|
||||
|
||||
- (bool)isMessageServerDhInnerData:(id)message;
|
||||
- (NSData *)serverDhInnerDataNonce:(id)message;
|
||||
- (NSData *)serverDhInnerDataServerNonce:(id)message;
|
||||
- (int32_t)serverDhInnerDataG:(id)message;
|
||||
- (NSData *)serverDhInnerDataDhPrime:(id)message;
|
||||
- (NSData *)serverDhInnerDataGA:(id)message;
|
||||
|
||||
- (bool)isMessageSetClientDhParamsAnswer:(id)message;
|
||||
- (bool)isMessageSetClientDhParamsAnswerOk:(id)message;
|
||||
- (bool)isMessageSetClientDhParamsAnswerRetry:(id)message;
|
||||
- (bool)isMessageSetClientDhParamsAnswerFail:(id)message;
|
||||
- (NSData *)setClientDhParamsNonce:(id)message;
|
||||
- (NSData *)setClientDhParamsServerNonce:(id)message;
|
||||
- (NSData *)setClientDhParamsNewNonceHash1:(id)message;
|
||||
- (NSData *)setClientDhParamsNewNonceHash2:(id)message;
|
||||
- (NSData *)setClientDhParamsNewNonceHash3:(id)message;
|
||||
|
||||
- (id)exportAuthorization:(int32_t)datacenterId;
|
||||
- (NSData *)exportedAuthorizationBytes:(id)message;
|
||||
- (int32_t)exportedAuthorizationId:(id)message;
|
||||
|
||||
- (id)importAuthorization:(int32_t)authId bytes:(NSData *)bytes;
|
||||
|
||||
- (id)getConfig;
|
||||
- (NSArray *)datacenterAddressListFromConfig:(id)config datacenterId:(NSInteger)datacenterId;
|
||||
|
||||
- (id)getFutureSalts:(int32_t)count;
|
||||
- (bool)isMessageFutureSalts:(id)message;
|
||||
- (int64_t)futureSaltsRequestMessageId:(id)message;
|
||||
- (NSArray *)saltInfoListFromMessage:(id)message;
|
||||
|
||||
- (id)resendMessagesRequest:(NSArray *)messageIds;
|
||||
|
||||
- (id)connectionWithApiId:(int32_t)apiId deviceModel:(NSString *)deviceModel systemVersion:(NSString *)systemVersion appVersion:(NSString *)appVersion langCode:(NSString *)langCode query:(id)query;
|
||||
- (id)invokeAfterMessageId:(int64_t)messageId query:(id)query;
|
||||
|
||||
- (bool)isMessageContainer:(id)message;
|
||||
- (NSArray *)containerMessages:(id)message;
|
||||
- (bool)isMessageProtoMessage:(id)message;
|
||||
- (id)protoMessageBody:(id)message messageId:(int64_t *)messageId seqNo:(int32_t *)seqNo length:(int32_t *)length;
|
||||
- (bool)isMessageProtoCopyMessage:(id)message;
|
||||
- (id)protoCopyMessageBody:(id)message messageId:(int64_t *)messageId seqNo:(int32_t *)seqNo length:(int32_t *)length;
|
||||
|
||||
- (bool)isMessageRpcWithLayer:(id)message;
|
||||
- (id)wrapInLayer:(id)message;
|
||||
- (id)dropAnswerToMessageId:(int64_t)messageId;
|
||||
- (bool)isRpcDroppedAnswer:(id)message;
|
||||
- (int64_t)rpcDropedAnswerDropMessageId:(id)message;
|
||||
- (bool)isMessageRpcResult:(id)message;
|
||||
- (id)rpcResultBody:(id)message requestMessageId:(int64_t *)requestMessageId;
|
||||
- (id)rpcResult:(id)resultBody requestBody:(id)requestBody isError:(bool *)isError;
|
||||
- (int32_t)rpcRequestBodyResponseSignature:(id)requestBody;
|
||||
- (NSString *)rpcErrorDescription:(id)error;
|
||||
- (int32_t)rpcErrorCode:(id)error;
|
||||
- (NSString *)rpcErrorText:(id)error;
|
||||
|
||||
- (id)ping:(int64_t)pingId;
|
||||
- (bool)isMessagePong:(id)message;
|
||||
- (int64_t)pongMessageId:(id)message;
|
||||
- (int64_t)pongPingId:(id)message;
|
||||
|
||||
- (id)msgsAck:(NSArray *)messageIds;
|
||||
- (bool)isMessageMsgsAck:(id)message;
|
||||
- (NSArray *)msgsAckMessageIds:(id)message;
|
||||
|
||||
- (bool)isMessageBadMsgNotification:(id)message;
|
||||
- (int64_t)badMessageBadMessageId:(id)message;
|
||||
- (bool)isMessageBadServerSaltNotification:(id)message;
|
||||
- (int64_t)badMessageNewServerSalt:(id)message;
|
||||
- (int32_t)badMessageErrorCode:(id)message;
|
||||
|
||||
- (bool)isMessageDetailedInfo:(id)message;
|
||||
- (bool)isMessageDetailedResponseInfo:(id)message;
|
||||
- (int64_t)detailedInfoResponseRequestMessageId:(id)message;
|
||||
- (int64_t)detailedInfoResponseMessageId:(id)message;
|
||||
- (int64_t)detailedInfoResponseMessageLength:(id)message;
|
||||
|
||||
- (bool)isMessageMsgsStateInfo:(id)message forInfoRequestMessageId:(int64_t)infoRequestMessageId;
|
||||
|
||||
- (bool)isMessageNewSession:(id)message;
|
||||
- (int64_t)messageNewSessionFirstValidMessageId:(id)message;
|
||||
|
||||
- (id)httpWaitWithMaxDelay:(int32_t)maxDelay waitAfter:(int32_t)waitAfter maxWait:(int32_t)maxWait;
|
||||
- (MTRequestDatacenterAddressListParser)requestDatacenterAddressList:(int32_t)datacenterId data:(__autoreleasing NSData **)data;
|
||||
|
||||
@end
|
||||
|
14
MTProtoKit/MTServerDhInnerDataMessage.h
Normal file
14
MTProtoKit/MTServerDhInnerDataMessage.h
Normal file
@ -0,0 +1,14 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTServerDhInnerDataMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nonce;
|
||||
@property (nonatomic, strong, readonly) NSData *serverNonce;
|
||||
@property (nonatomic, readonly) int32_t g;
|
||||
@property (nonatomic, strong, readonly) NSData *dhPrime;
|
||||
@property (nonatomic, strong, readonly) NSData *gA;
|
||||
@property (nonatomic, readonly) int32_t serverTime;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce g:(int32_t)g dhPrime:(NSData *)dhPrime gA:(NSData *)gA serverTime:(int32_t)serverTime;
|
||||
|
||||
@end
|
20
MTProtoKit/MTServerDhInnerDataMessage.m
Normal file
20
MTProtoKit/MTServerDhInnerDataMessage.m
Normal file
@ -0,0 +1,20 @@
|
||||
#import "MTServerDhInnerDataMessage.h"
|
||||
|
||||
@implementation MTServerDhInnerDataMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce g:(int32_t)g dhPrime:(NSData *)dhPrime gA:(NSData *)gA serverTime:(int32_t)serverTime
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_nonce = nonce;
|
||||
_serverNonce = serverNonce;
|
||||
_g = g;
|
||||
_dhPrime = dhPrime;
|
||||
_gA = gA;
|
||||
_serverTime = serverTime;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
24
MTProtoKit/MTServerDhParamsMessage.h
Normal file
24
MTProtoKit/MTServerDhParamsMessage.h
Normal file
@ -0,0 +1,24 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTServerDhParamsMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nonce;
|
||||
@property (nonatomic, strong, readonly) NSData *serverNonce;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTServerDhParamsFailMessage : MTServerDhParamsMessage
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nextNonceHash;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash:(NSData *)nextNonceHash;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTServerDhParamsOkMessage : MTServerDhParamsMessage
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *encryptedResponse;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce encryptedResponse:(NSData *)encryptedResponse;
|
||||
|
||||
@end
|
44
MTProtoKit/MTServerDhParamsMessage.m
Normal file
44
MTProtoKit/MTServerDhParamsMessage.m
Normal file
@ -0,0 +1,44 @@
|
||||
#import "MTServerDhParamsMessage.h"
|
||||
|
||||
@implementation MTServerDhParamsMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_nonce = nonce;
|
||||
_serverNonce = serverNonce;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTServerDhParamsFailMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash:(NSData *)nextNonceHash
|
||||
{
|
||||
self = [super initWithNonce:nonce serverNonce:serverNonce];
|
||||
if (self != nil)
|
||||
{
|
||||
_nextNonceHash = nextNonceHash;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTServerDhParamsOkMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce encryptedResponse:(NSData *)encryptedResponse
|
||||
{
|
||||
self = [super initWithNonce:nonce serverNonce:serverNonce];
|
||||
if (self != nil)
|
||||
{
|
||||
_encryptedResponse = encryptedResponse;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
32
MTProtoKit/MTSetClientDhParamsResponseMessage.h
Normal file
32
MTProtoKit/MTSetClientDhParamsResponseMessage.h
Normal file
@ -0,0 +1,32 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MTSetClientDhParamsResponseMessage : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nonce;
|
||||
@property (nonatomic, strong, readonly) NSData *serverNonce;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTSetClientDhParamsResponseOkMessage : MTSetClientDhParamsResponseMessage
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nextNonceHash1;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash1:(NSData *)nextNonceHash1;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTSetClientDhParamsResponseRetryMessage : MTSetClientDhParamsResponseMessage
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nextNonceHash2;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash2:(NSData *)newNonceHash2;
|
||||
|
||||
@end
|
||||
|
||||
@interface MTSetClientDhParamsResponseFailMessage : MTSetClientDhParamsResponseMessage
|
||||
|
||||
@property (nonatomic, strong, readonly) NSData *nextNonceHash3;
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash3:(NSData *)newNonceHash3;
|
||||
|
||||
@end
|
58
MTProtoKit/MTSetClientDhParamsResponseMessage.m
Normal file
58
MTProtoKit/MTSetClientDhParamsResponseMessage.m
Normal file
@ -0,0 +1,58 @@
|
||||
#import "MTSetClientDhParamsResponseMessage.h"
|
||||
|
||||
@implementation MTSetClientDhParamsResponseMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_nonce = nonce;
|
||||
_serverNonce = serverNonce;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTSetClientDhParamsResponseOkMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash1:(NSData *)nextNonceHash1
|
||||
{
|
||||
self = [super initWithNonce:nonce serverNonce:serverNonce];
|
||||
if (self != nil)
|
||||
{
|
||||
_nextNonceHash1 = nextNonceHash1;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTSetClientDhParamsResponseRetryMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash2:(NSData *)nextNonceHash2
|
||||
{
|
||||
self = [super initWithNonce:nonce serverNonce:serverNonce];
|
||||
if (self != nil)
|
||||
{
|
||||
_nextNonceHash2 = nextNonceHash2;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MTSetClientDhParamsResponseFailMessage
|
||||
|
||||
- (instancetype)initWithNonce:(NSData *)nonce serverNonce:(NSData *)serverNonce nextNonceHash3:(NSData *)nextNonceHash3
|
||||
{
|
||||
self = [super initWithNonce:nonce serverNonce:serverNonce];
|
||||
if (self != nil)
|
||||
{
|
||||
_nextNonceHash3 = nextNonceHash3;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
@ -24,6 +24,8 @@
|
||||
#import <MTProtoKit/MTTcpConnectionBehaviour.h>
|
||||
|
||||
#import <MTProtoKit/MTSerialization.h>
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
#import <MTProtoKit/MTPongMessage.h>
|
||||
|
||||
static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
||||
|
||||
@ -536,7 +538,12 @@ static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
||||
|
||||
int64_t randomId = 0;
|
||||
arc4random_buf(&randomId, 8);
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithBody:[self.context.serialization ping:randomId]];
|
||||
|
||||
MTBuffer *pingBuffer = [[MTBuffer alloc] init];
|
||||
[pingBuffer appendInt32:(int32_t)0x7abe77ec];
|
||||
[pingBuffer appendInt64:randomId];
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:pingBuffer.data metadata:@"ping"];
|
||||
outgoingMessage.requiresConfirmation = false;
|
||||
|
||||
__weak MTTcpTransport *weakSelf = self;
|
||||
@ -652,11 +659,11 @@ static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
||||
|
||||
- (void)mtProto:(MTProto *)__unused mtProto receivedMessage:(MTIncomingMessage *)incomingMessage
|
||||
{
|
||||
if ([self.context.serialization isMessagePong:incomingMessage.body])
|
||||
if ([incomingMessage.body isKindOfClass:[MTPongMessage class]])
|
||||
{
|
||||
[[MTTcpTransport tcpTransportQueue] dispatchOnQueue:^
|
||||
{
|
||||
if (_currentActualizationPingMessageId != 0 && [self.context.serialization pongMessageId:incomingMessage.body] == _currentActualizationPingMessageId)
|
||||
if (_currentActualizationPingMessageId != 0 && ((MTPongMessage *)incomingMessage.body).messageId == _currentActualizationPingMessageId)
|
||||
{
|
||||
[self stopActualizationPingResendTimer];
|
||||
|
||||
|
@ -16,8 +16,9 @@
|
||||
#import <MTProtoKit/MTIncomingMessage.h>
|
||||
#import <MTProtoKit/MTPreparedMessage.h>
|
||||
#import <MTProtoKit/MTMessageTransaction.h>
|
||||
|
||||
#import <MTProtoKit/MTDatacenterSaltInfo.h>
|
||||
#import <MTProtoKit/MTBuffer.h>
|
||||
#import <MTProtoKit/MTFutureSaltsMessage.h>
|
||||
|
||||
@interface MTTimeSyncMessageService ()
|
||||
{
|
||||
@ -60,7 +61,11 @@
|
||||
_currentTransactionId = nil;
|
||||
_currentSampleAbsoluteStartTime = 0.0;
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithBody:[mtProto.context.serialization getFutureSalts:_futureSalts.count != 0 ? 1 : 32]];
|
||||
MTBuffer *getFutureSaltsBuffer = [[MTBuffer alloc] init];
|
||||
[getFutureSaltsBuffer appendInt32:(int32_t)0xb921bd04];
|
||||
[getFutureSaltsBuffer appendInt32:_futureSalts.count != 0 ? 1 : 32];
|
||||
|
||||
MTOutgoingMessage *outgoingMessage = [[MTOutgoingMessage alloc] initWithData:getFutureSaltsBuffer.data metadata:@"getFutureSalts"];
|
||||
|
||||
return [[MTMessageTransaction alloc] initWithMessagePayload:@[outgoingMessage] completion:^(NSDictionary *messageInternalIdToTransactionId, NSDictionary *messageInternalIdToPreparedMessage, __unused NSDictionary *messageInternalIdToQuickAckId)
|
||||
{
|
||||
@ -132,12 +137,18 @@
|
||||
|
||||
- (void)mtProto:(MTProto *)mtProto receivedMessage:(MTIncomingMessage *)message
|
||||
{
|
||||
if ([mtProto.context.serialization isMessageFutureSalts:message.body] && [mtProto.context.serialization futureSaltsRequestMessageId:message.body] == _currentMessageId)
|
||||
if ([message.body isKindOfClass:[MTFutureSaltsMessage class]] && ((MTFutureSaltsMessage *)message.body).requestMessageId == _currentMessageId)
|
||||
{
|
||||
_currentMessageId = 0;
|
||||
_currentTransactionId = nil;
|
||||
|
||||
[_futureSalts addObjectsFromArray:[mtProto.context.serialization saltInfoListFromMessage:message.body]];
|
||||
NSMutableArray *saltList = [[NSMutableArray alloc] init];
|
||||
for (MTFutureSalt *futureSalt in ((MTFutureSaltsMessage *)message.body).salts)
|
||||
{
|
||||
[saltList addObject:[[MTDatacenterSaltInfo alloc] initWithSalt:futureSalt.salt firstValidMessageId:futureSalt.validSince * 4294967296 lastValidMessageId:futureSalt.validUntil * 4294967296]];
|
||||
}
|
||||
|
||||
[_futureSalts addObjectsFromArray:saltList];
|
||||
|
||||
NSTimeInterval timeDifference = message.messageId / 4294967296.0 - [[NSDate date] timeIntervalSince1970];
|
||||
[_takenSamples addObject:@(timeDifference)];
|
||||
|
@ -98,6 +98,56 @@
|
||||
D0254CC618B10404009452AA /* MTEncryption.h in Headers */ = {isa = PBXBuildFile; fileRef = D0254CC518B10404009452AA /* MTEncryption.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D04AC0081A3D14C600869014 /* MTBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0061A3D14C600869014 /* MTBuffer.h */; };
|
||||
D04AC0091A3D14C600869014 /* MTBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0071A3D14C600869014 /* MTBuffer.m */; };
|
||||
D04AC00D1A3D28E800869014 /* MTRpcResultMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC00B1A3D28E800869014 /* MTRpcResultMessage.h */; };
|
||||
D04AC00E1A3D28E800869014 /* MTRpcResultMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC00C1A3D28E800869014 /* MTRpcResultMessage.m */; };
|
||||
D04AC0111A3D297400869014 /* MTRpcError.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC00F1A3D297400869014 /* MTRpcError.h */; };
|
||||
D04AC0121A3D297400869014 /* MTRpcError.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0101A3D297400869014 /* MTRpcError.m */; };
|
||||
D04AC0151A3D2A1200869014 /* MTResPqMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0131A3D2A1200869014 /* MTResPqMessage.h */; };
|
||||
D04AC0161A3D2A1200869014 /* MTResPqMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0141A3D2A1200869014 /* MTResPqMessage.m */; };
|
||||
D04AC0191A3D2ACB00869014 /* MTServerDhParamsMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0171A3D2ACB00869014 /* MTServerDhParamsMessage.h */; };
|
||||
D04AC01A1A3D2ACB00869014 /* MTServerDhParamsMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0181A3D2ACB00869014 /* MTServerDhParamsMessage.m */; };
|
||||
D04AC01D1A3D2C3C00869014 /* MTMsgsAckMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC01B1A3D2C3C00869014 /* MTMsgsAckMessage.h */; };
|
||||
D04AC01E1A3D2C3C00869014 /* MTMsgsAckMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC01C1A3D2C3C00869014 /* MTMsgsAckMessage.m */; };
|
||||
D04AC0211A3D2EC400869014 /* MTInternalMessageParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC01F1A3D2EC400869014 /* MTInternalMessageParser.h */; };
|
||||
D04AC0221A3D2EC400869014 /* MTInternalMessageParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0201A3D2EC400869014 /* MTInternalMessageParser.m */; };
|
||||
D04AC0251A3D2F9600869014 /* MTBufferReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0231A3D2F9600869014 /* MTBufferReader.h */; };
|
||||
D04AC0261A3D2F9600869014 /* MTBufferReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0241A3D2F9600869014 /* MTBufferReader.m */; };
|
||||
D04AC0291A3D34C600869014 /* MTMsgsStateReqMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0271A3D34C600869014 /* MTMsgsStateReqMessage.h */; };
|
||||
D04AC02A1A3D34C600869014 /* MTMsgsStateReqMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0281A3D34C600869014 /* MTMsgsStateReqMessage.m */; };
|
||||
D04AC0311A3D35AD00869014 /* MTMsgsStateInfoMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC02F1A3D35AD00869014 /* MTMsgsStateInfoMessage.h */; };
|
||||
D04AC0321A3D35AD00869014 /* MTMsgsStateInfoMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0301A3D35AD00869014 /* MTMsgsStateInfoMessage.m */; };
|
||||
D04AC0351A3D367C00869014 /* MTMsgDetailedInfoMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0331A3D367C00869014 /* MTMsgDetailedInfoMessage.h */; };
|
||||
D04AC0361A3D367C00869014 /* MTMsgDetailedInfoMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0341A3D367C00869014 /* MTMsgDetailedInfoMessage.m */; };
|
||||
D04AC0411A3E297900869014 /* MTMsgAllInfoMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC03F1A3E297900869014 /* MTMsgAllInfoMessage.h */; };
|
||||
D04AC0421A3E297900869014 /* MTMsgAllInfoMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0401A3E297900869014 /* MTMsgAllInfoMessage.m */; };
|
||||
D04AC0491A3E2AA100869014 /* MTMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0471A3E2AA100869014 /* MTMessage.h */; };
|
||||
D04AC04A1A3E2AA100869014 /* MTMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0481A3E2AA100869014 /* MTMessage.m */; };
|
||||
D04AC04D1A3E2BCF00869014 /* MTMsgResendReqMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC04B1A3E2BCF00869014 /* MTMsgResendReqMessage.h */; };
|
||||
D04AC04E1A3E2BCF00869014 /* MTMsgResendReqMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC04C1A3E2BCF00869014 /* MTMsgResendReqMessage.m */; };
|
||||
D04AC0511A3E2C3700869014 /* MTBadMsgNotificationMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC04F1A3E2C3700869014 /* MTBadMsgNotificationMessage.h */; };
|
||||
D04AC0521A3E2C3700869014 /* MTBadMsgNotificationMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0501A3E2C3700869014 /* MTBadMsgNotificationMessage.m */; };
|
||||
D04AC0551A3E31B400869014 /* MTPongMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0531A3E31B400869014 /* MTPongMessage.h */; };
|
||||
D04AC0561A3E31B400869014 /* MTPongMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0541A3E31B400869014 /* MTPongMessage.m */; };
|
||||
D04AC0591A3E325700869014 /* MTPingMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0571A3E325700869014 /* MTPingMessage.h */; };
|
||||
D04AC05A1A3E325700869014 /* MTPingMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0581A3E325700869014 /* MTPingMessage.m */; };
|
||||
D04AC0611A3E37C900869014 /* MTNewSessionCreatedMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC05F1A3E37C900869014 /* MTNewSessionCreatedMessage.h */; };
|
||||
D04AC0621A3E37C900869014 /* MTNewSessionCreatedMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0601A3E37C900869014 /* MTNewSessionCreatedMessage.m */; };
|
||||
D04AC0651A3E387300869014 /* MTDestroySessionResponseMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0631A3E387300869014 /* MTDestroySessionResponseMessage.h */; };
|
||||
D04AC0661A3E387300869014 /* MTDestroySessionResponseMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0641A3E387300869014 /* MTDestroySessionResponseMessage.m */; };
|
||||
D04AC0691A3E3D7600869014 /* MTMsgContainerMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0671A3E3D7600869014 /* MTMsgContainerMessage.h */; };
|
||||
D04AC06A1A3E3D7600869014 /* MTMsgContainerMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0681A3E3D7600869014 /* MTMsgContainerMessage.m */; };
|
||||
D04AC06D1A3E698B00869014 /* MTDropRpcResultMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC06B1A3E698B00869014 /* MTDropRpcResultMessage.h */; };
|
||||
D04AC06E1A3E698B00869014 /* MTDropRpcResultMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC06C1A3E698B00869014 /* MTDropRpcResultMessage.m */; };
|
||||
D04AC0711A3E6EAB00869014 /* MTServerDhInnerDataMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC06F1A3E6EAB00869014 /* MTServerDhInnerDataMessage.h */; };
|
||||
D04AC0721A3E6EAB00869014 /* MTServerDhInnerDataMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0701A3E6EAB00869014 /* MTServerDhInnerDataMessage.m */; };
|
||||
D04AC0751A3E738A00869014 /* MTSetClientDhParamsResponseMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0731A3E738A00869014 /* MTSetClientDhParamsResponseMessage.h */; };
|
||||
D04AC0761A3E738A00869014 /* MTSetClientDhParamsResponseMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0741A3E738A00869014 /* MTSetClientDhParamsResponseMessage.m */; };
|
||||
D04AC0791A3E776200869014 /* MTFutureSaltsMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC0771A3E776200869014 /* MTFutureSaltsMessage.h */; };
|
||||
D04AC07A1A3E776200869014 /* MTFutureSaltsMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0781A3E776200869014 /* MTFutureSaltsMessage.m */; };
|
||||
D04AC07D1A3E881700869014 /* MTExportedAuthorizationData.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC07B1A3E881700869014 /* MTExportedAuthorizationData.h */; };
|
||||
D04AC07E1A3E881700869014 /* MTExportedAuthorizationData.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC07C1A3E881700869014 /* MTExportedAuthorizationData.m */; };
|
||||
D04AC0811A3F45AD00869014 /* MTDatacenterAddressListData.h in Headers */ = {isa = PBXBuildFile; fileRef = D04AC07F1A3F45AD00869014 /* MTDatacenterAddressListData.h */; };
|
||||
D04AC0821A3F45AD00869014 /* MTDatacenterAddressListData.m in Sources */ = {isa = PBXBuildFile; fileRef = D04AC0801A3F45AD00869014 /* MTDatacenterAddressListData.m */; };
|
||||
D0503ADA18B027F80074C3FE /* MTOutputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = D0503AD818B027F80074C3FE /* MTOutputStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D0503ADB18B027F80074C3FE /* MTOutputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = D0503AD918B027F80074C3FE /* MTOutputStream.m */; };
|
||||
D0503ADE18B029480074C3FE /* MTInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = D0503ADC18B029480074C3FE /* MTInputStream.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -420,6 +470,56 @@
|
||||
D0254CC518B10404009452AA /* MTEncryption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTEncryption.h; path = MTProtoKit/MTEncryption.h; sourceTree = "<group>"; };
|
||||
D04AC0061A3D14C600869014 /* MTBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTBuffer.h; path = MTProtoKit/MTBuffer.h; sourceTree = "<group>"; };
|
||||
D04AC0071A3D14C600869014 /* MTBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTBuffer.m; path = MTProtoKit/MTBuffer.m; sourceTree = "<group>"; };
|
||||
D04AC00B1A3D28E800869014 /* MTRpcResultMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTRpcResultMessage.h; path = MTProtoKit/MTRpcResultMessage.h; sourceTree = "<group>"; };
|
||||
D04AC00C1A3D28E800869014 /* MTRpcResultMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTRpcResultMessage.m; path = MTProtoKit/MTRpcResultMessage.m; sourceTree = "<group>"; };
|
||||
D04AC00F1A3D297400869014 /* MTRpcError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTRpcError.h; path = MTProtoKit/MTRpcError.h; sourceTree = "<group>"; };
|
||||
D04AC0101A3D297400869014 /* MTRpcError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTRpcError.m; path = MTProtoKit/MTRpcError.m; sourceTree = "<group>"; };
|
||||
D04AC0131A3D2A1200869014 /* MTResPqMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTResPqMessage.h; path = MTProtoKit/MTResPqMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0141A3D2A1200869014 /* MTResPqMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTResPqMessage.m; path = MTProtoKit/MTResPqMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0171A3D2ACB00869014 /* MTServerDhParamsMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTServerDhParamsMessage.h; path = MTProtoKit/MTServerDhParamsMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0181A3D2ACB00869014 /* MTServerDhParamsMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTServerDhParamsMessage.m; path = MTProtoKit/MTServerDhParamsMessage.m; sourceTree = "<group>"; };
|
||||
D04AC01B1A3D2C3C00869014 /* MTMsgsAckMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgsAckMessage.h; path = MTProtoKit/MTMsgsAckMessage.h; sourceTree = "<group>"; };
|
||||
D04AC01C1A3D2C3C00869014 /* MTMsgsAckMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgsAckMessage.m; path = MTProtoKit/MTMsgsAckMessage.m; sourceTree = "<group>"; };
|
||||
D04AC01F1A3D2EC400869014 /* MTInternalMessageParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTInternalMessageParser.h; path = MTProtoKit/MTInternalMessageParser.h; sourceTree = "<group>"; };
|
||||
D04AC0201A3D2EC400869014 /* MTInternalMessageParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTInternalMessageParser.m; path = MTProtoKit/MTInternalMessageParser.m; sourceTree = "<group>"; };
|
||||
D04AC0231A3D2F9600869014 /* MTBufferReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTBufferReader.h; path = MTProtoKit/MTBufferReader.h; sourceTree = "<group>"; };
|
||||
D04AC0241A3D2F9600869014 /* MTBufferReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTBufferReader.m; path = MTProtoKit/MTBufferReader.m; sourceTree = "<group>"; };
|
||||
D04AC0271A3D34C600869014 /* MTMsgsStateReqMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgsStateReqMessage.h; path = MTProtoKit/MTMsgsStateReqMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0281A3D34C600869014 /* MTMsgsStateReqMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgsStateReqMessage.m; path = MTProtoKit/MTMsgsStateReqMessage.m; sourceTree = "<group>"; };
|
||||
D04AC02F1A3D35AD00869014 /* MTMsgsStateInfoMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgsStateInfoMessage.h; path = MTProtoKit/MTMsgsStateInfoMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0301A3D35AD00869014 /* MTMsgsStateInfoMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgsStateInfoMessage.m; path = MTProtoKit/MTMsgsStateInfoMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0331A3D367C00869014 /* MTMsgDetailedInfoMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgDetailedInfoMessage.h; path = MTProtoKit/MTMsgDetailedInfoMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0341A3D367C00869014 /* MTMsgDetailedInfoMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgDetailedInfoMessage.m; path = MTProtoKit/MTMsgDetailedInfoMessage.m; sourceTree = "<group>"; };
|
||||
D04AC03F1A3E297900869014 /* MTMsgAllInfoMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgAllInfoMessage.h; path = MTProtoKit/MTMsgAllInfoMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0401A3E297900869014 /* MTMsgAllInfoMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgAllInfoMessage.m; path = MTProtoKit/MTMsgAllInfoMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0471A3E2AA100869014 /* MTMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMessage.h; path = MTProtoKit/MTMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0481A3E2AA100869014 /* MTMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMessage.m; path = MTProtoKit/MTMessage.m; sourceTree = "<group>"; };
|
||||
D04AC04B1A3E2BCF00869014 /* MTMsgResendReqMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgResendReqMessage.h; path = MTProtoKit/MTMsgResendReqMessage.h; sourceTree = "<group>"; };
|
||||
D04AC04C1A3E2BCF00869014 /* MTMsgResendReqMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgResendReqMessage.m; path = MTProtoKit/MTMsgResendReqMessage.m; sourceTree = "<group>"; };
|
||||
D04AC04F1A3E2C3700869014 /* MTBadMsgNotificationMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTBadMsgNotificationMessage.h; path = MTProtoKit/MTBadMsgNotificationMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0501A3E2C3700869014 /* MTBadMsgNotificationMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTBadMsgNotificationMessage.m; path = MTProtoKit/MTBadMsgNotificationMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0531A3E31B400869014 /* MTPongMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTPongMessage.h; path = MTProtoKit/MTPongMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0541A3E31B400869014 /* MTPongMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTPongMessage.m; path = MTProtoKit/MTPongMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0571A3E325700869014 /* MTPingMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTPingMessage.h; path = MTProtoKit/MTPingMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0581A3E325700869014 /* MTPingMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTPingMessage.m; path = MTProtoKit/MTPingMessage.m; sourceTree = "<group>"; };
|
||||
D04AC05F1A3E37C900869014 /* MTNewSessionCreatedMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTNewSessionCreatedMessage.h; path = MTProtoKit/MTNewSessionCreatedMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0601A3E37C900869014 /* MTNewSessionCreatedMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTNewSessionCreatedMessage.m; path = MTProtoKit/MTNewSessionCreatedMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0631A3E387300869014 /* MTDestroySessionResponseMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTDestroySessionResponseMessage.h; path = MTProtoKit/MTDestroySessionResponseMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0641A3E387300869014 /* MTDestroySessionResponseMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTDestroySessionResponseMessage.m; path = MTProtoKit/MTDestroySessionResponseMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0671A3E3D7600869014 /* MTMsgContainerMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTMsgContainerMessage.h; path = MTProtoKit/MTMsgContainerMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0681A3E3D7600869014 /* MTMsgContainerMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTMsgContainerMessage.m; path = MTProtoKit/MTMsgContainerMessage.m; sourceTree = "<group>"; };
|
||||
D04AC06B1A3E698B00869014 /* MTDropRpcResultMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTDropRpcResultMessage.h; path = MTProtoKit/MTDropRpcResultMessage.h; sourceTree = "<group>"; };
|
||||
D04AC06C1A3E698B00869014 /* MTDropRpcResultMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTDropRpcResultMessage.m; path = MTProtoKit/MTDropRpcResultMessage.m; sourceTree = "<group>"; };
|
||||
D04AC06F1A3E6EAB00869014 /* MTServerDhInnerDataMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTServerDhInnerDataMessage.h; path = MTProtoKit/MTServerDhInnerDataMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0701A3E6EAB00869014 /* MTServerDhInnerDataMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTServerDhInnerDataMessage.m; path = MTProtoKit/MTServerDhInnerDataMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0731A3E738A00869014 /* MTSetClientDhParamsResponseMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTSetClientDhParamsResponseMessage.h; path = MTProtoKit/MTSetClientDhParamsResponseMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0741A3E738A00869014 /* MTSetClientDhParamsResponseMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTSetClientDhParamsResponseMessage.m; path = MTProtoKit/MTSetClientDhParamsResponseMessage.m; sourceTree = "<group>"; };
|
||||
D04AC0771A3E776200869014 /* MTFutureSaltsMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTFutureSaltsMessage.h; path = MTProtoKit/MTFutureSaltsMessage.h; sourceTree = "<group>"; };
|
||||
D04AC0781A3E776200869014 /* MTFutureSaltsMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTFutureSaltsMessage.m; path = MTProtoKit/MTFutureSaltsMessage.m; sourceTree = "<group>"; };
|
||||
D04AC07B1A3E881700869014 /* MTExportedAuthorizationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTExportedAuthorizationData.h; path = MTProtoKit/MTExportedAuthorizationData.h; sourceTree = "<group>"; };
|
||||
D04AC07C1A3E881700869014 /* MTExportedAuthorizationData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTExportedAuthorizationData.m; path = MTProtoKit/MTExportedAuthorizationData.m; sourceTree = "<group>"; };
|
||||
D04AC07F1A3F45AD00869014 /* MTDatacenterAddressListData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTDatacenterAddressListData.h; path = MTProtoKit/MTDatacenterAddressListData.h; sourceTree = "<group>"; };
|
||||
D04AC0801A3F45AD00869014 /* MTDatacenterAddressListData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTDatacenterAddressListData.m; path = MTProtoKit/MTDatacenterAddressListData.m; sourceTree = "<group>"; };
|
||||
D0503AD818B027F80074C3FE /* MTOutputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTOutputStream.h; path = MTProtoKit/MTOutputStream.h; sourceTree = "<group>"; };
|
||||
D0503AD918B027F80074C3FE /* MTOutputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MTOutputStream.m; path = MTProtoKit/MTOutputStream.m; sourceTree = "<group>"; };
|
||||
D0503ADC18B029480074C3FE /* MTInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MTInputStream.h; path = MTProtoKit/MTInputStream.h; sourceTree = "<group>"; };
|
||||
@ -688,6 +788,57 @@
|
||||
path = openssl;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D04AC00A1A3D28D500869014 /* Internal Messages */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D04AC01F1A3D2EC400869014 /* MTInternalMessageParser.h */,
|
||||
D04AC0201A3D2EC400869014 /* MTInternalMessageParser.m */,
|
||||
D04AC0131A3D2A1200869014 /* MTResPqMessage.h */,
|
||||
D04AC0141A3D2A1200869014 /* MTResPqMessage.m */,
|
||||
D04AC0171A3D2ACB00869014 /* MTServerDhParamsMessage.h */,
|
||||
D04AC0181A3D2ACB00869014 /* MTServerDhParamsMessage.m */,
|
||||
D04AC06F1A3E6EAB00869014 /* MTServerDhInnerDataMessage.h */,
|
||||
D04AC0701A3E6EAB00869014 /* MTServerDhInnerDataMessage.m */,
|
||||
D04AC0731A3E738A00869014 /* MTSetClientDhParamsResponseMessage.h */,
|
||||
D04AC0741A3E738A00869014 /* MTSetClientDhParamsResponseMessage.m */,
|
||||
D04AC00B1A3D28E800869014 /* MTRpcResultMessage.h */,
|
||||
D04AC00C1A3D28E800869014 /* MTRpcResultMessage.m */,
|
||||
D04AC00F1A3D297400869014 /* MTRpcError.h */,
|
||||
D04AC0101A3D297400869014 /* MTRpcError.m */,
|
||||
D04AC06B1A3E698B00869014 /* MTDropRpcResultMessage.h */,
|
||||
D04AC06C1A3E698B00869014 /* MTDropRpcResultMessage.m */,
|
||||
D04AC0271A3D34C600869014 /* MTMsgsStateReqMessage.h */,
|
||||
D04AC0281A3D34C600869014 /* MTMsgsStateReqMessage.m */,
|
||||
D04AC02F1A3D35AD00869014 /* MTMsgsStateInfoMessage.h */,
|
||||
D04AC0301A3D35AD00869014 /* MTMsgsStateInfoMessage.m */,
|
||||
D04AC0331A3D367C00869014 /* MTMsgDetailedInfoMessage.h */,
|
||||
D04AC0341A3D367C00869014 /* MTMsgDetailedInfoMessage.m */,
|
||||
D04AC03F1A3E297900869014 /* MTMsgAllInfoMessage.h */,
|
||||
D04AC0401A3E297900869014 /* MTMsgAllInfoMessage.m */,
|
||||
D04AC0471A3E2AA100869014 /* MTMessage.h */,
|
||||
D04AC0481A3E2AA100869014 /* MTMessage.m */,
|
||||
D04AC04B1A3E2BCF00869014 /* MTMsgResendReqMessage.h */,
|
||||
D04AC04C1A3E2BCF00869014 /* MTMsgResendReqMessage.m */,
|
||||
D04AC04F1A3E2C3700869014 /* MTBadMsgNotificationMessage.h */,
|
||||
D04AC0501A3E2C3700869014 /* MTBadMsgNotificationMessage.m */,
|
||||
D04AC01B1A3D2C3C00869014 /* MTMsgsAckMessage.h */,
|
||||
D04AC01C1A3D2C3C00869014 /* MTMsgsAckMessage.m */,
|
||||
D04AC0571A3E325700869014 /* MTPingMessage.h */,
|
||||
D04AC0581A3E325700869014 /* MTPingMessage.m */,
|
||||
D04AC0531A3E31B400869014 /* MTPongMessage.h */,
|
||||
D04AC0541A3E31B400869014 /* MTPongMessage.m */,
|
||||
D04AC05F1A3E37C900869014 /* MTNewSessionCreatedMessage.h */,
|
||||
D04AC0601A3E37C900869014 /* MTNewSessionCreatedMessage.m */,
|
||||
D04AC0631A3E387300869014 /* MTDestroySessionResponseMessage.h */,
|
||||
D04AC0641A3E387300869014 /* MTDestroySessionResponseMessage.m */,
|
||||
D04AC0671A3E3D7600869014 /* MTMsgContainerMessage.h */,
|
||||
D04AC0681A3E3D7600869014 /* MTMsgContainerMessage.m */,
|
||||
D04AC0771A3E776200869014 /* MTFutureSaltsMessage.h */,
|
||||
D04AC0781A3E776200869014 /* MTFutureSaltsMessage.m */,
|
||||
);
|
||||
name = "Internal Messages";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D05A830918AFB3F9007F1076 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -811,6 +962,8 @@
|
||||
D0503ADD18B029480074C3FE /* MTInputStream.m */,
|
||||
D04AC0061A3D14C600869014 /* MTBuffer.h */,
|
||||
D04AC0071A3D14C600869014 /* MTBuffer.m */,
|
||||
D04AC0231A3D2F9600869014 /* MTBufferReader.h */,
|
||||
D04AC0241A3D2F9600869014 /* MTBufferReader.m */,
|
||||
);
|
||||
name = Utils;
|
||||
sourceTree = "<group>";
|
||||
@ -819,6 +972,10 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D05A83B518AFB75B007F1076 /* MTSerialization.h */,
|
||||
D04AC07B1A3E881700869014 /* MTExportedAuthorizationData.h */,
|
||||
D04AC07C1A3E881700869014 /* MTExportedAuthorizationData.m */,
|
||||
D04AC07F1A3F45AD00869014 /* MTDatacenterAddressListData.h */,
|
||||
D04AC0801A3F45AD00869014 /* MTDatacenterAddressListData.m */,
|
||||
);
|
||||
name = Serialization;
|
||||
sourceTree = "<group>";
|
||||
@ -835,6 +992,7 @@
|
||||
D05A842E18AFB7B7007F1076 /* MTProto */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D04AC00A1A3D28D500869014 /* Internal Messages */,
|
||||
D063A32418B1618D00C65116 /* MTProto.h */,
|
||||
D063A32518B1618D00C65116 /* MTProto.mm */,
|
||||
D063A32618B1618D00C65116 /* MTSessionInfo.h */,
|
||||
@ -1083,12 +1241,14 @@
|
||||
D0254C7B18B103D4009452AA /* asn1t.h in Headers */,
|
||||
D05A841818AFB75B007F1076 /* MTDatacenterAddressSet.h in Headers */,
|
||||
D063A31E18B158AE00C65116 /* MTProtoKit.h in Headers */,
|
||||
D04AC0191A3D2ACB00869014 /* MTServerDhParamsMessage.h in Headers */,
|
||||
D0254CAB18B103D4009452AA /* rc2.h in Headers */,
|
||||
D05A83E918AFB75B007F1076 /* MTContext.h in Headers */,
|
||||
D063A37118B164D600C65116 /* MTRequest.h in Headers */,
|
||||
D0254C8718B103D4009452AA /* crypto.h in Headers */,
|
||||
D0254CBA18B103D4009452AA /* tls1.h in Headers */,
|
||||
D0254CAD18B103D4009452AA /* ripemd.h in Headers */,
|
||||
D04AC0651A3E387300869014 /* MTDestroySessionResponseMessage.h in Headers */,
|
||||
D0254C8D18B103D4009452AA /* dtls1.h in Headers */,
|
||||
D063A39F18B1650400C65116 /* MTTcpConnectionBehaviour.h in Headers */,
|
||||
D063A37518B164D600C65116 /* MTRequestContext.h in Headers */,
|
||||
@ -1102,14 +1262,19 @@
|
||||
D0254CA518B103D4009452AA /* pem.h in Headers */,
|
||||
D05A84E118AFE81D007F1076 /* MTLogging.h in Headers */,
|
||||
D0254C7918B103D4009452AA /* asn1.h in Headers */,
|
||||
D04AC00D1A3D28E800869014 /* MTRpcResultMessage.h in Headers */,
|
||||
D04AC0411A3E297900869014 /* MTMsgAllInfoMessage.h in Headers */,
|
||||
D0254C9018B103D4009452AA /* ec.h in Headers */,
|
||||
D0254CC218B103D4009452AA /* x509v3.h in Headers */,
|
||||
D0254C7D18B103D4009452AA /* blowfish.h in Headers */,
|
||||
D0254CA218B103D4009452AA /* opensslconf.h in Headers */,
|
||||
D04AC0551A3E31B400869014 /* MTPongMessage.h in Headers */,
|
||||
D04AC0151A3D2A1200869014 /* MTResPqMessage.h in Headers */,
|
||||
D063A3B118B1650F00C65116 /* MTHttpWorker.h in Headers */,
|
||||
D0254CAA18B103D4009452AA /* rand.h in Headers */,
|
||||
D0254C9B18B103D4009452AA /* md4.h in Headers */,
|
||||
D0254CB318B103D4009452AA /* srtp.h in Headers */,
|
||||
D04AC0491A3E2AA100869014 /* MTMessage.h in Headers */,
|
||||
D0254C9418B103D4009452AA /* err.h in Headers */,
|
||||
D0254CB018B103D4009452AA /* seed.h in Headers */,
|
||||
D0254C8118B103D4009452AA /* cast.h in Headers */,
|
||||
@ -1117,6 +1282,7 @@
|
||||
D05A841618AFB75B007F1076 /* MTDatacenterAddress.h in Headers */,
|
||||
D05A840B18AFB75B007F1076 /* MTKeychain.h in Headers */,
|
||||
93DBD23118B2D72800631ADC /* MTRequestErrorContext.h in Headers */,
|
||||
D04AC04D1A3E2BCF00869014 /* MTMsgResendReqMessage.h in Headers */,
|
||||
D0254CB618B103D4009452AA /* ssl23.h in Headers */,
|
||||
D063A32C18B1618D00C65116 /* MTPreparedMessage.h in Headers */,
|
||||
D0254C9618B103D4009452AA /* hmac.h in Headers */,
|
||||
@ -1130,12 +1296,15 @@
|
||||
D0254CA618B103D4009452AA /* pem2.h in Headers */,
|
||||
D063A38D18B164F800C65116 /* MTTransport.h in Headers */,
|
||||
D0254C7E18B103D4009452AA /* bn.h in Headers */,
|
||||
D04AC0111A3D297400869014 /* MTRpcError.h in Headers */,
|
||||
D0254CB718B103D4009452AA /* ssl3.h in Headers */,
|
||||
D063A3AD18B1650F00C65116 /* MTHttpTransport.h in Headers */,
|
||||
D063A3B518B1650F00C65116 /* MTHttpWorkerBehaviour.h in Headers */,
|
||||
D04AC0791A3E776200869014 /* MTFutureSaltsMessage.h in Headers */,
|
||||
D0254C8C18B103D4009452AA /* dso.h in Headers */,
|
||||
D0254C9118B103D4009452AA /* ecdh.h in Headers */,
|
||||
D0254C9918B103D4009452AA /* kssl.h in Headers */,
|
||||
D04AC07D1A3E881700869014 /* MTExportedAuthorizationData.h in Headers */,
|
||||
D063A35518B1631900C65116 /* MTMessageTransaction.h in Headers */,
|
||||
D0254C9A18B103D4009452AA /* lhash.h in Headers */,
|
||||
D0254CBC18B103D4009452AA /* txt_db.h in Headers */,
|
||||
@ -1146,6 +1315,7 @@
|
||||
D0254CB118B103D4009452AA /* sha.h in Headers */,
|
||||
D05A841218AFB75B007F1076 /* MTDatacenterSaltInfo.h in Headers */,
|
||||
D0254C7A18B103D4009452AA /* asn1_mac.h in Headers */,
|
||||
D04AC0811A3F45AD00869014 /* MTDatacenterAddressListData.h in Headers */,
|
||||
D063A3A318B1650400C65116 /* MTTcpTransport.h in Headers */,
|
||||
D0254C8E18B103D4009452AA /* e_os2.h in Headers */,
|
||||
D0254CA718B103D4009452AA /* pkcs12.h in Headers */,
|
||||
@ -1153,13 +1323,17 @@
|
||||
D063A37F18B164E600C65116 /* MTResendMessageService.h in Headers */,
|
||||
D063A33C18B161B600C65116 /* MTIncomingMessage.h in Headers */,
|
||||
D0254CB918B103D4009452AA /* symhacks.h in Headers */,
|
||||
D04AC01D1A3D2C3C00869014 /* MTMsgsAckMessage.h in Headers */,
|
||||
D04AC06D1A3E698B00869014 /* MTDropRpcResultMessage.h in Headers */,
|
||||
D0254CC118B103D4009452AA /* x509_vfy.h in Headers */,
|
||||
D04AC0591A3E325700869014 /* MTPingMessage.h in Headers */,
|
||||
D04AC0081A3D14C600869014 /* MTBuffer.h in Headers */,
|
||||
D063A36D18B164D600C65116 /* MTDropResponseContext.h in Headers */,
|
||||
D0254C8F18B103D4009452AA /* ebcdic.h in Headers */,
|
||||
D0254C9818B103D4009452AA /* krb5_asn.h in Headers */,
|
||||
D0254CA118B103D4009452AA /* ocsp.h in Headers */,
|
||||
D0254C9D18B103D4009452AA /* mdc2.h in Headers */,
|
||||
D04AC0711A3E6EAB00869014 /* MTServerDhInnerDataMessage.h in Headers */,
|
||||
D05A851318AFF259007F1076 /* GCDAsyncSocket.h in Headers */,
|
||||
D0254C8B18B103D4009452AA /* dsa.h in Headers */,
|
||||
D0254CA418B103D4009452AA /* ossl_typ.h in Headers */,
|
||||
@ -1167,8 +1341,10 @@
|
||||
D0254CB518B103D4009452AA /* ssl2.h in Headers */,
|
||||
D05A850F18AFF259007F1076 /* AFURLConnectionOperation.h in Headers */,
|
||||
D0254C8918B103D4009452AA /* des_old.h in Headers */,
|
||||
D04AC0351A3D367C00869014 /* MTMsgDetailedInfoMessage.h in Headers */,
|
||||
D05A841C18AFB75B007F1076 /* MTInternalId.h in Headers */,
|
||||
D0254CBB18B103D4009452AA /* ts.h in Headers */,
|
||||
D04AC0291A3D34C600869014 /* MTMsgsStateReqMessage.h in Headers */,
|
||||
D0254C9518B103D4009452AA /* evp.h in Headers */,
|
||||
D063A32A18B1618D00C65116 /* MTOutgoingMessage.h in Headers */,
|
||||
D0254C8318B103D4009452AA /* cms.h in Headers */,
|
||||
@ -1179,17 +1355,22 @@
|
||||
D0254CA918B103D4009452AA /* pqueue.h in Headers */,
|
||||
D0254C8218B103D4009452AA /* cmac.h in Headers */,
|
||||
D063A35318B1631900C65116 /* MTMessageService.h in Headers */,
|
||||
D04AC0311A3D35AD00869014 /* MTMsgsStateInfoMessage.h in Headers */,
|
||||
D0254CA318B103D4009452AA /* opensslv.h in Headers */,
|
||||
D063A33218B1618D00C65116 /* MTTimeFixContext.h in Headers */,
|
||||
D04AC0211A3D2EC400869014 /* MTInternalMessageParser.h in Headers */,
|
||||
D0254CBE18B103D4009452AA /* ui_compat.h in Headers */,
|
||||
D0254CB818B103D4009452AA /* stack.h in Headers */,
|
||||
D04AC0691A3E3D7600869014 /* MTMsgContainerMessage.h in Headers */,
|
||||
D0254C7818B103D4009452AA /* aes.h in Headers */,
|
||||
D0254CB218B103D4009452AA /* srp.h in Headers */,
|
||||
D04AC0751A3E738A00869014 /* MTSetClientDhParamsResponseMessage.h in Headers */,
|
||||
D0254C8018B103D4009452AA /* camellia.h in Headers */,
|
||||
D05A850D18AFF259007F1076 /* AFNetworking.h in Headers */,
|
||||
D05A84F918AFF259007F1076 /* AFHTTPClient.h in Headers */,
|
||||
D0503ADA18B027F80074C3FE /* MTOutputStream.h in Headers */,
|
||||
D0254CBF18B103D4009452AA /* whrlpool.h in Headers */,
|
||||
D04AC0611A3E37C900869014 /* MTNewSessionCreatedMessage.h in Headers */,
|
||||
D063A33E18B161B600C65116 /* MTMessageEncryptionKey.h in Headers */,
|
||||
D063A33A18B161B600C65116 /* MTTransportScheme.h in Headers */,
|
||||
9389BC5B18DA2BD300F9C1A6 /* MTDiscoverTransportSchemeAction.h in Headers */,
|
||||
@ -1202,12 +1383,14 @@
|
||||
D063A36918B164D600C65116 /* MTApiEnvironment.h in Headers */,
|
||||
93DBD23718B2DA5500631ADC /* MTTime.h in Headers */,
|
||||
D05A84A118AFCF8E007F1076 /* MTQueue.h in Headers */,
|
||||
D04AC0251A3D2F9600869014 /* MTBufferReader.h in Headers */,
|
||||
D05A842018AFB75B007F1076 /* MTDiscoverDatacenterAddressAction.h in Headers */,
|
||||
D063A37918B164D600C65116 /* MTRequestMessageService.h in Headers */,
|
||||
D0254C9218B103D4009452AA /* ecdsa.h in Headers */,
|
||||
D0254CB418B103D4009452AA /* ssl.h in Headers */,
|
||||
D05A841418AFB75B007F1076 /* MTDatacenterAuthInfo.h in Headers */,
|
||||
D0254C8818B103D4009452AA /* des.h in Headers */,
|
||||
D04AC0511A3E2C3700869014 /* MTBadMsgNotificationMessage.h in Headers */,
|
||||
D063A39B18B1650400C65116 /* MTTcpConnection.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@ -1452,40 +1635,65 @@
|
||||
D05A841318AFB75B007F1076 /* MTDatacenterAuthInfo.m in Sources */,
|
||||
D05A84FF18AFF259007F1076 /* AFHTTPRequestOperation.m in Sources */,
|
||||
D063A35718B1631900C65116 /* MTMessageTransaction.m in Sources */,
|
||||
D04AC00E1A3D28E800869014 /* MTRpcResultMessage.m in Sources */,
|
||||
D04AC04E1A3E2BCF00869014 /* MTMsgResendReqMessage.m in Sources */,
|
||||
D063A32B18B1618D00C65116 /* MTOutgoingMessage.m in Sources */,
|
||||
D063A33D18B161B600C65116 /* MTIncomingMessage.m in Sources */,
|
||||
D063A3B718B1650F00C65116 /* MTHttpWorkerBehaviour.m in Sources */,
|
||||
D04AC04A1A3E2AA100869014 /* MTMessage.m in Sources */,
|
||||
D04AC07A1A3E776200869014 /* MTFutureSaltsMessage.m in Sources */,
|
||||
D04AC0091A3D14C600869014 /* MTBuffer.m in Sources */,
|
||||
D05A83E818AFB75B007F1076 /* MTDatacenterTransferAuthAction.m in Sources */,
|
||||
D063A37B18B164D600C65116 /* MTRequestMessageService.m in Sources */,
|
||||
D05A84A318AFCF8E007F1076 /* MTQueue.m in Sources */,
|
||||
D04AC0721A3E6EAB00869014 /* MTServerDhInnerDataMessage.m in Sources */,
|
||||
D04AC0821A3F45AD00869014 /* MTDatacenterAddressListData.m in Sources */,
|
||||
D04AC0521A3E2C3700869014 /* MTBadMsgNotificationMessage.m in Sources */,
|
||||
D063A3A518B1650400C65116 /* MTTcpTransport.m in Sources */,
|
||||
D063A33F18B161B600C65116 /* MTMessageEncryptionKey.m in Sources */,
|
||||
D063A33118B1618D00C65116 /* MTSessionInfo.mm in Sources */,
|
||||
D063A33B18B161B600C65116 /* MTTransportScheme.m in Sources */,
|
||||
D0503ADF18B029480074C3FE /* MTInputStream.m in Sources */,
|
||||
D04AC0261A3D2F9600869014 /* MTBufferReader.m in Sources */,
|
||||
D04AC0161A3D2A1200869014 /* MTResPqMessage.m in Sources */,
|
||||
D063A38118B164E600C65116 /* MTResendMessageService.m in Sources */,
|
||||
93DBD23518B2DA1E00631ADC /* MTTime.m in Sources */,
|
||||
D05A83EE18AFB75B007F1076 /* MTKeychain.m in Sources */,
|
||||
D04AC0561A3E31B400869014 /* MTPongMessage.m in Sources */,
|
||||
D063A32D18B1618D00C65116 /* MTPreparedMessage.m in Sources */,
|
||||
D05A841718AFB75B007F1076 /* MTDatacenterAddressSet.m in Sources */,
|
||||
D05A841118AFB75B007F1076 /* MTDatacenterSaltInfo.m in Sources */,
|
||||
D04AC06E1A3E698B00869014 /* MTDropRpcResultMessage.m in Sources */,
|
||||
D04AC05A1A3E325700869014 /* MTPingMessage.m in Sources */,
|
||||
D063A37718B164D600C65116 /* MTRequestContext.m in Sources */,
|
||||
D05A851B18AFF2F8007F1076 /* AFJSONUtilities.m in Sources */,
|
||||
D04AC01A1A3D2ACB00869014 /* MTServerDhParamsMessage.m in Sources */,
|
||||
D0503ADB18B027F80074C3FE /* MTOutputStream.m in Sources */,
|
||||
D063A38B18B164F800C65116 /* MTNetworkAvailability.m in Sources */,
|
||||
D063A36F18B164D600C65116 /* MTDropResponseContext.m in Sources */,
|
||||
D04AC0421A3E297900869014 /* MTMsgAllInfoMessage.m in Sources */,
|
||||
D04AC0121A3D297400869014 /* MTRpcError.m in Sources */,
|
||||
D05A83FB18AFB75B007F1076 /* MTDatacenterAuthMessageService.m in Sources */,
|
||||
D05A84FB18AFF259007F1076 /* AFHTTPClient.m in Sources */,
|
||||
D04AC07E1A3E881700869014 /* MTExportedAuthorizationData.m in Sources */,
|
||||
D05A841918AFB75B007F1076 /* MTDatacenterAuthAction.m in Sources */,
|
||||
D04AC0321A3D35AD00869014 /* MTMsgsStateInfoMessage.m in Sources */,
|
||||
D05A841F18AFB75B007F1076 /* MTDiscoverDatacenterAddressAction.m in Sources */,
|
||||
D05A84DD18AFE81D007F1076 /* MTTimer.m in Sources */,
|
||||
D04AC01E1A3D2C3C00869014 /* MTMsgsAckMessage.m in Sources */,
|
||||
9389BC5C18DA2BD300F9C1A6 /* MTDiscoverTransportSchemeAction.m in Sources */,
|
||||
D063A38F18B164F800C65116 /* MTTransport.m in Sources */,
|
||||
D05A841518AFB75B007F1076 /* MTDatacenterAddress.m in Sources */,
|
||||
D04AC0761A3E738A00869014 /* MTSetClientDhParamsResponseMessage.m in Sources */,
|
||||
D04AC0661A3E387300869014 /* MTDestroySessionResponseMessage.m in Sources */,
|
||||
D04AC0621A3E37C900869014 /* MTNewSessionCreatedMessage.m in Sources */,
|
||||
93DBD23218B2D72800631ADC /* MTRequestErrorContext.m in Sources */,
|
||||
D04AC02A1A3D34C600869014 /* MTMsgsStateReqMessage.m in Sources */,
|
||||
D04AC0221A3D2EC400869014 /* MTInternalMessageParser.m in Sources */,
|
||||
D063A3B318B1650F00C65116 /* MTHttpWorker.m in Sources */,
|
||||
D063A3AF18B1650F00C65116 /* MTHttpTransport.m in Sources */,
|
||||
D04AC0361A3D367C00869014 /* MTMsgDetailedInfoMessage.m in Sources */,
|
||||
D04AC06A1A3E3D7600869014 /* MTMsgContainerMessage.m in Sources */,
|
||||
D063A33318B1618D00C65116 /* MTTimeFixContext.m in Sources */,
|
||||
D05A851118AFF259007F1076 /* AFURLConnectionOperation.m in Sources */,
|
||||
D063A39D18B1650400C65116 /* MTTcpConnection.m in Sources */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user