From accac077ec1404091453633bea77ab4307cddd8a Mon Sep 17 00:00:00 2001 From: Peter <> Date: Tue, 4 Dec 2018 21:56:08 +0400 Subject: [PATCH] Fix secret chat message parsing --- .../ProcessSecretChatIncomingDecryptedOperations.swift | 5 ++++- TelegramCore/UpdatePeers.swift | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TelegramCore/ProcessSecretChatIncomingDecryptedOperations.swift b/TelegramCore/ProcessSecretChatIncomingDecryptedOperations.swift index aa5a5e015d..61053160a0 100644 --- a/TelegramCore/ProcessSecretChatIncomingDecryptedOperations.swift +++ b/TelegramCore/ProcessSecretChatIncomingDecryptedOperations.swift @@ -110,6 +110,7 @@ func processSecretChatIncomingDecryptedOperations(mediaBox: MediaBox, transactio if let operation = entry.contents as? SecretChatIncomingDecryptedOperation { do { var message: StoreMessage? + var contentParsingError = false var resources: [(MediaResource, Data)] = [] var serviceAction: SecretChatServiceAction? @@ -147,7 +148,7 @@ func processSecretChatIncomingDecryptedOperations(mediaBox: MediaBox, transactio } serviceAction = SecretChatServiceAction(apiMessage) } else { - throw MessageParsingError.contentParsingError + contentParsingError = true } } @@ -288,6 +289,8 @@ func processSecretChatIncomingDecryptedOperations(mediaBox: MediaBox, transactio } let _ = transaction.addMessages([message], location: .Random) addedMessages.append(message) + } else if contentParsingError { + Logger.shared.log("SecretChat", "Couldn't parse secret message content") } } catch let error { if let error = error as? MessageParsingError { diff --git a/TelegramCore/UpdatePeers.swift b/TelegramCore/UpdatePeers.swift index 9bf3f15ebc..86270d25fd 100644 --- a/TelegramCore/UpdatePeers.swift +++ b/TelegramCore/UpdatePeers.swift @@ -80,6 +80,8 @@ public func updatePeers(transaction: Transaction, peers: [Peer], update: (Peer?, } case .left: updatedInclusion = .never + case .kicked where channel.creationDate == 0: + updatedInclusion = .never default: if currentInclusion == .notSpecified { updatedInclusion = .never