no message

This commit is contained in:
Peter
2017-03-03 18:39:54 +04:00
parent b794fa0b65
commit 7c14fc1191
6 changed files with 180 additions and 126 deletions

View File

@@ -174,6 +174,8 @@
D0448CA31E291B14005A61A7 /* FetchSecretFileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0448CA11E291B14005A61A7 /* FetchSecretFileResource.swift */; }; D0448CA31E291B14005A61A7 /* FetchSecretFileResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0448CA11E291B14005A61A7 /* FetchSecretFileResource.swift */; };
D0448CA51E29215A005A61A7 /* MediaResourceApiUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0448CA41E29215A005A61A7 /* MediaResourceApiUtils.swift */; }; D0448CA51E29215A005A61A7 /* MediaResourceApiUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0448CA41E29215A005A61A7 /* MediaResourceApiUtils.swift */; };
D0448CA61E29215A005A61A7 /* MediaResourceApiUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0448CA41E29215A005A61A7 /* MediaResourceApiUtils.swift */; }; D0448CA61E29215A005A61A7 /* MediaResourceApiUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0448CA41E29215A005A61A7 /* MediaResourceApiUtils.swift */; };
D0458C881E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0458C871E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift */; };
D0458C891E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0458C871E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift */; };
D049EAD51E43D98500A2CD3A /* RecentMediaItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D049EAD41E43D98500A2CD3A /* RecentMediaItem.swift */; }; D049EAD51E43D98500A2CD3A /* RecentMediaItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D049EAD41E43D98500A2CD3A /* RecentMediaItem.swift */; };
D049EAD61E43D98500A2CD3A /* RecentMediaItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D049EAD41E43D98500A2CD3A /* RecentMediaItem.swift */; }; D049EAD61E43D98500A2CD3A /* RecentMediaItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D049EAD41E43D98500A2CD3A /* RecentMediaItem.swift */; };
D049EAD81E43DAD200A2CD3A /* ManagedRecentStickers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D049EAD71E43DAD200A2CD3A /* ManagedRecentStickers.swift */; }; D049EAD81E43DAD200A2CD3A /* ManagedRecentStickers.swift in Sources */ = {isa = PBXBuildFile; fileRef = D049EAD71E43DAD200A2CD3A /* ManagedRecentStickers.swift */; };
@@ -546,6 +548,7 @@
D0448C9E1E27F5EB005A61A7 /* Random.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Random.swift; sourceTree = "<group>"; }; D0448C9E1E27F5EB005A61A7 /* Random.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Random.swift; sourceTree = "<group>"; };
D0448CA11E291B14005A61A7 /* FetchSecretFileResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchSecretFileResource.swift; sourceTree = "<group>"; }; D0448CA11E291B14005A61A7 /* FetchSecretFileResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchSecretFileResource.swift; sourceTree = "<group>"; };
D0448CA41E29215A005A61A7 /* MediaResourceApiUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaResourceApiUtils.swift; sourceTree = "<group>"; }; D0448CA41E29215A005A61A7 /* MediaResourceApiUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MediaResourceApiUtils.swift; sourceTree = "<group>"; };
D0458C871E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OutgoingContentInfoMessageAttribute.swift; sourceTree = "<group>"; };
D049EAD41E43D98500A2CD3A /* RecentMediaItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentMediaItem.swift; sourceTree = "<group>"; }; D049EAD41E43D98500A2CD3A /* RecentMediaItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentMediaItem.swift; sourceTree = "<group>"; };
D049EAD71E43DAD200A2CD3A /* ManagedRecentStickers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedRecentStickers.swift; sourceTree = "<group>"; }; D049EAD71E43DAD200A2CD3A /* ManagedRecentStickers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedRecentStickers.swift; sourceTree = "<group>"; };
D049EAE71E44B67100A2CD3A /* RecentPeerItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentPeerItem.swift; sourceTree = "<group>"; }; D049EAE71E44B67100A2CD3A /* RecentPeerItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecentPeerItem.swift; sourceTree = "<group>"; };
@@ -858,6 +861,7 @@
D0F7AB2B1DCE889D009AD9A1 /* EditedMessageAttribute.swift */, D0F7AB2B1DCE889D009AD9A1 /* EditedMessageAttribute.swift */,
D0F7AB2E1DCF507E009AD9A1 /* ReplyMarkupMessageAttribute.swift */, D0F7AB2E1DCF507E009AD9A1 /* ReplyMarkupMessageAttribute.swift */,
D0E35A111DE4A25E00BC6096 /* OutgoingChatContextResultMessageAttribute.swift */, D0E35A111DE4A25E00BC6096 /* OutgoingChatContextResultMessageAttribute.swift */,
D0458C871E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift */,
); );
name = Attributes; name = Attributes;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -1351,6 +1355,7 @@
D033FEB01E61EB0200644997 /* PeerReportStatus.swift in Sources */, D033FEB01E61EB0200644997 /* PeerReportStatus.swift in Sources */,
D050F2511E4A59C200988324 /* JoinLink.swift in Sources */, D050F2511E4A59C200988324 /* JoinLink.swift in Sources */,
D07827C91E02F59C00071108 /* InstantPage.swift in Sources */, D07827C91E02F59C00071108 /* InstantPage.swift in Sources */,
D0458C881E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift in Sources */,
D07827CB1E02F5B200071108 /* RichText.swift in Sources */, D07827CB1E02F5B200071108 /* RichText.swift in Sources */,
D0613FD71E606B3B00202CDB /* ConvertGroupToSupergroup.swift in Sources */, D0613FD71E606B3B00202CDB /* ConvertGroupToSupergroup.swift in Sources */,
D03B0CE01D62249100955575 /* StoreMessage_Telegram.swift in Sources */, D03B0CE01D62249100955575 /* StoreMessage_Telegram.swift in Sources */,
@@ -1555,6 +1560,7 @@
D050F26A1E4A5B6D00988324 /* ManagedGlobalNotificationSettings.swift in Sources */, D050F26A1E4A5B6D00988324 /* ManagedGlobalNotificationSettings.swift in Sources */,
D050F26B1E4A5B6D00988324 /* ApplyMaxReadIndexInteractively.swift in Sources */, D050F26B1E4A5B6D00988324 /* ApplyMaxReadIndexInteractively.swift in Sources */,
D033FEB11E61EB0200644997 /* PeerReportStatus.swift in Sources */, D033FEB11E61EB0200644997 /* PeerReportStatus.swift in Sources */,
D0458C891E69B4AB00FB34C1 /* OutgoingContentInfoMessageAttribute.swift in Sources */,
D050F26C1E4A5B6D00988324 /* UpdatePeers.swift in Sources */, D050F26C1E4A5B6D00988324 /* UpdatePeers.swift in Sources */,
D050F26D1E4A5B6D00988324 /* CreateGroup.swift in Sources */, D050F26D1E4A5B6D00988324 /* CreateGroup.swift in Sources */,
D050F26E1E4A5B6D00988324 /* RemovePeerChat.swift in Sources */, D050F26E1E4A5B6D00988324 /* RemovePeerChat.swift in Sources */,

