Initial history import support

This commit is contained in:
Ali
2021-01-20 00:10:53 +04:00
parent d5a25602ce
commit 8a02b588d8
79 changed files with 8315 additions and 4771 deletions

View File

@@ -122,7 +122,7 @@ public enum SecretChatOutgoingOperationContents: PostboxCoding {
case pfsCommitKey(layer: SecretChatSequenceBasedLayer, actionGloballyUniqueId: Int64, rekeySessionId: Int64, keyFingerprint: Int64)
case noop(layer: SecretChatSequenceBasedLayer, actionGloballyUniqueId: Int64)
case setMessageAutoremoveTimeout(layer: SecretChatLayer, actionGloballyUniqueId: Int64, timeout: Int32, messageId: MessageId)
case terminate(reportSpam: Bool)
case terminate(reportSpam: Bool, requestRemoteHistoryRemoval: Bool)
public init(decoder: PostboxDecoder) {
switch decoder.decodeInt32ForKey("r", orElse: 0) {
@@ -155,7 +155,7 @@ public enum SecretChatOutgoingOperationContents: PostboxCoding {
case SecretChatOutgoingOperationValue.setMessageAutoremoveTimeout.rawValue:
self = .setMessageAutoremoveTimeout(layer: SecretChatLayer(rawValue: decoder.decodeInt32ForKey("l", orElse: 0))!, actionGloballyUniqueId: decoder.decodeInt64ForKey("i", orElse: 0), timeout: decoder.decodeInt32ForKey("t", orElse: 0), messageId: MessageId(peerId: PeerId(decoder.decodeInt64ForKey("m.p", orElse: 0)), namespace: decoder.decodeInt32ForKey("m.n", orElse: 0), id: decoder.decodeInt32ForKey("m.i", orElse: 0)))
case SecretChatOutgoingOperationValue.terminate.rawValue:
self = .terminate(reportSpam: decoder.decodeInt32ForKey("rs", orElse: 0) != 0)
self = .terminate(reportSpam: decoder.decodeInt32ForKey("rs", orElse: 0) != 0, requestRemoteHistoryRemoval: decoder.decodeInt32ForKey("requestRemoteHistoryRemoval", orElse: 0) != 0)
default:
self = .noop(layer: SecretChatSequenceBasedLayer(rawValue: decoder.decodeInt32ForKey("l", orElse: 0))!, actionGloballyUniqueId: 0)
assertionFailure()
@@ -249,9 +249,10 @@ public enum SecretChatOutgoingOperationContents: PostboxCoding {
encoder.encodeInt64(messageId.peerId.toInt64(), forKey: "m.p")
encoder.encodeInt32(messageId.namespace, forKey: "m.n")
encoder.encodeInt32(messageId.id, forKey: "m.i")
case let .terminate(reportSpam):
case let .terminate(reportSpam, requestRemoteHistoryRemoval):
encoder.encodeInt32(SecretChatOutgoingOperationValue.terminate.rawValue, forKey: "r")
encoder.encodeInt32(reportSpam ? 1 : 0, forKey: "rs")
encoder.encodeInt32(requestRemoteHistoryRemoval ? 1 : 0, forKey: "requestRemoteHistoryRemoval")
}
}
}