mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
TextSecure messages don’t get assigned a timestamp by the server. All of it is done end-to-end between both clients. A client could have a misconfigured clock or might want to forge a timestamp. Therefore, we address this issue by introducing a new receivedAt timestamp for incoming messages that will be used to sort the messages.
47 lines
1.2 KiB
Objective-C
47 lines
1.2 KiB
Objective-C
//
|
|
// TSIncomingMessage.m
|
|
// TextSecureKit
|
|
//
|
|
// Created by Frederic Jacobs on 15/11/14.
|
|
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "TSIncomingMessage.h"
|
|
|
|
@implementation TSIncomingMessage
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
inThread:(TSGroupThread*)thread
|
|
authorId:(NSString*)authorId
|
|
messageBody:(NSString*)body
|
|
attachments:(NSArray *)attachments
|
|
{
|
|
self = [super initWithTimestamp:timestamp inThread:thread messageBody:body attachments:attachments];
|
|
|
|
if (self) {
|
|
_authorId = authorId;
|
|
_read = NO;
|
|
_receivedAt = [NSDate date];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (instancetype)initWithTimestamp:(uint64_t)timestamp
|
|
inThread:(TSContactThread *)thread
|
|
messageBody:(NSString *)body
|
|
attachments:(NSArray *)attachments
|
|
{
|
|
self = [super initWithTimestamp:timestamp inThread:thread messageBody:body attachments:attachments];
|
|
|
|
if (self) {
|
|
_authorId = nil;
|
|
_read = NO;
|
|
_receivedAt = [NSDate date];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
@end
|