View File

@@ -210,6 +210,8 @@ private var declaredEncodables: Void = {
declareEncodable(RecentMediaItem.self, f: { RecentMediaItem(decoder: $0) }) declareEncodable(RecentMediaItem.self, f: { RecentMediaItem(decoder: $0) })
declareEncodable(RecentPeerItem.self, f: { RecentPeerItem(decoder: $0) }) declareEncodable(RecentPeerItem.self, f: { RecentPeerItem(decoder: $0) })
declareEncodable(LoggedOutAccountAttribute.self, f: { LoggedOutAccountAttribute(decoder: $0) }) declareEncodable(LoggedOutAccountAttribute.self, f: { LoggedOutAccountAttribute(decoder: $0) })
declareEncodable(CloudChatClearHistoryOperation.self, f: { CloudChatClearHistoryOperation(decoder: $0) })
declareEncodable(OutgoingContentInfoMessageAttribute.self, f: { OutgoingContentInfoMessageAttribute(decoder: $0) })
return return
}() }()

View File

@@ -20,7 +20,7 @@ public func trace2(_ what: @autoclosure() -> String) {
let milliseconds = curTime.tv_usec / 1000 let milliseconds = curTime.tv_usec / 1000
//queue.async { //queue.async {
let result = String(format: "%d-%d-%d %02d:%02d:%03d %@", arguments: [Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_yday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(milliseconds), string]) let result = String(format: "%d-%d-%d %02d:%02d:%03d %@", arguments: [Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_mday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(milliseconds), string])
print(result) print(result)
//} //}
} }
@@ -38,7 +38,7 @@ public func trace1(_ domain: String, what: @autoclosure() -> String) {
let milliseconds = curTime.tv_usec / 1000 let milliseconds = curTime.tv_usec / 1000
queue.async { queue.async {
let result = String(format: "[%@] %d-%d-%d %02d:%02d:%02d.%03d %@", arguments: [domain, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_yday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(seconds), Int(milliseconds), string]) let result = String(format: "[%@] %d-%d-%d %02d:%02d:%02d.%03d %@", arguments: [domain, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_mday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(seconds), Int(milliseconds), string])
print(result) print(result)
} }
@@ -67,6 +67,9 @@ public final class Logger {
private let basePath: String private let basePath: String
private var file: (Int32, Int)? private var file: (Int32, Int)?
public var logToFile: Bool = true
public var logToConsole: Bool = true
public static func setSharedLogger(_ logger: Logger) { public static func setSharedLogger(_ logger: Logger) {
sharedLogger = logger sharedLogger = logger
} }
@@ -99,6 +102,10 @@ public final class Logger {
} }
public func log(_ tag: String, _ what: @autoclosure () -> String) { public func log(_ tag: String, _ what: @autoclosure () -> String) {
if !self.logToFile && !self.logToConsole {
return
}
let string = what() let string = what()
var rawTime = time_t() var rawTime = time_t()
@@ -110,16 +117,21 @@ public final class Logger {
gettimeofday(&curTime, nil) gettimeofday(&curTime, nil)
let milliseconds = curTime.tv_usec / 1000 let milliseconds = curTime.tv_usec / 1000
#if TARGET_IPHONE_SIMULATOR || DEBUG var consoleContent: String?
let content = String(format: "[%@] %d-%d-%d %02d:%02d:%02d.%03d %@", arguments: [tag, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_yday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(timeinfo.tm_sec), Int(milliseconds), string]) if self.logToConsole {
let content = String(format: "[%@] %d-%d-%d %02d:%02d:%02d.%03d %@", arguments: [tag, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_mday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(timeinfo.tm_sec), Int(milliseconds), string])
consoleContent = content
print(content) print(content)
#endif }
if self.logToFile {
self.queue.async { self.queue.async {
#if !(TARGET_IPHONE_SIMULATOR || DEBUG) let content: String
let content = String(format: "[%@] %d-%d-%d %02d:%02d:%02d.%03d %@", arguments: [tag, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_yday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(timeinfo.tm_sec), Int(milliseconds), string]) if let consoleContent = consoleContent {
#endif content = consoleContent
} else {
content = String(format: "[%@] %d-%d-%d %02d:%02d:%02d.%03d %@", arguments: [tag, Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_mday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(timeinfo.tm_sec), Int(milliseconds), string])
}
var fd: Int32? var fd: Int32?
var openNew = false var openNew = false
@@ -174,7 +186,7 @@ public final class Logger {
} }
if createNew { if createNew {
let fileName = String(format: "log-%d-%d-%d_%02d-%02d-%02d.%03d.txt", arguments: [Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_yday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(timeinfo.tm_sec), Int(milliseconds)]) let fileName = String(format: "log-%d-%d-%d_%02d-%02d-%02d.%03d.txt", arguments: [Int(timeinfo.tm_year) + 1900, Int(timeinfo.tm_mon + 1), Int(timeinfo.tm_mday), Int(timeinfo.tm_hour), Int(timeinfo.tm_min), Int(timeinfo.tm_sec), Int(milliseconds)])
let path = self.basePath + "/" + fileName let path = self.basePath + "/" + fileName
@@ -203,3 +215,4 @@ public final class Logger {
} }
} }
} }
}

View File

@@ -57,7 +57,7 @@ private func withTakenOperation(postbox: Postbox, peerId: PeerId, tagLocalIndex:
return postbox.modify { modifier -> Signal<Void, NoError> in return postbox.modify { modifier -> Signal<Void, NoError> in
var result: PeerMergedOperationLogEntry? var result: PeerMergedOperationLogEntry?
modifier.operationLogUpdateEntry(peerId: peerId, tag: OperationLogTags.CloudChatRemoveMessages, tagLocalIndex: tagLocalIndex, { entry in modifier.operationLogUpdateEntry(peerId: peerId, tag: OperationLogTags.CloudChatRemoveMessages, tagLocalIndex: tagLocalIndex, { entry in
if let entry = entry, let _ = entry.mergedIndex, (entry.contents is CloudChatRemoveMessagesOperation || entry.contents is CloudChatRemoveChatOperation) { if let entry = entry, let _ = entry.mergedIndex, (entry.contents is CloudChatRemoveMessagesOperation || entry.contents is CloudChatRemoveChatOperation || entry.contents is CloudChatClearHistoryOperation) {
result = entry.mergedEntry! result = entry.mergedEntry!
return PeerOperationLogEntryUpdate(mergedIndex: .none, contents: .none) return PeerOperationLogEntryUpdate(mergedIndex: .none, contents: .none)
} else { } else {
@@ -213,44 +213,18 @@ private func removeChat(modifier: Modifier, postbox: Postbox, network: Network,
} }
let deleteMessages: Signal<Void, NoError> let deleteMessages: Signal<Void, NoError>
if let inputPeer = apiInputPeer(peer), let topMessageId = modifier.getTopPeerMessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud) { if let inputPeer = apiInputPeer(peer), let topMessageId = modifier.getTopPeerMessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud) {
deleteMessages = network.request(Api.functions.messages.deleteHistory(flags: 0, peer: inputPeer, maxId: topMessageId.id)) deleteMessages = requestClearHistory(postbox: postbox, network: network, stateManager: stateManager, inputPeer: inputPeer, maxId: topMessageId.id, justClear: false)
|> map { result -> Api.messages.AffectedHistory? in
return result
}
|> `catch` { _ in
return .single(nil)
}
|> mapToSignal { result in
if let result = result {
switch result {
case let .affectedHistory(pts, ptsCount, _):
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
}
}
return .complete()
}
} else { } else {
deleteMessages = .complete() deleteMessages = .complete()
} }
return deleteMessages |> then(deleteUser) return deleteMessages |> then(deleteUser) |> then(postbox.modify { modifier -> Void in
modifier.clearHistory(peer.id)
})
} else if peer.id.namespace == Namespaces.Peer.CloudUser { } else if peer.id.namespace == Namespaces.Peer.CloudUser {
if let inputPeer = apiInputPeer(peer), let topMessageId = modifier.getTopPeerMessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud) { if let inputPeer = apiInputPeer(peer), let topMessageId = modifier.getTopPeerMessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud) {
return network.request(Api.functions.messages.deleteHistory(flags: 0, peer: inputPeer, maxId: topMessageId.id)) return requestClearHistory(postbox: postbox, network: network, stateManager: stateManager, inputPeer: inputPeer, maxId: topMessageId.id, justClear: false) |> then(postbox.modify { modifier -> Void in
|> map { result -> Api.messages.AffectedHistory? in modifier.clearHistory(peer.id)
return result })
}
|> `catch` { _ in
return .single(nil)
}
|> mapToSignal { result in
if let result = result {
switch result {
case let .affectedHistory(pts, ptsCount, _):
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
}
}
return .complete()
}
} else { } else {
return .complete() return .complete()
} }
@@ -259,25 +233,39 @@ private func removeChat(modifier: Modifier, postbox: Postbox, network: Network,
} }
} }
private func clearHistory(modifier: Modifier, postbox: Postbox, network: Network, stateManager: AccountStateManager, peer: Peer, operation: CloudChatClearHistoryOperation) -> Signal<Void, NoError> { private func requestClearHistory(postbox: Postbox, network: Network, stateManager: AccountStateManager, inputPeer: Api.InputPeer, maxId: Int32, justClear: Bool) -> Signal<Void, NoError> {
if peer.id.namespace == Namespaces.Peer.CloudGroup || peer.id.namespace == Namespaces.Peer.CloudUser { let signal = network.request(Api.functions.messages.deleteHistory(flags: justClear ? 1 : 0, peer: inputPeer, maxId: maxId))
if let inputPeer = apiInputPeer(peer) {
return network.request(Api.functions.messages.deleteHistory(flags: 0, peer: inputPeer, maxId: operation.topMessageId.id))
|> map { result -> Api.messages.AffectedHistory? in |> map { result -> Api.messages.AffectedHistory? in
return result return result
} }
|> `catch` { _ in |> `catch` { _ -> Signal<Api.messages.AffectedHistory?, Bool> in
return .single(nil) return .fail(true)
} }
|> mapToSignal { result in |> mapToSignal { result -> Signal<Void, Bool> in
if let result = result { if let result = result {
switch result { switch result {
case let .affectedHistory(pts, ptsCount, _): case let .affectedHistory(pts, ptsCount, offset):
stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)]) stateManager.addUpdateGroups([.updatePts(pts: pts, ptsCount: ptsCount)])
} if offset == 0 {
} return .fail(true)
} else {
return .complete() return .complete()
} }
}
} else {
return .fail(true)
}
}
return (signal |> restart)
|> `catch` { _ -> Signal<Void, NoError> in
return .complete()
}
}
private func clearHistory(modifier: Modifier, postbox: Postbox, network: Network, stateManager: AccountStateManager, peer: Peer, operation: CloudChatClearHistoryOperation) -> Signal<Void, NoError> {
if peer.id.namespace == Namespaces.Peer.CloudGroup || peer.id.namespace == Namespaces.Peer.CloudUser {
if let inputPeer = apiInputPeer(peer) {
return requestClearHistory(postbox: postbox, network: network, stateManager: stateManager, inputPeer: inputPeer, maxId: operation.topMessageId.id, justClear: true)
} else { } else {
return .complete() return .complete()
} }

View File

@@ -0,0 +1,40 @@
import Foundation
#if os(macOS)
import PostboxMac
#else
import Postbox
#endif
public struct OutgoingContentInfoFlags: OptionSet {
public var rawValue: Int32
public init() {
self.rawValue = 0
}
public init(rawValue: Int32) {
self.rawValue = rawValue
}
public static let disableLinkPreviews = OutgoingContentInfoFlags(rawValue: 1 << 0)
}
public class OutgoingContentInfoMessageAttribute: MessageAttribute {
public let flags: OutgoingContentInfoFlags
init(flags: OutgoingContentInfoFlags) {
self.flags = flags
}
required public init(decoder: Decoder) {
self.flags = OutgoingContentInfoFlags(rawValue: decoder.decodeInt32ForKey("f"))
}
public func encode(_ encoder: Encoder) {
encoder.encodeInt32(self.flags.rawValue, forKey: "f")
}
public func withUpdatedFlags(_ flags: OutgoingContentInfoFlags) -> OutgoingContentInfoMessageAttribute {
return OutgoingContentInfoMessageAttribute(flags: flags)
}
}

View File

@@ -310,6 +310,8 @@ public final class PendingMessageManager {
var messageEntities: [Api.MessageEntity]? var messageEntities: [Api.MessageEntity]?
var replyMessageId: Int32? var replyMessageId: Int32?
var flags: Int32 = 0
for attribute in message.attributes { for attribute in message.attributes {
if let replyAttribute = attribute as? ReplyMessageAttribute { if let replyAttribute = attribute as? ReplyMessageAttribute {
replyMessageId = replyAttribute.messageId.id replyMessageId = replyAttribute.messageId.id
@@ -319,10 +321,13 @@ public final class PendingMessageManager {
forwardSourceInfoAttribute = attribute forwardSourceInfoAttribute = attribute
} else if let attribute = attribute as? TextEntitiesMessageAttribute { } else if let attribute = attribute as? TextEntitiesMessageAttribute {
messageEntities = apiTextAttributeEntities(attribute, associatedPeers: message.peers) messageEntities = apiTextAttributeEntities(attribute, associatedPeers: message.peers)
} else if let attribute = attribute as? OutgoingContentInfoMessageAttribute {
if attribute.flags.contains(.disableLinkPreviews) {
flags |= Int32(1 << 1)
}
} }
} }
var flags: Int32 = 0
if let _ = replyMessageId { if let _ = replyMessageId {
flags |= Int32(1 << 0) flags |= Int32(1 << 0)
} }