Fix secret chat message parsing

This commit is contained in:
Peter
2018-12-04 21:56:08 +04:00
parent e8b5a8e807
commit accac077ec
2 changed files with 6 additions and 1 deletions

View File

@@ -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 {

View File

@@ -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