diff --git a/.bazelrc b/.bazelrc index c695ce1357..c4cde87693 100644 --- a/.bazelrc +++ b/.bazelrc @@ -16,4 +16,4 @@ build --strategy=Genrule=standalone build --spawn_strategy=standalone build --strategy=SwiftCompile=standalone -build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1 \ No newline at end of file +build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1 diff --git a/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m b/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m index 882de632f3..051b0659b0 100644 --- a/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m +++ b/Telegram/NotificationService/NotificationServiceObjC/Sources/Serialization.m @@ -16,7 +16,7 @@ }; } -- (NSData * _Nonnull)importAuthorization:(int32_t)authId bytes:(NSData * _Nonnull)bytes { +- (NSData * _Nonnull)importAuthorization:(int64_t)authId bytes:(NSData * _Nonnull)bytes { return [NSData data]; } diff --git a/Telegram/SiriIntents/IntentContacts.swift b/Telegram/SiriIntents/IntentContacts.swift index cb0fca310e..361a11f7b6 100644 --- a/Telegram/SiriIntents/IntentContacts.swift +++ b/Telegram/SiriIntents/IntentContacts.swift @@ -34,8 +34,8 @@ private func parseAppSpecificContactReference(_ value: String) -> PeerId? { return nil } let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...]) - if let id = Int32(idString) { - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + if let id = Int64(idString) { + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) } return nil } diff --git a/Telegram/SiriIntents/IntentMessages.swift b/Telegram/SiriIntents/IntentMessages.swift index 1fddc10935..882db5ab5c 100644 --- a/Telegram/SiriIntents/IntentMessages.swift +++ b/Telegram/SiriIntents/IntentMessages.swift @@ -166,7 +166,7 @@ private func callWithTelegramMessage(_ telegramMessage: Message, account: Accoun @available(iOSApplicationExtension 10.0, iOS 10.0, *) private func messageWithTelegramMessage(_ telegramMessage: Message) -> INMessage? { - guard let author = telegramMessage.author, let user = telegramMessage.peers[author.id] as? TelegramUser, user.id.id._internalGetInt32Value() != 777000 else { + guard let author = telegramMessage.author, let user = telegramMessage.peers[author.id] as? TelegramUser, user.id.id._internalGetInt64Value() != 777000 else { return nil } diff --git a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h index 45225a04f6..cdea027feb 100644 --- a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h +++ b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.h @@ -3,7 +3,7 @@ @interface TGBridgeContext : NSObject @property (nonatomic, readonly) bool authorized; -@property (nonatomic, readonly) int32_t userId; +@property (nonatomic, readonly) int64_t userId; @property (nonatomic, readonly) bool micAccessAllowed; @property (nonatomic, readonly) NSDictionary *preheatData; @property (nonatomic, readonly) NSInteger preheatVersion; diff --git a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m index 4b0600e2fc..df70505a06 100644 --- a/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m +++ b/Telegram/Watch/WatchCommonWatch/TGBridgeContext.m @@ -40,7 +40,7 @@ NSString *const TGBridgeContextStartupDataVersion = @"version"; return dictionary; } -- (TGBridgeContext *)updatedWithAuthorized:(bool)authorized peerId:(int32_t)peerId +- (TGBridgeContext *)updatedWithAuthorized:(bool)authorized peerId:(int64_t)peerId { TGBridgeContext *context = [[TGBridgeContext alloc] init]; context->_authorized = authorized; diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 56aa5b7adf..99f95956be 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -496,7 +496,7 @@ public enum ChatListSearchFilter: Equatable { case peer(PeerId, Bool, String, String) case date(Int32?, Int32, String) - public var id: Int32 { + public var id: Int64 { switch self { case .chats: return 0 @@ -511,9 +511,9 @@ public enum ChatListSearchFilter: Equatable { case .voice: return 5 case let .peer(peerId, _, _, _): - return peerId.id._internalGetInt32Value() + return peerId.id._internalGetInt64Value() case let .date(_, date, _): - return date + return Int64(date) } } } diff --git a/submodules/AccountContext/Sources/DeviceContactData.swift b/submodules/AccountContext/Sources/DeviceContactData.swift index 3111c3bd5a..89a27006d2 100644 --- a/submodules/AccountContext/Sources/DeviceContactData.swift +++ b/submodules/AccountContext/Sources/DeviceContactData.swift @@ -201,8 +201,8 @@ public func parseAppSpecificContactReference(_ value: String) -> PeerId? { return nil } let idString = String(value[value.index(value.startIndex, offsetBy: phonebookUsernamePrefix.count)...]) - if let id = Int32(idString) { - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + if let id = Int64(idString) { + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) } return nil } diff --git a/submodules/AvatarNode/Sources/AvatarNode.swift b/submodules/AvatarNode/Sources/AvatarNode.swift index 22b15b4753..236a23677b 100644 --- a/submodules/AvatarNode/Sources/AvatarNode.swift +++ b/submodules/AvatarNode/Sources/AvatarNode.swift @@ -456,7 +456,7 @@ public final class AvatarNode: ASDisplayNode { if peerId.namespace == .max { colorIndex = -1 } else { - colorIndex = abs(Int(clamping: peerId.id._internalGetInt32Value())) + colorIndex = abs(Int(clamping: peerId.id._internalGetInt64Value())) } } else { colorIndex = -1 @@ -635,7 +635,7 @@ public func drawPeerAvatarLetters(context: CGContext, size: CGSize, round: Bool if peerId.namespace == .max { colorIndex = -1 } else { - colorIndex = Int(abs(peerId.id._internalGetInt32Value())) + colorIndex = Int(clamping: abs(peerId.id._internalGetInt64Value())) } let colorsArray: NSArray diff --git a/submodules/ChatListUI/Sources/ChatContextMenus.swift b/submodules/ChatListUI/Sources/ChatContextMenus.swift index 18de9475be..47bf5c8ab6 100644 --- a/submodules/ChatListUI/Sources/ChatContextMenus.swift +++ b/submodules/ChatListUI/Sources/ChatContextMenus.swift @@ -260,7 +260,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch let groupAndIndex = transaction.getPeerChatListIndex(peerId) - let archiveEnabled = !isSavedMessages && peerId != PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) && peerId == context.account.peerId + let archiveEnabled = !isSavedMessages && peerId != PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) && peerId == context.account.peerId if let (group, index) = groupAndIndex { if archiveEnabled { let isArchived = group == Namespaces.PeerGroup.archive diff --git a/submodules/ChatListUI/Sources/ChatListController.swift b/submodules/ChatListUI/Sources/ChatListController.swift index 07c1764a1f..d59b617592 100644 --- a/submodules/ChatListUI/Sources/ChatListController.swift +++ b/submodules/ChatListUI/Sources/ChatListController.swift @@ -928,7 +928,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController } if archiveEnabled { for peerId in peerIds { - if peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) { + if peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) { archiveEnabled = false break } else if peerId == strongSelf.context.account.peerId { diff --git a/submodules/ChatListUI/Sources/ChatListControllerNode.swift b/submodules/ChatListUI/Sources/ChatListControllerNode.swift index 2a36dc0b26..09117ce5ca 100644 --- a/submodules/ChatListUI/Sources/ChatListControllerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListControllerNode.swift @@ -179,7 +179,7 @@ private final class ChatListShimmerNode: ASDisplayNode { let chatListPresentationData = ChatListPresentationData(theme: presentationData.theme, fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp1: Int32 = 100000 let peers = SimpleDictionary() let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in diff --git a/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift b/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift index fe11a7cf60..14bf62196f 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchFiltersContainerNode.swift @@ -151,7 +151,7 @@ private final class ItemNode: ASDisplayNode { } enum ChatListSearchFilterEntryId: Hashable { - case filter(Int32) + case filter(Int64) } enum ChatListSearchFilterEntry: Equatable { diff --git a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift index 88115f21a8..598447e931 100644 --- a/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift +++ b/submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift @@ -2320,7 +2320,7 @@ private final class ChatListSearchShimmerNode: ASDisplayNode { let chatListPresentationData = ChatListPresentationData(theme: presentationData.theme, fontSize: presentationData.chatFontSize, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat, nameSortOrder: presentationData.nameSortOrder, nameDisplayOrder: presentationData.nameDisplayOrder, disableAnimations: true) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "FirstName", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp1: Int32 = 100000 var peers = SimpleDictionary() peers[peer1.id] = peer1 diff --git a/submodules/ChatListUI/Sources/Node/ChatListItem.swift b/submodules/ChatListUI/Sources/Node/ChatListItem.swift index 0a45d31b18..41212d5d5c 100644 --- a/submodules/ChatListUI/Sources/Node/ChatListItem.swift +++ b/submodules/ChatListUI/Sources/Node/ChatListItem.swift @@ -196,7 +196,7 @@ private enum RevealOptionKey: Int32 { } private func canArchivePeer(id: PeerId, accountPeerId: PeerId) -> Bool { - if id.namespace == Namespaces.Peer.CloudUser && id.id._internalGetInt32Value() == 777000 { + if id.namespace == Namespaces.Peer.CloudUser && id.id._internalGetInt64Value() == 777000 { return false } if id == accountPeerId { diff --git a/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift b/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift index a991208559..a2287175a6 100644 --- a/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift +++ b/submodules/ContactListUI/Sources/InviteContactsControllerNode.swift @@ -58,7 +58,7 @@ private enum InviteContactsEntry: Comparable, Identifiable { } else { status = .none } - let peer = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: contact.firstName, lastName: contact.lastName, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: contact.firstName, lastName: contact.lastName, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) return ContactsPeerItem(presentationData: ItemListPresentationData(presentationData), sortOrder: nameSortOrder, displayOrder: nameDisplayOrder, context: context, peerMode: .peer, peer: .peer(peer: peer, chatPeer: peer), status: status, enabled: true, selection: selection, editing: ContactsPeerItemEditing(editable: false, editing: false, revealed: false), index: nil, header: ChatListSearchItemHeader(type: .contacts, theme: theme, strings: strings, actionTitle: nil, action: nil), action: { _ in interaction.toggleContact(id) }) diff --git a/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift b/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift index 19e09fbc4f..ccb6ba299f 100644 --- a/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift +++ b/submodules/InstantPageUI/Sources/InstantPageControllerNode.swift @@ -1278,7 +1278,7 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate { }, openUrl: { _ in }, openPeer: { _ in }, showAll: false) - let peer = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "", lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let message = Message(stableId: 0, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: 0, id: 0), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 0, flags: [], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: peer, text: "", attributes: [], media: [map], peers: SimpleDictionary(), associatedMessages: SimpleDictionary(), associatedMessageIds: []) let controller = LocationViewController(context: self.context, subject: message, params: controllerParams) diff --git a/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift b/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift index 9b75fc2fc0..8e1eb4dcc3 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift @@ -598,7 +598,7 @@ public final class InviteLinkViewController: ViewController { if state.importers.isEmpty && state.isLoadingMore { count = min(4, state.count) loading = true - let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) for i in 0 ..< count { entries.append(.importer(Int32(i), presentationData.theme, presentationData.dateTimeFormat, fakeUser, 0, true)) } diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h index 1a8f563283..bc8dc3ab2c 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGMediaOriginInfo.h @@ -55,7 +55,7 @@ typedef enum { + (instancetype)mediaOriginInfoForFavoriteStickerWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; + (instancetype)mediaOriginInfoForRecentGifWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; + (instancetype)mediaOriginInfoForRecentMaskWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences; -+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int32_t)userId offset:(int32_t)offset; ++ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int64_t)userId offset:(int32_t)offset; + (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences url:(NSString *)url; + (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences peerId:(int64_t)peerId; + (instancetype)mediaOriginInfoWithFileReferences:(NSDictionary *)fileReferences wallpaperId:(int32_t)wallpaperId; diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h index ed10bebfca..7f26131184 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGUser.h @@ -66,7 +66,7 @@ typedef enum { @interface TGUser : NSObject -@property (nonatomic) int uid; +@property (nonatomic) int64_t uid; @property (nonatomic, strong) NSString *phoneNumber; @property (nonatomic) int64_t phoneNumberHash; @property (nonatomic, strong) NSString *firstName; diff --git a/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m b/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m index ee602dcd42..a49ea56a8a 100644 --- a/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m +++ b/submodules/LegacyComponents/Sources/TGMediaOriginInfo.m @@ -272,7 +272,7 @@ return info; } -+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int32_t)userId offset:(int32_t)offset ++ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int64_t)userId offset:(int32_t)offset { TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init]; info->_type = TGMediaOriginTypeProfilePhoto; diff --git a/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift b/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift index 22386c4bd0..0499bb60d5 100644 --- a/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift +++ b/submodules/LegacyMediaPickerUI/Sources/LegacySuggestionContext.swift @@ -19,7 +19,7 @@ public func legacySuggestionContext(context: AccountContext, peerId: PeerId, cha for peer in peers { if let peer = peer as? TelegramUser { let user = TGUser() - user.uid = peer.id.id._internalGetInt32Value() + user.uid = peer.id.id._internalGetInt64Value() user.firstName = peer.firstName user.lastName = peer.lastName user.userName = peer.addressName diff --git a/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift b/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift index cce9f64a41..fa125aa337 100644 --- a/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift +++ b/submodules/LegacyUI/Sources/LegacyPeerAvatarPlaceholderDataSource.swift @@ -63,10 +63,10 @@ final class LegacyPeerAvatarPlaceholderDataSource: TGImageDataSource { var peerId = PeerId(0) - if let uid = args["uid"] as? String, let nUid = Int32(uid) { - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(nUid)) - } else if let cid = args["cid"] as? String, let nCid = Int32(cid) { - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(nCid)) + if let uid = args["uid"] as? String, let nUid = Int64(uid) { + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(nUid)) + } else if let cid = args["cid"] as? String, let nCid = Int64(cid) { + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(nCid)) } let image = generateImage(CGSize(width: CGFloat(width), height: CGFloat(height)), rotatedContext: { size, context in @@ -77,10 +77,10 @@ final class LegacyPeerAvatarPlaceholderDataSource: TGImageDataSource { context.clip() let colorIndex: Int - if peerId.id._internalGetInt32Value() == 0 { + if peerId.id._internalGetInt64Value() == 0 { colorIndex = -1 } else { - colorIndex = abs(Int(account.peerId.id._internalGetInt32Value() &+ peerId.id._internalGetInt32Value())) + colorIndex = abs(Int(clamping: account.peerId.id._internalGetInt64Value() &+ peerId.id._internalGetInt64Value())) } let colorsArray: NSArray diff --git a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h index e22992dc38..5570ba9f47 100644 --- a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h +++ b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTExportedAuthorizationData.h @@ -3,8 +3,8 @@ @interface MTExportedAuthorizationData : NSObject @property (nonatomic, strong, readonly) NSData *authorizationBytes; -@property (nonatomic, readonly) int32_t authorizationId; +@property (nonatomic, readonly) int64_t authorizationId; -- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId; +- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int64_t)authorizationId; @end diff --git a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h index bc197ee876..d08cd0faf0 100644 --- a/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h +++ b/submodules/MtProtoKit/PublicHeaders/MtProtoKit/MTSerialization.h @@ -18,7 +18,7 @@ typedef id (^MTRequestNoopParser)(NSData *); - (id)parseMessage:(NSData *)data; - (MTExportAuthorizationResponseParser)exportAuthorization:(int32_t)datacenterId data:(__autoreleasing NSData **)data; -- (NSData *)importAuthorization:(int32_t)authId bytes:(NSData *)bytes; +- (NSData *)importAuthorization:(int64_t)authId bytes:(NSData *)bytes; - (MTRequestDatacenterAddressListParser)requestDatacenterAddressWithData:(__autoreleasing NSData **)data; - (MTRequestNoopParser)requestNoop:(__autoreleasing NSData **)data; diff --git a/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m b/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m index 212672ae77..ca1590360f 100644 --- a/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m +++ b/submodules/MtProtoKit/Sources/AFHTTPRequestOperation.m @@ -113,7 +113,7 @@ static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) { } - (BOOL)hasAcceptableStatusCode { - return !self.acceptableStatusCodes || [self.acceptableStatusCodes containsIndex:[self.response statusCode]]; + return !self.acceptableStatusCodes || [self.acceptableStatusCodes containsIndex:(NSUInteger)[self.response statusCode]]; } - (BOOL)hasAcceptableContentType { diff --git a/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m b/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m index 9cfccea07d..cf1740f7af 100644 --- a/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m +++ b/submodules/MtProtoKit/Sources/MTDatacenterTransferAuthAction.m @@ -116,7 +116,7 @@ [requestService addRequest:request]; } -- (void)beginTransferWithId:(int32_t)dataId data:(NSData *)authData +- (void)beginTransferWithId:(int64_t)dataId data:(NSData *)authData { [_sourceDatacenterMtProto stop]; _sourceDatacenterMtProto = nil; diff --git a/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m b/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m index 9b4933d791..9cdc6fd3cd 100644 --- a/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m +++ b/submodules/MtProtoKit/Sources/MTExportedAuthorizationData.m @@ -2,7 +2,7 @@ @implementation MTExportedAuthorizationData -- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int32_t)authorizationId +- (instancetype)initWithAuthorizationBytes:(NSData *)authorizationBytes authorizationId:(int64_t)authorizationId { self = [super init]; if (self != nil) diff --git a/submodules/MurMurHash32/Sources/MurMurHash32.m b/submodules/MurMurHash32/Sources/MurMurHash32.m index 9096171c74..afbf1d2f83 100644 --- a/submodules/MurMurHash32/Sources/MurMurHash32.m +++ b/submodules/MurMurHash32/Sources/MurMurHash32.m @@ -28,7 +28,7 @@ static FORCE_INLINE uint32_t fmix ( uint32_t h ) return h; } -static void murMurHash32Impl(const void *key, int len, uint32_t seed, void *out) +static void murMurHash32Impl(const void *key, uint32_t len, uint32_t seed, void *out) { const uint8_t * data = (const uint8_t*)key; const int nblocks = len / 4; diff --git a/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift b/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift index 7a9a47e931..6d531d9718 100644 --- a/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift +++ b/submodules/PeerAvatarGalleryUI/Sources/PeerAvatarImageGalleryItem.swift @@ -257,7 +257,7 @@ final class PeerAvatarImageGalleryItemNode: ZoomableContentGalleryItemNode { id = image.0.id category = image.9 } else { - id = Int64(entry.peer?.id.id._internalGetInt32Value() ?? 0) + id = Int64(entry.peer?.id.id._internalGetInt64Value() ?? 0) if let resource = entry.videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } diff --git a/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift b/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift index bfd6117b7d..ad0955305b 100644 --- a/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift +++ b/submodules/PeerInfoAvatarListNode/Sources/PeerInfoAvatarListNode.swift @@ -365,7 +365,7 @@ public final class PeerInfoAvatarListItemNode: ASDisplayNode { representations = topRepresentations videoRepresentations = videoRepresentationsValue immediateThumbnailData = immediateThumbnail - id = Int64(self.peer.id.id._internalGetInt32Value()) + id = self.peer.id.id._internalGetInt64Value() if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } @@ -376,7 +376,7 @@ public final class PeerInfoAvatarListItemNode: ASDisplayNode { if case let .cloud(imageId, _, _) = reference { id = imageId } else { - id = Int64(self.peer.id.id._internalGetInt32Value()) + id = self.peer.id.id._internalGetInt64Value() } } self.imageNode.setSignal(chatAvatarGalleryPhoto(account: self.context.account, representations: representations, immediateThumbnailData: immediateThumbnailData, autoFetchFullSize: true, attemptSynchronously: synchronous, skipThumbnail: fullSizeOnly), attemptSynchronously: synchronous, dispatchOnDisplayLink: false) diff --git a/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift b/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift index 2656226d71..ee83d81804 100644 --- a/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift +++ b/submodules/PeerInfoUI/Sources/DeviceContactInfoController.swift @@ -653,7 +653,7 @@ private func deviceContactInfoEntries(account: Account, presentationData: Presen firstName = presentationData.strings.Message_Contact } - entries.append(.info(entries.count, presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer: peer ?? TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: firstName, lastName: isOrganization ? nil : personName.1, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []), state: ItemListAvatarAndNameInfoItemState(editingName: editingName, updatingName: nil), job: isOrganization ? nil : jobSummary, isPlain: !isShare)) + entries.append(.info(entries.count, presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer: peer ?? TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: firstName, lastName: isOrganization ? nil : personName.1, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []), state: ItemListAvatarAndNameInfoItemState(editingName: editingName, updatingName: nil), job: isOrganization ? nil : jobSummary, isPlain: !isShare)) if !selecting { if let _ = peer { diff --git a/submodules/Postbox/Sources/Peer.swift b/submodules/Postbox/Sources/Peer.swift index 48943109a3..40f0332680 100644 --- a/submodules/Postbox/Sources/Peer.swift +++ b/submodules/Postbox/Sources/Peer.swift @@ -56,7 +56,7 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { return Id(rawValue: 0x000000007fffffff) } - fileprivate var rawValue: Int32 + fileprivate var rawValue: Int64 var predecessor: Id { if self.rawValue != 0 { @@ -78,17 +78,18 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { return "\(self.rawValue)" } - fileprivate init(rawValue: Int32) { + fileprivate init(rawValue: Int64) { //precondition((rawValue | 0x000FFFFFFFFFFFFF) == 0x000FFFFFFFFFFFFF) + assert(rawValue == (rawValue & 0x00ffffffffffffff)) self.rawValue = rawValue } - public static func _internalFromInt32Value(_ value: Int32) -> Id { + public static func _internalFromInt64Value(_ value: Int64) -> Id { return Id(rawValue: value) } - public func _internalGetInt32Value() -> Int32 { + public func _internalGetInt64Value() -> Int64 { return self.rawValue } @@ -140,25 +141,35 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { public init(_ n: Int64) { let data = UInt64(bitPattern: n) + // Bits: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + // |___________________________|__| |______________________________| + // id high bits (29) ns id low bits (32) + let legacyNamespaceBits = ((data >> 32) & 0xffffffff) let idLowBits = data & 0xffffffff if legacyNamespaceBits == 0x7fffffff && idLowBits == 0 { self.namespace = .max - self.id = Id(rawValue: Int32(bitPattern: UInt32(clamping: idLowBits))) + self.id = Id(rawValue: Int64(bitPattern: UInt64(clamping: idLowBits))) } else { + // 0x7 == 0b111 let namespaceBits = ((data >> 32) & 0x7) self.namespace = Namespace(rawValue: UInt32(namespaceBits)) - let idHighBits = (data >> (32 + 3)) & 0xffffffff - //assert(idHighBits == 0) + let offsetIdHighBits = (data >> (32 + 3)) & 0xffffffff + let idHighBits = offsetIdHighBits << 32 - self.id = Id(rawValue: Int32(bitPattern: UInt32(clamping: idLowBits))) + self.id = Id(rawValue: Int64(bitPattern: idHighBits | idLowBits)) } + + assert(self.toInt64() == n) } public func toInt64() -> Int64 { - let idLowBits = UInt32(bitPattern: self.id.rawValue) + let data = UInt64(bitPattern: self.id.rawValue) + + let idLowBits = data & 0xffffffff + let idHighBits = (data >> 32) & 0xffffffff let result: Int64 if self.namespace == .max && self.id.rawValue == 0 { @@ -166,19 +177,16 @@ public struct PeerId: Hashable, CustomStringConvertible, Comparable, Codable { let namespaceBits: UInt64 = 0x7fffffff data |= namespaceBits << 32 - - data |= UInt64(idLowBits) + data |= idLowBits result = Int64(bitPattern: data) } else { var data: UInt64 = 0 - data |= UInt64(self.namespace.rawValue) << 32 - - let idValue = UInt32(bitPattern: self.id.rawValue) - let idHighBits = (idValue >> 32) & 0x3FFFFFFF - assert(idHighBits == 0) - - data |= UInt64(idLowBits) + assert(self.namespace.rawValue & 0x7 == self.namespace.rawValue) + let offsetIdHighBits = idHighBits << (32 + 3) + data |= UInt64(self.namespace.rawValue & 0x7) << 32 + data |= offsetIdHighBits + data |= idLowBits result = Int64(bitPattern: data) } diff --git a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift index 1b32ab836f..b13905e9a6 100644 --- a/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift +++ b/submodules/SettingsUI/Sources/BubbleSettings/BubbleSettingsController.swift @@ -160,7 +160,7 @@ private final class BubbleSettingsControllerNode: ASDisplayNode, UIScrollViewDel let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift index 000b2d8d36..f14935012a 100644 --- a/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Privacy and Security/ForwardPrivacyChatPreviewItem.swift @@ -150,7 +150,7 @@ class ForwardPrivacyChatPreviewItemNode: ListViewItemNode { let insets: UIEdgeInsets let separatorHeight = UIScreenPixel - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) var peers = SimpleDictionary() let messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift index edb4bfd164..4ef690036d 100644 --- a/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift +++ b/submodules/SettingsUI/Sources/Text Size/TextSizeSelectionController.swift @@ -221,14 +221,14 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView let peers = SimpleDictionary() let messages = SimpleDictionary() let selfPeer = TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer7 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer7 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp = self.referenceTimestamp @@ -306,7 +306,7 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.presentationData.theme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift index 6d8bb52b92..040fd05e85 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeAccentColorControllerNode.swift @@ -790,11 +790,11 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate let peers = SimpleDictionary() let messages = SimpleDictionary() let selfPeer = TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp = self.referenceTimestamp @@ -856,7 +856,7 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.theme, strings: self.presentationData.strings, wallpaper: self.wallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift index 7f57328d53..62095df24a 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemePreviewControllerNode.swift @@ -367,14 +367,14 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { let peers = SimpleDictionary() let messages = SimpleDictionary() let selfPeer = TelegramUser(id: self.context.account.peerId, accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) - let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) - let peer7 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer1 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_1_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer2 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_2_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer3 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(3)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .group(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer3Author = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_3_AuthorName, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer4 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_4_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer5 = TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, title: self.presentationData.strings.Appearance_ThemePreview_ChatList_5_Name, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .member, info: .broadcast(.init(flags: [])), flags: [], restrictionInfo: nil, adminRights: nil, bannedRights: nil, defaultBannedRights: nil) + let peer6 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(5)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_6_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let peer7 = TelegramUser(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(6)), accessHash: nil, firstName: self.presentationData.strings.Appearance_ThemePreview_ChatList_7_Name, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let timestamp = self.referenceTimestamp @@ -454,7 +454,7 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate { let headerItem = self.context.sharedContext.makeChatMessageDateHeaderItem(context: self.context, timestamp: self.referenceTimestamp, theme: self.previewTheme, strings: self.presentationData.strings, wallpaper: self.presentationData.chatWallpaper, fontSize: self.presentationData.chatFontSize, chatBubbleCorners: self.presentationData.chatBubbleCorners, dateTimeFormat: self.presentationData.dateTimeFormat, nameOrder: self.presentationData.nameDisplayOrder) var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() var messages = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift index 5a07d05a5e..3788ffe867 100644 --- a/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift +++ b/submodules/SettingsUI/Sources/Themes/ThemeSettingsChatPreviewItem.swift @@ -147,8 +147,8 @@ class ThemeSettingsChatPreviewItemNode: ListViewItemNode { let insets: UIEdgeInsets let separatorHeight = UIScreenPixel - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) - let otherPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(2)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) + let otherPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(2)) var items: [ListViewItem] = [] for messageItem in item.messageItems.reversed() { var peers = SimpleDictionary() diff --git a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift index e9cc0bce08..760ee8a783 100644 --- a/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift +++ b/submodules/SettingsUI/Sources/Themes/WallpaperGalleryItem.swift @@ -1030,7 +1030,7 @@ final class WallpaperGalleryItemNode: GalleryItemNode { } var items: [ListViewItem] = [] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(1)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(1)) let otherPeerId = self.context.account.peerId var peers = SimpleDictionary() let messages = SimpleDictionary() diff --git a/submodules/SyncCore/Sources/PeerReference.swift b/submodules/SyncCore/Sources/PeerReference.swift index 9b93b4f6e6..6830c2b3f7 100644 --- a/submodules/SyncCore/Sources/PeerReference.swift +++ b/submodules/SyncCore/Sources/PeerReference.swift @@ -1,18 +1,36 @@ import Postbox public enum PeerReference: PostboxCoding, Hashable, Equatable { - case user(id: Int32, accessHash: Int64) - case group(id: Int32) - case channel(id: Int32, accessHash: Int64) + case user(id: Int64, accessHash: Int64) + case group(id: Int64) + case channel(id: Int64, accessHash: Int64) public init(decoder: PostboxDecoder) { switch decoder.decodeInt32ForKey("_r", orElse: 0) { case 0: - self = .user(id: decoder.decodeInt32ForKey("i", orElse: 0), accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) + let id: Int64 + if let idValue = decoder.decodeOptionalInt64ForKey("i") { + id = idValue + } else { + id = Int64(decoder.decodeInt32ForKey("i", orElse: 0)) + } + self = .user(id: id, accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) case 1: - self = .group(id: decoder.decodeInt32ForKey("i", orElse: 0)) + let id: Int64 + if let idValue = decoder.decodeOptionalInt64ForKey("i") { + id = idValue + } else { + id = Int64(decoder.decodeInt32ForKey("i", orElse: 0)) + } + self = .group(id: id) case 2: - self = .channel(id: decoder.decodeInt32ForKey("i", orElse: 0), accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) + let id: Int64 + if let idValue = decoder.decodeOptionalInt64ForKey("i") { + id = idValue + } else { + id = Int64(decoder.decodeInt32ForKey("i", orElse: 0)) + } + self = .channel(id: id, accessHash: decoder.decodeInt64ForKey("h", orElse: 0)) default: assertionFailure() self = .user(id: 0, accessHash: 0) @@ -23,14 +41,14 @@ public enum PeerReference: PostboxCoding, Hashable, Equatable { switch self { case let .user(id, accessHash): encoder.encodeInt32(0, forKey: "_r") - encoder.encodeInt32(id, forKey: "i") + encoder.encodeInt64(id, forKey: "i") encoder.encodeInt64(accessHash, forKey: "h") case let .group(id): encoder.encodeInt32(1, forKey: "_r") - encoder.encodeInt32(id, forKey: "i") + encoder.encodeInt64(id, forKey: "i") case let .channel(id, accessHash): encoder.encodeInt32(2, forKey: "_r") - encoder.encodeInt32(id, forKey: "i") + encoder.encodeInt64(id, forKey: "i") encoder.encodeInt64(accessHash, forKey: "h") } } @@ -39,15 +57,15 @@ public enum PeerReference: PostboxCoding, Hashable, Equatable { switch peer { case let user as TelegramUser: if let accessHash = user.accessHash { - self = .user(id: user.id.id._internalGetInt32Value(), accessHash: accessHash.value) + self = .user(id: user.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } case let group as TelegramGroup: - self = .group(id: group.id.id._internalGetInt32Value()) + self = .group(id: group.id.id._internalGetInt64Value()) case let channel as TelegramChannel: if let accessHash = channel.accessHash { - self = .channel(id: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + self = .channel(id: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } diff --git a/submodules/SyncCore/Sources/StandaloneAccountTransaction.swift b/submodules/SyncCore/Sources/StandaloneAccountTransaction.swift index d9b8c07eb7..b6c8a44e76 100644 --- a/submodules/SyncCore/Sources/StandaloneAccountTransaction.swift +++ b/submodules/SyncCore/Sources/StandaloneAccountTransaction.swift @@ -38,7 +38,7 @@ public let telegramPostboxSeedConfiguration: SeedConfiguration = { globalMessageIdsPeerIdNamespaces.insert(GlobalMessageIdsNamespace(peerIdNamespace: peerIdNamespace, messageIdNamespace: Namespaces.Message.Cloud)) } - return SeedConfiguration(globalMessageIdsPeerIdNamespaces: globalMessageIdsPeerIdNamespaces, initializeChatListWithHole: (topLevel: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1)), groups: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1))), messageHoles: messageHoles, upgradedMessageHoles: upgradedMessageHoles, messageThreadHoles: messageThreadHoles, existingMessageTags: MessageTags.all, messageTagsWithSummary: [.unseenPersonalMessage, .pinned], existingGlobalMessageTags: GlobalMessageTags.all, peerNamespacesRequiringMessageTextIndex: [Namespaces.Peer.SecretChat], peerSummaryCounterTags: { peer, isContact in + return SeedConfiguration(globalMessageIdsPeerIdNamespaces: globalMessageIdsPeerIdNamespaces, initializeChatListWithHole: (topLevel: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1)), groups: ChatListHole(index: MessageIndex(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(0)), namespace: Namespaces.Message.Cloud, id: 1), timestamp: Int32.max - 1))), messageHoles: messageHoles, upgradedMessageHoles: upgradedMessageHoles, messageThreadHoles: messageThreadHoles, existingMessageTags: MessageTags.all, messageTagsWithSummary: [.unseenPersonalMessage, .pinned], existingGlobalMessageTags: GlobalMessageTags.all, peerNamespacesRequiringMessageTextIndex: [Namespaces.Peer.SecretChat], peerSummaryCounterTags: { peer, isContact in if let peer = peer as? TelegramUser { if peer.botInfo != nil { return .bot diff --git a/submodules/SyncCore/Sources/SynchronizePinnedChatsOperation.swift b/submodules/SyncCore/Sources/SynchronizePinnedChatsOperation.swift index 02b21573c2..24dd5195fe 100644 --- a/submodules/SyncCore/Sources/SynchronizePinnedChatsOperation.swift +++ b/submodules/SyncCore/Sources/SynchronizePinnedChatsOperation.swift @@ -48,7 +48,7 @@ public func addSynchronizePinnedChatsOperation(transaction: Transaction, groupId var previousItemIds = transaction.getPinnedItemIds(groupId: groupId) var updateLocalIndex: Int32? - transaction.operationLogEnumerateEntries(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(rawId)), tag: OperationLogTags.SynchronizePinnedChats, { entry in + transaction.operationLogEnumerateEntries(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(rawId))), tag: OperationLogTags.SynchronizePinnedChats, { entry in updateLocalIndex = entry.tagLocalIndex if let contents = entry.contents as? SynchronizePinnedChatsOperation { previousItemIds = contents.previousItemIds @@ -57,7 +57,7 @@ public func addSynchronizePinnedChatsOperation(transaction: Transaction, groupId }) let operationContents = SynchronizePinnedChatsOperation(previousItemIds: previousItemIds) if let updateLocalIndex = updateLocalIndex { - let _ = transaction.operationLogRemoveEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(rawId)), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: updateLocalIndex) + let _ = transaction.operationLogRemoveEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(rawId))), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: updateLocalIndex) } - transaction.operationLogAddEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(rawId)), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: operationContents) + transaction.operationLogAddEntry(peerId: PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(rawId))), tag: OperationLogTags.SynchronizePinnedChats, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: operationContents) } diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 3c9df65cf7..ebed8e8542 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -11,12 +11,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) } dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) } dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) } - dict[-1977734781] = { return Api.ChatFull.parse_chatFull($0) } - dict[1418477459] = { return Api.ChatFull.parse_channelFull($0) } - dict[-1159937629] = { return Api.PollResults.parse_pollResults($0) } - dict[-925415106] = { return Api.ChatParticipant.parse_chatParticipant($0) } - dict[-636267638] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) } - dict[-489233354] = { return Api.ChatParticipant.parse_chatParticipantAdmin($0) } + dict[1509543498] = { return Api.ChatFull.parse_chatFull($0) } + dict[-1625164883] = { return Api.ChatFull.parse_channelFull($0) } + dict[-591909213] = { return Api.PollResults.parse_pollResults($0) } + dict[-1070776313] = { return Api.ChatParticipant.parse_chatParticipant($0) } + dict[-462696732] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) } + dict[-1600962725] = { return Api.ChatParticipant.parse_chatParticipantAdmin($0) } dict[1567990072] = { return Api.updates.Difference.parse_differenceEmpty($0) } dict[16030880] = { return Api.updates.Difference.parse_difference($0) } dict[-1459938943] = { return Api.updates.Difference.parse_differenceSlice($0) } @@ -65,11 +65,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1715350371] = { return Api.JSONValue.parse_jsonObject($0) } dict[590459437] = { return Api.Photo.parse_photoEmpty($0) } dict[-82216347] = { return Api.Photo.parse_photo($0) } - dict[-1683826688] = { return Api.Chat.parse_chatEmpty($0) } - dict[1004149726] = { return Api.Chat.parse_chat($0) } - dict[120753115] = { return Api.Chat.parse_chatForbidden($0) } - dict[-753232354] = { return Api.Chat.parse_channel($0) } - dict[681420594] = { return Api.Chat.parse_channelForbidden($0) } + dict[693512293] = { return Api.Chat.parse_chatEmpty($0) } + dict[1103884886] = { return Api.Chat.parse_chat($0) } + dict[1704108455] = { return Api.Chat.parse_chatForbidden($0) } + dict[1106612516] = { return Api.Chat.parse_channel($0) } + dict[399807445] = { return Api.Chat.parse_channelForbidden($0) } dict[1202287072] = { return Api.StatsURL.parse_statsURL($0) } dict[1516793212] = { return Api.ChatInvite.parse_chatInviteAlready($0) } dict[-540871282] = { return Api.ChatInvite.parse_chatInvite($0) } @@ -83,8 +83,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1678812626] = { return Api.StickerSetCovered.parse_stickerSetCovered($0) } dict[872932635] = { return Api.StickerSetCovered.parse_stickerSetMultiCovered($0) } dict[1189204285] = { return Api.RecentMeUrl.parse_recentMeUrlUnknown($0) } - dict[-1917045962] = { return Api.RecentMeUrl.parse_recentMeUrlUser($0) } - dict[-1608834311] = { return Api.RecentMeUrl.parse_recentMeUrlChat($0) } + dict[-1188296222] = { return Api.RecentMeUrl.parse_recentMeUrlUser($0) } + dict[-1294306862] = { return Api.RecentMeUrl.parse_recentMeUrlChat($0) } dict[-347535331] = { return Api.RecentMeUrl.parse_recentMeUrlChatInvite($0) } dict[-1140172836] = { return Api.RecentMeUrl.parse_recentMeUrlStickerSet($0) } dict[-797791052] = { return Api.RestrictionReason.parse_restrictionReason($0) } @@ -108,8 +108,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[894777186] = { return Api.RichText.parse_textAnchor($0) } dict[328899191] = { return Api.UserFull.parse_userFull($0) } dict[-292807034] = { return Api.InputChannel.parse_inputChannelEmpty($0) } - dict[-1343524562] = { return Api.InputChannel.parse_inputChannel($0) } - dict[707290417] = { return Api.InputChannel.parse_inputChannelFromMessage($0) } + dict[-212145112] = { return Api.InputChannel.parse_inputChannel($0) } + dict[1536380829] = { return Api.InputChannel.parse_inputChannelFromMessage($0) } dict[414687501] = { return Api.DcOption.parse_dcOption($0) } dict[997055186] = { return Api.PollAnswerVoters.parse_pollAnswerVoters($0) } dict[-1705233435] = { return Api.account.PasswordSettings.parse_passwordSettings($0) } @@ -121,7 +121,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-209337866] = { return Api.LangPackDifference.parse_langPackDifference($0) } dict[499236004] = { return Api.WallPaperSettings.parse_wallPaperSettings($0) } dict[-1519029347] = { return Api.EmojiURL.parse_emojiURL($0) } - dict[1611985938] = { return Api.StatsGroupTopAdmin.parse_statsGroupTopAdmin($0) } + dict[-682079097] = { return Api.StatsGroupTopAdmin.parse_statsGroupTopAdmin($0) } dict[-541588713] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) } dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) } dict[-763367294] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordSRP($0) } @@ -151,9 +151,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1148485274] = { return Api.auth.Authorization.parse_authorizationSignUpRequired($0) } dict[-181407105] = { return Api.InputFile.parse_inputFile($0) } dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) } - dict[-1649296275] = { return Api.Peer.parse_peerUser($0) } - dict[-1160714821] = { return Api.Peer.parse_peerChat($0) } - dict[-1109531342] = { return Api.Peer.parse_peerChannel($0) } + dict[1498486562] = { return Api.Peer.parse_peerUser($0) } + dict[918946202] = { return Api.Peer.parse_peerChat($0) } + dict[-1566230754] = { return Api.Peer.parse_peerChannel($0) } dict[410107472] = { return Api.messages.ExportedChatInvite.parse_exportedChatInvite($0) } dict[572915951] = { return Api.messages.ExportedChatInvite.parse_exportedChatInviteReplaced($0) } dict[-1868808300] = { return Api.PaymentRequestedInfo.parse_paymentRequestedInfo($0) } @@ -192,64 +192,64 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[522914557] = { return Api.Update.parse_updateNewMessage($0) } dict[1318109142] = { return Api.Update.parse_updateMessageID($0) } dict[-1576161051] = { return Api.Update.parse_updateDeleteMessages($0) } - dict[1548249383] = { return Api.Update.parse_updateUserTyping($0) } - dict[-2033525908] = { return Api.Update.parse_updateChatUserTyping($0) } + dict[-1071741569] = { return Api.Update.parse_updateUserTyping($0) } + dict[-2092401936] = { return Api.Update.parse_updateChatUserTyping($0) } dict[125178264] = { return Api.Update.parse_updateChatParticipants($0) } - dict[469489699] = { return Api.Update.parse_updateUserStatus($0) } - dict[-1489818765] = { return Api.Update.parse_updateUserName($0) } - dict[-1791935732] = { return Api.Update.parse_updateUserPhoto($0) } + dict[-440534818] = { return Api.Update.parse_updateUserStatus($0) } + dict[-1007549728] = { return Api.Update.parse_updateUserName($0) } + dict[-232290676] = { return Api.Update.parse_updateUserPhoto($0) } dict[314359194] = { return Api.Update.parse_updateNewEncryptedMessage($0) } - dict[386986326] = { return Api.Update.parse_updateEncryptedChatTyping($0) } + dict[1677363374] = { return Api.Update.parse_updateEncryptedChatTyping($0) } dict[-1264392051] = { return Api.Update.parse_updateEncryption($0) } - dict[956179895] = { return Api.Update.parse_updateEncryptedMessagesRead($0) } - dict[-364179876] = { return Api.Update.parse_updateChatParticipantAdd($0) } - dict[1851755554] = { return Api.Update.parse_updateChatParticipantDelete($0) } + dict[122695484] = { return Api.Update.parse_updateEncryptedMessagesRead($0) } + dict[1037718609] = { return Api.Update.parse_updateChatParticipantAdd($0) } + dict[-483443337] = { return Api.Update.parse_updateChatParticipantDelete($0) } dict[-1906403213] = { return Api.Update.parse_updateDcOptions($0) } dict[-1094555409] = { return Api.Update.parse_updateNotifySettings($0) } dict[-337352679] = { return Api.Update.parse_updateServiceNotification($0) } dict[-298113238] = { return Api.Update.parse_updatePrivacy($0) } - dict[314130811] = { return Api.Update.parse_updateUserPhone($0) } + dict[88680979] = { return Api.Update.parse_updateUserPhone($0) } dict[-1667805217] = { return Api.Update.parse_updateReadHistoryInbox($0) } dict[791617983] = { return Api.Update.parse_updateReadHistoryOutbox($0) } dict[2139689491] = { return Api.Update.parse_updateWebPage($0) } dict[1757493555] = { return Api.Update.parse_updateReadMessagesContents($0) } - dict[-352032773] = { return Api.Update.parse_updateChannelTooLong($0) } - dict[-1227598250] = { return Api.Update.parse_updateChannel($0) } + dict[277713951] = { return Api.Update.parse_updateChannelTooLong($0) } + dict[1666927625] = { return Api.Update.parse_updateChannel($0) } dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) } - dict[856380452] = { return Api.Update.parse_updateReadChannelInbox($0) } - dict[-1015733815] = { return Api.Update.parse_updateDeleteChannelMessages($0) } - dict[-1734268085] = { return Api.Update.parse_updateChannelMessageViews($0) } - dict[-1232070311] = { return Api.Update.parse_updateChatParticipantAdmin($0) } + dict[-1842450928] = { return Api.Update.parse_updateReadChannelInbox($0) } + dict[-1020437742] = { return Api.Update.parse_updateDeleteChannelMessages($0) } + dict[-232346616] = { return Api.Update.parse_updateChannelMessageViews($0) } + dict[-674602590] = { return Api.Update.parse_updateChatParticipantAdmin($0) } dict[1753886890] = { return Api.Update.parse_updateNewStickerSet($0) } dict[196268545] = { return Api.Update.parse_updateStickerSetsOrder($0) } dict[1135492588] = { return Api.Update.parse_updateStickerSets($0) } dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($0) } - dict[1059076315] = { return Api.Update.parse_updateBotInlineQuery($0) } - dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) } + dict[1232025500] = { return Api.Update.parse_updateBotInlineQuery($0) } + dict[317794823] = { return Api.Update.parse_updateBotInlineSend($0) } dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) } - dict[-415938591] = { return Api.Update.parse_updateBotCallbackQuery($0) } + dict[-1177566067] = { return Api.Update.parse_updateBotCallbackQuery($0) } dict[-469536605] = { return Api.Update.parse_updateEditMessage($0) } - dict[-103646630] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) } - dict[634833351] = { return Api.Update.parse_updateReadChannelOutbox($0) } + dict[1763610706] = { return Api.Update.parse_updateInlineBotCallbackQuery($0) } + dict[-1218471511] = { return Api.Update.parse_updateReadChannelOutbox($0) } dict[-299124375] = { return Api.Update.parse_updateDraftMessage($0) } dict[1461528386] = { return Api.Update.parse_updateReadFeaturedStickers($0) } dict[-1706939360] = { return Api.Update.parse_updateRecentStickers($0) } dict[-1574314746] = { return Api.Update.parse_updateConfig($0) } dict[861169551] = { return Api.Update.parse_updatePtsChanged($0) } - dict[1081547008] = { return Api.Update.parse_updateChannelWebPage($0) } + dict[791390623] = { return Api.Update.parse_updateChannelWebPage($0) } dict[1852826908] = { return Api.Update.parse_updateDialogPinned($0) } dict[-99664734] = { return Api.Update.parse_updatePinnedDialogs($0) } dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) } dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) } - dict[-523384512] = { return Api.Update.parse_updateBotShippingQuery($0) } - dict[1563376297] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) } + dict[-1246823043] = { return Api.Update.parse_updateBotShippingQuery($0) } + dict[-1934976362] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) } dict[-1425052898] = { return Api.Update.parse_updatePhoneCall($0) } dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) } dict[1442983757] = { return Api.Update.parse_updateLangPack($0) } dict[-451831443] = { return Api.Update.parse_updateFavedStickers($0) } - dict[-1987495099] = { return Api.Update.parse_updateChannelReadMessagesContents($0) } + dict[1153291573] = { return Api.Update.parse_updateChannelReadMessagesContents($0) } dict[1887741886] = { return Api.Update.parse_updateContactsReset($0) } - dict[1893427255] = { return Api.Update.parse_updateChannelAvailableMessages($0) } + dict[-1304443240] = { return Api.Update.parse_updateChannelAvailableMessages($0) } dict[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) } dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) } dict[1421875280] = { return Api.Update.parse_updateChatDefaultBannedRights($0) } @@ -261,39 +261,40 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-2112423005] = { return Api.Update.parse_updateTheme($0) } dict[-2027964103] = { return Api.Update.parse_updateGeoLiveViewed($0) } dict[1448076945] = { return Api.Update.parse_updateLoginToken($0) } - dict[938909451] = { return Api.Update.parse_updateMessagePollVote($0) } + dict[1421152257] = { return Api.Update.parse_updateMessagePollVote($0) } dict[654302845] = { return Api.Update.parse_updateDialogFilter($0) } dict[-1512627963] = { return Api.Update.parse_updateDialogFilterOrder($0) } dict[889491791] = { return Api.Update.parse_updateDialogFilters($0) } dict[643940105] = { return Api.Update.parse_updatePhoneCallSignalingData($0) } - dict[1854571743] = { return Api.Update.parse_updateChannelMessageForwards($0) } - dict[482860628] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) } - dict[1178116716] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) } + dict[-761649164] = { return Api.Update.parse_updateChannelMessageForwards($0) } + dict[-693004986] = { return Api.Update.parse_updateReadChannelDiscussionInbox($0) } + dict[1767677564] = { return Api.Update.parse_updateReadChannelDiscussionOutbox($0) } dict[610945826] = { return Api.Update.parse_updatePeerBlocked($0) } - dict[1796675352] = { return Api.Update.parse_updateChannelUserTyping($0) } + dict[-1937192669] = { return Api.Update.parse_updateChannelUserTyping($0) } dict[-309990731] = { return Api.Update.parse_updatePinnedMessages($0) } - dict[-2054649973] = { return Api.Update.parse_updatePinnedChannelMessages($0) } - dict[321954198] = { return Api.Update.parse_updateChat($0) } + dict[1538885128] = { return Api.Update.parse_updatePinnedChannelMessages($0) } + dict[-124097970] = { return Api.Update.parse_updateChat($0) } dict[-219423922] = { return Api.Update.parse_updateGroupCallParticipants($0) } - dict[-1537295973] = { return Api.Update.parse_updateGroupCall($0) } + dict[347227392] = { return Api.Update.parse_updateGroupCall($0) } dict[-1147422299] = { return Api.Update.parse_updatePeerHistoryTTL($0) } - dict[-206342113] = { return Api.Update.parse_updateChatParticipant($0) } - dict[2146218476] = { return Api.Update.parse_updateChannelParticipant($0) } - dict[133777546] = { return Api.Update.parse_updateBotStopped($0) } + dict[-796432838] = { return Api.Update.parse_updateChatParticipant($0) } + dict[-1738720581] = { return Api.Update.parse_updateChannelParticipant($0) } + dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) } dict[192428418] = { return Api.Update.parse_updateGroupCallConnection($0) } + dict[1299263278] = { return Api.Update.parse_updateBotCommands($0) } dict[136574537] = { return Api.messages.VotesList.parse_votesList($0) } dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) } dict[-592373577] = { return Api.GroupCallParticipantVideoSourceGroup.parse_groupCallParticipantVideoSourceGroup($0) } dict[-373643672] = { return Api.FolderPeer.parse_folderPeer($0) } - dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) } - dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } - dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) } - dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) } - dict[1352785878] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) } + dict[-1072953408] = { return Api.ChannelParticipant.parse_channelParticipant($0) } + dict[682146919] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } + dict[803602899] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) } + dict[885242707] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) } + dict[1844969806] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) } dict[453242886] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) } - dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) } - dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) } - dict[244310238] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) } + dict[886196148] = { return Api.MessageUserVote.parse_messageUserVote($0) } + dict[1017491692] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) } + dict[-1973033641] = { return Api.MessageUserVote.parse_messageUserVoteMultiple($0) } dict[182326673] = { return Api.contacts.Blocked.parse_blocked($0) } dict[-513392236] = { return Api.contacts.Blocked.parse_blockedSlice($0) } dict[-55902537] = { return Api.InputDialogPeer.parse_inputDialogPeer($0) } @@ -309,7 +310,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[280464681] = { return Api.KeyboardButton.parse_keyboardButtonUrlAuth($0) } dict[-802258988] = { return Api.KeyboardButton.parse_inputKeyboardButtonUrlAuth($0) } dict[-1144565411] = { return Api.KeyboardButton.parse_keyboardButtonRequestPoll($0) } - dict[-748155807] = { return Api.ContactStatus.parse_contactStatus($0) } + dict[383348795] = { return Api.ContactStatus.parse_contactStatus($0) } dict[1679398724] = { return Api.SecureFile.parse_secureFileEmpty($0) } dict[-534283678] = { return Api.SecureFile.parse_secureFile($0) } dict[-199313886] = { return Api.account.Themes.parse_themesNotModified($0) } @@ -374,7 +375,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-353862078] = { return Api.contacts.Contacts.parse_contacts($0) } dict[-1798033689] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilterEmpty($0) } dict[-847783593] = { return Api.ChannelMessagesFilter.parse_channelMessagesFilter($0) } - dict[-539872497] = { return Api.ChatAdminWithInvites.parse_chatAdminWithInvites($0) } + dict[-219353309] = { return Api.ChatAdminWithInvites.parse_chatAdminWithInvites($0) } dict[2004110666] = { return Api.DialogFilterSuggested.parse_dialogFilterSuggested($0) } dict[326715557] = { return Api.auth.PasswordRecovery.parse_passwordRecovery($0) } dict[-1803769784] = { return Api.messages.BotResults.parse_botResults($0) } @@ -400,13 +401,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) } dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) } dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) } - dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) } - dict[2072935910] = { return Api.InputPeer.parse_inputPeerUser($0) } - dict[548253432] = { return Api.InputPeer.parse_inputPeerChannel($0) } - dict[398123750] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) } - dict[-1667893317] = { return Api.InputPeer.parse_inputPeerChannelFromMessage($0) } + dict[900291769] = { return Api.InputPeer.parse_inputPeerChat($0) } + dict[-571955892] = { return Api.InputPeer.parse_inputPeerUser($0) } + dict[666680316] = { return Api.InputPeer.parse_inputPeerChannel($0) } + dict[-1468331492] = { return Api.InputPeer.parse_inputPeerUserFromMessage($0) } + dict[-1121318848] = { return Api.InputPeer.parse_inputPeerChannelFromMessage($0) } dict[568808380] = { return Api.upload.WebFile.parse_webFile($0) } - dict[-116274796] = { return Api.Contact.parse_contact($0) } + dict[341499403] = { return Api.Contact.parse_contact($0) } dict[-1078332329] = { return Api.help.PassportConfig.parse_passportConfigNotModified($0) } dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) } dict[1648543603] = { return Api.FileHash.parse_fileHash($0) } @@ -427,8 +428,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[195371015] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowContacts($0) } dict[-697604407] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowAll($0) } dict[-1877932953] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowUsers($0) } - dict[1283572154] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowChatParticipants($0) } - dict[-668769361] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowChatParticipants($0) } + dict[-2079962673] = { return Api.InputPrivacyRule.parse_inputPrivacyValueAllowChatParticipants($0) } + dict[-380694650] = { return Api.InputPrivacyRule.parse_inputPrivacyValueDisallowChatParticipants($0) } dict[-1058912715] = { return Api.messages.DhConfig.parse_dhConfigNotModified($0) } dict[740433629] = { return Api.messages.DhConfig.parse_dhConfig($0) } dict[-421545947] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeTitle($0) } @@ -449,7 +450,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1599903217] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionTogglePreHistoryHidden($0) } dict[771095562] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionDefaultBannedRights($0) } dict[-1895328189] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStopPoll($0) } - dict[-1569748965] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLinkedChat($0) } + dict[84703944] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLinkedChat($0) } dict[241923758] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLocation($0) } dict[1401984889] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleSlowMode($0) } dict[589338437] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStartGroupCall($0) } @@ -463,7 +464,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-384910503] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionExportedInviteEdit($0) } dict[1048537159] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantVolume($0) } dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) } - dict[-543777747] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) } + dict[-1271602504] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) } dict[2103482845] = { return Api.SecurePlainData.parse_securePlainPhone($0) } dict[569137759] = { return Api.SecurePlainData.parse_securePlainEmail($0) } dict[-1269012015] = { return Api.messages.AffectedHistory.parse_affectedHistory($0) } @@ -497,7 +498,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) } dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) } dict[-1014526429] = { return Api.help.Country.parse_country($0) } - dict[418631927] = { return Api.StatsGroupTopPoster.parse_statsGroupTopPoster($0) } + dict[-1660637285] = { return Api.StatsGroupTopPoster.parse_statsGroupTopPoster($0) } dict[-2128640689] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) } dict[-1038136962] = { return Api.EncryptedFile.parse_encryptedFileEmpty($0) } dict[1248893260] = { return Api.EncryptedFile.parse_encryptedFile($0) } @@ -533,7 +534,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-2049074735] = { return Api.ReplyMarkup.parse_replyKeyboardMarkup($0) } dict[1218642516] = { return Api.ReplyMarkup.parse_replyInlineMarkup($0) } dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) } - dict[1493171408] = { return Api.HighScore.parse_highScore($0) } + dict[1940093419] = { return Api.HighScore.parse_highScore($0) } dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) } dict[-1495959709] = { return Api.MessageReplyHeader.parse_messageReplyHeader($0) } dict[411017418] = { return Api.SecureValue.parse_secureValue($0) } @@ -545,8 +546,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-386039788] = { return Api.PeerBlocked.parse_peerBlocked($0) } dict[-1182234929] = { return Api.InputUser.parse_inputUserEmpty($0) } dict[-138301121] = { return Api.InputUser.parse_inputUserSelf($0) } - dict[-668391402] = { return Api.InputUser.parse_inputUser($0) } - dict[756118935] = { return Api.InputUser.parse_inputUserFromMessage($0) } + dict[-233744186] = { return Api.InputUser.parse_inputUser($0) } + dict[497305826] = { return Api.InputUser.parse_inputUserFromMessage($0) } dict[-1738178803] = { return Api.Page.parse_page($0) } dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) } dict[-875679776] = { return Api.StatsPercentValue.parse_statsPercentValue($0) } @@ -557,6 +558,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[182649427] = { return Api.MessageRange.parse_messageRange($0) } dict[946083368] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultSuccess($0) } dict[904138920] = { return Api.messages.StickerSetInstallResult.parse_stickerSetInstallResultArchive($0) } + dict[-478701471] = { return Api.account.ResetPasswordResult.parse_resetPasswordFailedWait($0) } + dict[-370148227] = { return Api.account.ResetPasswordResult.parse_resetPasswordRequestedWait($0) } + dict[-383330754] = { return Api.account.ResetPasswordResult.parse_resetPasswordOk($0) } dict[856375399] = { return Api.Config.parse_config($0) } dict[-75283823] = { return Api.TopPeerCategoryPeers.parse_topPeerCategoryPeers($0) } dict[-1107729093] = { return Api.Game.parse_game($0) } @@ -567,12 +571,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) } dict[1474462241] = { return Api.account.ContentSettings.parse_contentSettings($0) } dict[-193506890] = { return Api.phone.GroupParticipants.parse_groupParticipants($0) } - dict[507405952] = { return Api.ChatInviteImporter.parse_chatInviteImporter($0) } + dict[190633460] = { return Api.ChatInviteImporter.parse_chatInviteImporter($0) } dict[-2066640507] = { return Api.messages.AffectedMessages.parse_affectedMessages($0) } dict[-402498398] = { return Api.messages.SavedGifs.parse_savedGifsNotModified($0) } dict[772213157] = { return Api.messages.SavedGifs.parse_savedGifs($0) } dict[-914167110] = { return Api.CdnPublicKey.parse_cdnPublicKey($0) } - dict[1093204652] = { return Api.MessageReplies.parse_messageReplies($0) } + dict[-2083123262] = { return Api.MessageReplies.parse_messageReplies($0) } dict[53231223] = { return Api.InputGame.parse_inputGameID($0) } dict[-1020139510] = { return Api.InputGame.parse_inputGameShortName($0) } dict[1107543535] = { return Api.help.CountryCode.parse_countryCode($0) } @@ -609,8 +613,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1387279939] = { return Api.MessageInteractionCounters.parse_messageInteractionCounters($0) } dict[-1107852396] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) } dict[-484987010] = { return Api.Updates.parse_updatesTooLong($0) } - dict[-84936653] = { return Api.Updates.parse_updateShortMessage($0) } - dict[290961496] = { return Api.Updates.parse_updateShortChatMessage($0) } + dict[826001400] = { return Api.Updates.parse_updateShortMessage($0) } + dict[1299050149] = { return Api.Updates.parse_updateShortChatMessage($0) } dict[2027216577] = { return Api.Updates.parse_updateShort($0) } dict[1918567619] = { return Api.Updates.parse_updatesCombined($0) } dict[1957577280] = { return Api.Updates.parse_updates($0) } @@ -620,7 +624,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) } dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) } dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) } - dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) } + dict[1882335561] = { return Api.MessageMedia.parse_messageMediaContact($0) } dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) } dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) } dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) } @@ -647,8 +651,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[935395612] = { return Api.ChatPhoto.parse_chatPhotoEmpty($0) } dict[476978193] = { return Api.ChatPhoto.parse_chatPhoto($0) } dict[1869903447] = { return Api.PageCaption.parse_pageCaption($0) } - dict[-1928649707] = { return Api.payments.PaymentForm.parse_paymentForm($0) } - dict[280319440] = { return Api.payments.PaymentReceipt.parse_paymentReceipt($0) } + dict[378828315] = { return Api.payments.PaymentForm.parse_paymentForm($0) } + dict[1891958275] = { return Api.payments.PaymentReceipt.parse_paymentReceipt($0) } dict[863093588] = { return Api.messages.PeerDialogs.parse_peerDialogs($0) } dict[-1831650802] = { return Api.UrlAuthResult.parse_urlAuthResultRequest($0) } dict[-1886646706] = { return Api.UrlAuthResult.parse_urlAuthResultAccepted($0) } @@ -659,15 +663,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[42402760] = { return Api.InputStickerSet.parse_inputStickerSetAnimatedEmoji($0) } dict[-427863538] = { return Api.InputStickerSet.parse_inputStickerSetDice($0) } dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) } - dict[-1729618630] = { return Api.BotInfo.parse_botInfo($0) } + dict[460632885] = { return Api.BotInfo.parse_botInfo($0) } dict[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) } dict[-1519637954] = { return Api.updates.State.parse_state($0) } - dict[537022650] = { return Api.User.parse_userEmpty($0) } - dict[-1820043071] = { return Api.User.parse_user($0) } + dict[-742634630] = { return Api.User.parse_userEmpty($0) } + dict[1073147056] = { return Api.User.parse_user($0) } dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) } - dict[-1125940270] = { return Api.Message.parse_message($0) } + dict[-2049520670] = { return Api.Message.parse_message($0) } dict[721967202] = { return Api.Message.parse_messageService($0) } - dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) } + dict[1398765469] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) } dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) } dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) } dict[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) } @@ -685,8 +689,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[506920429] = { return Api.InputPhoneCall.parse_inputPhoneCall($0) } dict[541839704] = { return Api.phone.ExportedGroupCallInvite.parse_exportedGroupCallInvite($0) } dict[-1551583367] = { return Api.ReceivedNotifyMessage.parse_receivedNotifyMessage($0) } - dict[-57668565] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) } - dict[1061556205] = { return Api.ChatParticipants.parse_chatParticipants($0) } + dict[-2023500831] = { return Api.ChatParticipants.parse_chatParticipantsForbidden($0) } + dict[1018991608] = { return Api.ChatParticipants.parse_chatParticipants($0) } dict[1949890536] = { return Api.DialogFilter.parse_dialogFilter($0) } dict[-1056001329] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsSaved($0) } dict[873977640] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentials($0) } @@ -718,7 +722,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[2010127419] = { return Api.contacts.ImportedContacts.parse_importedContacts($0) } dict[-1678949555] = { return Api.InputWebDocument.parse_inputWebDocument($0) } dict[-326966976] = { return Api.phone.PhoneCall.parse_phoneCall($0) } - dict[995769920] = { return Api.ChannelAdminLogEvent.parse_channelAdminLogEvent($0) } + dict[531458253] = { return Api.ChannelAdminLogEvent.parse_channelAdminLogEvent($0) } dict[-1132882121] = { return Api.Bool.parse_boolFalse($0) } dict[-1720552011] = { return Api.Bool.parse_boolTrue($0) } dict[-892239370] = { return Api.LangPackString.parse_langPackString($0) } @@ -769,7 +773,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) } dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) } dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) } - dict[1847917725] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) } + dict[-1316944408] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) } dict[-1389486888] = { return Api.account.AuthorizationForm.parse_authorizationForm($0) } dict[-1392388579] = { return Api.Authorization.parse_authorization($0) } dict[-1361650766] = { return Api.MaskCoords.parse_maskCoords($0) } @@ -795,7 +799,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1908627474] = { return Api.SecureValueType.parse_secureValueTypeEmail($0) } dict[-732254058] = { return Api.PasswordKdfAlgo.parse_passwordKdfAlgoUnknown($0) } dict[982592842] = { return Api.PasswordKdfAlgo.parse_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow($0) } - dict[-1390001672] = { return Api.account.Password.parse_password($0) } + dict[408623183] = { return Api.account.Password.parse_password($0) } dict[-2000710887] = { return Api.InputBotInlineResult.parse_inputBotInlineResult($0) } dict[-1462213465] = { return Api.InputBotInlineResult.parse_inputBotInlineResultPhoto($0) } dict[-459324] = { return Api.InputBotInlineResult.parse_inputBotInlineResultDocument($0) } @@ -803,23 +807,23 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1352683077] = { return Api.account.PrivacyRules.parse_privacyRules($0) } dict[-123988] = { return Api.PrivacyRule.parse_privacyValueAllowContacts($0) } dict[1698855810] = { return Api.PrivacyRule.parse_privacyValueAllowAll($0) } - dict[1297858060] = { return Api.PrivacyRule.parse_privacyValueAllowUsers($0) } + dict[-1198497870] = { return Api.PrivacyRule.parse_privacyValueAllowUsers($0) } dict[-125240806] = { return Api.PrivacyRule.parse_privacyValueDisallowContacts($0) } dict[-1955338397] = { return Api.PrivacyRule.parse_privacyValueDisallowAll($0) } - dict[209668535] = { return Api.PrivacyRule.parse_privacyValueDisallowUsers($0) } - dict[415136107] = { return Api.PrivacyRule.parse_privacyValueAllowChatParticipants($0) } - dict[-1397881200] = { return Api.PrivacyRule.parse_privacyValueDisallowChatParticipants($0) } + dict[-463335103] = { return Api.PrivacyRule.parse_privacyValueDisallowUsers($0) } + dict[1796427406] = { return Api.PrivacyRule.parse_privacyValueAllowChatParticipants($0) } + dict[1103656293] = { return Api.PrivacyRule.parse_privacyValueDisallowChatParticipants($0) } dict[-1230047312] = { return Api.MessageAction.parse_messageActionEmpty($0) } - dict[-1503425638] = { return Api.MessageAction.parse_messageActionChatCreate($0) } + dict[-1119368275] = { return Api.MessageAction.parse_messageActionChatCreate($0) } dict[-1247687078] = { return Api.MessageAction.parse_messageActionChatEditTitle($0) } dict[2144015272] = { return Api.MessageAction.parse_messageActionChatEditPhoto($0) } dict[-1780220945] = { return Api.MessageAction.parse_messageActionChatDeletePhoto($0) } - dict[1217033015] = { return Api.MessageAction.parse_messageActionChatAddUser($0) } - dict[-1297179892] = { return Api.MessageAction.parse_messageActionChatDeleteUser($0) } - dict[-123931160] = { return Api.MessageAction.parse_messageActionChatJoinedByLink($0) } + dict[365886720] = { return Api.MessageAction.parse_messageActionChatAddUser($0) } + dict[-1539362612] = { return Api.MessageAction.parse_messageActionChatDeleteUser($0) } + dict[51520707] = { return Api.MessageAction.parse_messageActionChatJoinedByLink($0) } dict[-1781355374] = { return Api.MessageAction.parse_messageActionChannelCreate($0) } - dict[1371385889] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) } - dict[-1336546578] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) } + dict[-519864430] = { return Api.MessageAction.parse_messageActionChatMigrateTo($0) } + dict[-365344535] = { return Api.MessageAction.parse_messageActionChannelMigrateFrom($0) } dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) } dict[-1615153660] = { return Api.MessageAction.parse_messageActionHistoryClear($0) } dict[-1834538890] = { return Api.MessageAction.parse_messageActionGameScore($0) } @@ -834,14 +838,14 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-202219658] = { return Api.MessageAction.parse_messageActionContactSignUp($0) } dict[-1730095465] = { return Api.MessageAction.parse_messageActionGeoProximityReached($0) } dict[2047704898] = { return Api.MessageAction.parse_messageActionGroupCall($0) } - dict[1991897370] = { return Api.MessageAction.parse_messageActionInviteToGroupCall($0) } + dict[1345295095] = { return Api.MessageAction.parse_messageActionInviteToGroupCall($0) } dict[-1441072131] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) } dict[-1281329567] = { return Api.MessageAction.parse_messageActionGroupCallScheduled($0) } dict[1399245077] = { return Api.PhoneCall.parse_phoneCallEmpty($0) } - dict[462375633] = { return Api.PhoneCall.parse_phoneCallWaiting($0) } - dict[-2014659757] = { return Api.PhoneCall.parse_phoneCallRequested($0) } - dict[-1719909046] = { return Api.PhoneCall.parse_phoneCallAccepted($0) } - dict[-2025673089] = { return Api.PhoneCall.parse_phoneCall($0) } + dict[-987599081] = { return Api.PhoneCall.parse_phoneCallWaiting($0) } + dict[347139340] = { return Api.PhoneCall.parse_phoneCallRequested($0) } + dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) } + dict[-1770029977] = { return Api.PhoneCall.parse_phoneCall($0) } dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) } dict[-483352705] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdateEmpty($0) } dict[686618977] = { return Api.help.TermsOfServiceUpdate.parse_termsOfServiceUpdate($0) } @@ -880,7 +884,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[681706865] = { return Api.MessageEntity.parse_messageEntityCode($0) } dict[1938967520] = { return Api.MessageEntity.parse_messageEntityPre($0) } dict[1990644519] = { return Api.MessageEntity.parse_messageEntityTextUrl($0) } - dict[892193368] = { return Api.MessageEntity.parse_messageEntityMentionName($0) } + dict[-595914432] = { return Api.MessageEntity.parse_messageEntityMentionName($0) } dict[546203849] = { return Api.MessageEntity.parse_inputMessageEntityMentionName($0) } dict[-1687559349] = { return Api.MessageEntity.parse_messageEntityPhone($0) } dict[1280209983] = { return Api.MessageEntity.parse_messageEntityCashtag($0) } @@ -900,17 +904,17 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1577484359] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) } dict[-1730311882] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) } dict[-1417756512] = { return Api.EncryptedChat.parse_encryptedChatEmpty($0) } - dict[1006044124] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) } - dict[1651608194] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) } - dict[-94974410] = { return Api.EncryptedChat.parse_encryptedChat($0) } + dict[1722964307] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) } + dict[1223809356] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) } + dict[1643173063] = { return Api.EncryptedChat.parse_encryptedChat($0) } dict[505183301] = { return Api.EncryptedChat.parse_encryptedChatDiscarded($0) } dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) } dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) } dict[922273905] = { return Api.Document.parse_documentEmpty($0) } dict[512177195] = { return Api.Document.parse_document($0) } dict[-1707344487] = { return Api.messages.HighScores.parse_highScores($0) } - dict[-892779534] = { return Api.WebAuthorization.parse_webAuthorization($0) } - dict[-805141448] = { return Api.ImportedContact.parse_importedContact($0) } + dict[-1493633966] = { return Api.WebAuthorization.parse_webAuthorization($0) } + dict[-1052885936] = { return Api.ImportedContact.parse_importedContact($0) } dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) } return dict }() @@ -1313,6 +1317,8 @@ public struct Api { _1.serialize(buffer, boxed) case let _1 as Api.messages.StickerSetInstallResult: _1.serialize(buffer, boxed) + case let _1 as Api.account.ResetPasswordResult: + _1.serialize(buffer, boxed) case let _1 as Api.Config: _1.serialize(buffer, boxed) case let _1 as Api.TopPeerCategoryPeers: diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift index 6c382b818b..8f6d629392 100644 --- a/submodules/TelegramApi/Sources/Api2.swift +++ b/submodules/TelegramApi/Sources/Api2.swift @@ -152,17 +152,17 @@ public extension Api { } public enum ChatFull: TypeConstructorDescription { - case chatFull(flags: Int32, id: Int32, about: String, participants: Api.ChatParticipants, chatPhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo]?, pinnedMsgId: Int32?, folderId: Int32?, call: Api.InputGroupCall?, ttlPeriod: Int32?, groupcallDefaultJoinAs: Api.Peer?) - case channelFull(flags: Int32, id: Int32, about: String, participantsCount: Int32?, adminsCount: Int32?, kickedCount: Int32?, bannedCount: Int32?, onlineCount: Int32?, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo], migratedFromChatId: Int32?, migratedFromMaxId: Int32?, pinnedMsgId: Int32?, stickerset: Api.StickerSet?, availableMinId: Int32?, folderId: Int32?, linkedChatId: Int32?, location: Api.ChannelLocation?, slowmodeSeconds: Int32?, slowmodeNextSendDate: Int32?, statsDc: Int32?, pts: Int32, call: Api.InputGroupCall?, ttlPeriod: Int32?, pendingSuggestions: [String]?, groupcallDefaultJoinAs: Api.Peer?) + case chatFull(flags: Int32, id: Int64, about: String, participants: Api.ChatParticipants, chatPhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo]?, pinnedMsgId: Int32?, folderId: Int32?, call: Api.InputGroupCall?, ttlPeriod: Int32?, groupcallDefaultJoinAs: Api.Peer?) + case channelFull(flags: Int32, id: Int64, about: String, participantsCount: Int32?, adminsCount: Int32?, kickedCount: Int32?, bannedCount: Int32?, onlineCount: Int32?, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, chatPhoto: Api.Photo, notifySettings: Api.PeerNotifySettings, exportedInvite: Api.ExportedChatInvite?, botInfo: [Api.BotInfo], migratedFromChatId: Int64?, migratedFromMaxId: Int32?, pinnedMsgId: Int32?, stickerset: Api.StickerSet?, availableMinId: Int32?, folderId: Int32?, linkedChatId: Int32?, location: Api.ChannelLocation?, slowmodeSeconds: Int32?, slowmodeNextSendDate: Int32?, statsDc: Int32?, pts: Int32, call: Api.InputGroupCall?, ttlPeriod: Int32?, pendingSuggestions: [String]?, groupcallDefaultJoinAs: Api.Peer?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatFull(let flags, let id, let about, let participants, let chatPhoto, let notifySettings, let exportedInvite, let botInfo, let pinnedMsgId, let folderId, let call, let ttlPeriod, let groupcallDefaultJoinAs): if boxed { - buffer.appendInt32(-1977734781) + buffer.appendInt32(1509543498) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(about, buffer: buffer, boxed: false) participants.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {chatPhoto!.serialize(buffer, true)} @@ -181,10 +181,10 @@ public extension Api { break case .channelFull(let flags, let id, let about, let participantsCount, let adminsCount, let kickedCount, let bannedCount, let onlineCount, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chatPhoto, let notifySettings, let exportedInvite, let botInfo, let migratedFromChatId, let migratedFromMaxId, let pinnedMsgId, let stickerset, let availableMinId, let folderId, let linkedChatId, let location, let slowmodeSeconds, let slowmodeNextSendDate, let statsDc, let pts, let call, let ttlPeriod, let pendingSuggestions, let groupcallDefaultJoinAs): if boxed { - buffer.appendInt32(1418477459) + buffer.appendInt32(-1625164883) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(about, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(participantsCount!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeInt32(adminsCount!, buffer: buffer, boxed: false)} @@ -202,7 +202,7 @@ public extension Api { for item in botInfo { item.serialize(buffer, true) } - if Int(flags) & Int(1 << 4) != 0 {serializeInt32(migratedFromChatId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 4) != 0 {serializeInt64(migratedFromChatId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 4) != 0 {serializeInt32(migratedFromMaxId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 5) != 0 {serializeInt32(pinnedMsgId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 8) != 0 {stickerset!.serialize(buffer, true)} @@ -238,8 +238,8 @@ public extension Api { public static func parse_chatFull(_ reader: BufferReader) -> ChatFull? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Api.ChatParticipants? @@ -299,8 +299,8 @@ public extension Api { public static func parse_channelFull(_ reader: BufferReader) -> ChatFull? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Int32? @@ -335,8 +335,8 @@ public extension Api { if let _ = reader.readInt32() { _15 = Api.parseVector(reader, elementSignature: 0, elementType: Api.BotInfo.self) } - var _16: Int32? - if Int(_1!) & Int(1 << 4) != 0 {_16 = reader.readInt32() } + var _16: Int64? + if Int(_1!) & Int(1 << 4) != 0 {_16 = reader.readInt64() } var _17: Int32? if Int(_1!) & Int(1 << 4) != 0 {_17 = reader.readInt32() } var _18: Int32? @@ -418,13 +418,13 @@ public extension Api { } public enum PollResults: TypeConstructorDescription { - case pollResults(flags: Int32, results: [Api.PollAnswerVoters]?, totalVoters: Int32?, recentVoters: [Int32]?, solution: String?, solutionEntities: [Api.MessageEntity]?) + case pollResults(flags: Int32, results: [Api.PollAnswerVoters]?, totalVoters: Int32?, recentVoters: [Int64]?, solution: String?, solutionEntities: [Api.MessageEntity]?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .pollResults(let flags, let results, let totalVoters, let recentVoters, let solution, let solutionEntities): if boxed { - buffer.appendInt32(-1159937629) + buffer.appendInt32(-591909213) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261) @@ -436,7 +436,7 @@ public extension Api { if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(recentVoters!.count)) for item in recentVoters! { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) }} if Int(flags) & Int(1 << 4) != 0 {serializeString(solution!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261) @@ -464,9 +464,9 @@ public extension Api { } } var _3: Int32? if Int(_1!) & Int(1 << 2) != 0 {_3 = reader.readInt32() } - var _4: [Int32]? + var _4: [Int64]? if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _4 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } } var _5: String? if Int(_1!) & Int(1 << 4) != 0 {_5 = parseString(reader) } @@ -490,32 +490,32 @@ public extension Api { } public enum ChatParticipant: TypeConstructorDescription { - case chatParticipant(userId: Int32, inviterId: Int32, date: Int32) - case chatParticipantCreator(userId: Int32) - case chatParticipantAdmin(userId: Int32, inviterId: Int32, date: Int32) + case chatParticipant(userId: Int64, inviterId: Int64, date: Int32) + case chatParticipantCreator(userId: Int64) + case chatParticipantAdmin(userId: Int64, inviterId: Int64, date: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatParticipant(let userId, let inviterId, let date): if boxed { - buffer.appendInt32(-925415106) + buffer.appendInt32(-1070776313) } - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .chatParticipantCreator(let userId): if boxed { - buffer.appendInt32(-636267638) + buffer.appendInt32(-462696732) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .chatParticipantAdmin(let userId, let inviterId, let date): if boxed { - buffer.appendInt32(-489233354) + buffer.appendInt32(-1600962725) } - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break } @@ -533,10 +533,10 @@ public extension Api { } public static func parse_chatParticipant(_ reader: BufferReader) -> ChatParticipant? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -550,8 +550,8 @@ public extension Api { } } public static func parse_chatParticipantCreator(_ reader: BufferReader) -> ChatParticipant? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.ChatParticipant.chatParticipantCreator(userId: _1!) @@ -561,10 +561,10 @@ public extension Api { } } public static func parse_chatParticipantAdmin(_ reader: BufferReader) -> ChatParticipant? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -1736,26 +1736,26 @@ public extension Api { } public enum Chat: TypeConstructorDescription { - case chatEmpty(id: Int32) - case chat(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?) - case chatForbidden(id: Int32, title: String) - case channel(flags: Int32, id: Int32, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, version: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?) - case channelForbidden(flags: Int32, id: Int32, accessHash: Int64, title: String, untilDate: Int32?) + case chatEmpty(id: Int64) + case chat(flags: Int32, id: Int64, title: String, photo: Api.ChatPhoto, participantsCount: Int32, date: Int32, version: Int32, migratedTo: Api.InputChannel?, adminRights: Api.ChatAdminRights?, defaultBannedRights: Api.ChatBannedRights?) + case chatForbidden(id: Int64, title: String) + case channel(flags: Int32, id: Int64, accessHash: Int64?, title: String, username: String?, photo: Api.ChatPhoto, date: Int32, version: Int32, restrictionReason: [Api.RestrictionReason]?, adminRights: Api.ChatAdminRights?, bannedRights: Api.ChatBannedRights?, defaultBannedRights: Api.ChatBannedRights?, participantsCount: Int32?) + case channelForbidden(flags: Int32, id: Int64, accessHash: Int64, title: String, untilDate: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatEmpty(let id): if boxed { - buffer.appendInt32(-1683826688) + buffer.appendInt32(693512293) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) break case .chat(let flags, let id, let title, let photo, let participantsCount, let date, let version, let migratedTo, let adminRights, let defaultBannedRights): if boxed { - buffer.appendInt32(1004149726) + buffer.appendInt32(1103884886) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) photo.serialize(buffer, true) serializeInt32(participantsCount, buffer: buffer, boxed: false) @@ -1767,17 +1767,17 @@ public extension Api { break case .chatForbidden(let id, let title): if boxed { - buffer.appendInt32(120753115) + buffer.appendInt32(1704108455) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) break case .channel(let flags, let id, let accessHash, let title, let username, let photo, let date, let version, let restrictionReason, let adminRights, let bannedRights, let defaultBannedRights, let participantsCount): if boxed { - buffer.appendInt32(-753232354) + buffer.appendInt32(1106612516) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 13) != 0 {serializeInt64(accessHash!, buffer: buffer, boxed: false)} serializeString(title, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 6) != 0 {serializeString(username!, buffer: buffer, boxed: false)} @@ -1796,10 +1796,10 @@ public extension Api { break case .channelForbidden(let flags, let id, let accessHash, let title, let untilDate): if boxed { - buffer.appendInt32(681420594) + buffer.appendInt32(399807445) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 16) != 0 {serializeInt32(untilDate!, buffer: buffer, boxed: false)} @@ -1823,8 +1823,8 @@ public extension Api { } public static func parse_chatEmpty(_ reader: BufferReader) -> Chat? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Chat.chatEmpty(id: _1!) @@ -1836,8 +1836,8 @@ public extension Api { public static func parse_chat(_ reader: BufferReader) -> Chat? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Api.ChatPhoto? @@ -1880,8 +1880,8 @@ public extension Api { } } public static func parse_chatForbidden(_ reader: BufferReader) -> Chat? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) let _c1 = _1 != nil @@ -1896,8 +1896,8 @@ public extension Api { public static func parse_channel(_ reader: BufferReader) -> Chat? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int64? if Int(_1!) & Int(1 << 13) != 0 {_3 = reader.readInt64() } var _4: String? @@ -1953,8 +1953,8 @@ public extension Api { public static func parse_channelForbidden(_ reader: BufferReader) -> Chat? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int64? _3 = reader.readInt64() var _4: String? @@ -2315,8 +2315,8 @@ public extension Api { } public enum RecentMeUrl: TypeConstructorDescription { case recentMeUrlUnknown(url: String) - case recentMeUrlUser(url: String, userId: Int32) - case recentMeUrlChat(url: String, chatId: Int32) + case recentMeUrlUser(url: String, userId: Int64) + case recentMeUrlChat(url: String, chatId: Int64) case recentMeUrlChatInvite(url: String, chatInvite: Api.ChatInvite) case recentMeUrlStickerSet(url: String, set: Api.StickerSetCovered) @@ -2330,17 +2330,17 @@ public extension Api { break case .recentMeUrlUser(let url, let userId): if boxed { - buffer.appendInt32(-1917045962) + buffer.appendInt32(-1188296222) } serializeString(url, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .recentMeUrlChat(let url, let chatId): if boxed { - buffer.appendInt32(-1608834311) + buffer.appendInt32(-1294306862) } serializeString(url, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .recentMeUrlChatInvite(let url, let chatInvite): if boxed { @@ -2388,8 +2388,8 @@ public extension Api { public static func parse_recentMeUrlUser(_ reader: BufferReader) -> RecentMeUrl? { var _1: String? _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -2402,8 +2402,8 @@ public extension Api { public static func parse_recentMeUrlChat(_ reader: BufferReader) -> RecentMeUrl? { var _1: String? _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -2959,8 +2959,8 @@ public extension Api { } public enum InputChannel: TypeConstructorDescription { case inputChannelEmpty - case inputChannel(channelId: Int32, accessHash: Int64) - case inputChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int32) + case inputChannel(channelId: Int64, accessHash: Int64) + case inputChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -2972,18 +2972,18 @@ public extension Api { break case .inputChannel(let channelId, let accessHash): if boxed { - buffer.appendInt32(-1343524562) + buffer.appendInt32(-212145112) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputChannelFromMessage(let peer, let msgId, let channelId): if boxed { - buffer.appendInt32(707290417) + buffer.appendInt32(1536380829) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break } } @@ -3003,8 +3003,8 @@ public extension Api { return Api.InputChannel.inputChannelEmpty } public static func parse_inputChannel(_ reader: BufferReader) -> InputChannel? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -3023,8 +3023,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -3394,15 +3394,15 @@ public extension Api { } public enum StatsGroupTopAdmin: TypeConstructorDescription { - case statsGroupTopAdmin(userId: Int32, deleted: Int32, kicked: Int32, banned: Int32) + case statsGroupTopAdmin(userId: Int64, deleted: Int32, kicked: Int32, banned: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .statsGroupTopAdmin(let userId, let deleted, let kicked, let banned): if boxed { - buffer.appendInt32(1611985938) + buffer.appendInt32(-682079097) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(deleted, buffer: buffer, boxed: false) serializeInt32(kicked, buffer: buffer, boxed: false) serializeInt32(banned, buffer: buffer, boxed: false) @@ -3418,8 +3418,8 @@ public extension Api { } public static func parse_statsGroupTopAdmin(_ reader: BufferReader) -> StatsGroupTopAdmin? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -3838,29 +3838,29 @@ public extension Api { } public enum Peer: TypeConstructorDescription { - case peerUser(userId: Int32) - case peerChat(chatId: Int32) - case peerChannel(channelId: Int32) + case peerUser(userId: Int64) + case peerChat(chatId: Int64) + case peerChannel(channelId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .peerUser(let userId): if boxed { - buffer.appendInt32(-1649296275) + buffer.appendInt32(1498486562) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .peerChat(let chatId): if boxed { - buffer.appendInt32(-1160714821) + buffer.appendInt32(918946202) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .peerChannel(let channelId): if boxed { - buffer.appendInt32(-1109531342) + buffer.appendInt32(-1566230754) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break } } @@ -3877,8 +3877,8 @@ public extension Api { } public static func parse_peerUser(_ reader: BufferReader) -> Peer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Peer.peerUser(userId: _1!) @@ -3888,8 +3888,8 @@ public extension Api { } } public static func parse_peerChat(_ reader: BufferReader) -> Peer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Peer.peerChat(chatId: _1!) @@ -3899,8 +3899,8 @@ public extension Api { } } public static func parse_peerChannel(_ reader: BufferReader) -> Peer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Peer.peerChannel(channelId: _1!) @@ -4601,64 +4601,64 @@ public extension Api { case updateNewMessage(message: Api.Message, pts: Int32, ptsCount: Int32) case updateMessageID(id: Int32, randomId: Int64) case updateDeleteMessages(messages: [Int32], pts: Int32, ptsCount: Int32) - case updateUserTyping(userId: Int32, action: Api.SendMessageAction) - case updateChatUserTyping(chatId: Int32, fromId: Api.Peer, action: Api.SendMessageAction) + case updateUserTyping(userId: Int64, action: Api.SendMessageAction) + case updateChatUserTyping(chatId: Int64, fromId: Api.Peer, action: Api.SendMessageAction) case updateChatParticipants(participants: Api.ChatParticipants) - case updateUserStatus(userId: Int32, status: Api.UserStatus) - case updateUserName(userId: Int32, firstName: String, lastName: String, username: String) - case updateUserPhoto(userId: Int32, date: Int32, photo: Api.UserProfilePhoto, previous: Api.Bool) + case updateUserStatus(userId: Int64, status: Api.UserStatus) + case updateUserName(userId: Int64, firstName: String, lastName: String, username: String) + case updateUserPhoto(userId: Int64, date: Int32, photo: Api.UserProfilePhoto, previous: Api.Bool) case updateNewEncryptedMessage(message: Api.EncryptedMessage, qts: Int32) - case updateEncryptedChatTyping(chatId: Int32) + case updateEncryptedChatTyping(chatId: Int64) case updateEncryption(chat: Api.EncryptedChat, date: Int32) - case updateEncryptedMessagesRead(chatId: Int32, maxDate: Int32, date: Int32) - case updateChatParticipantAdd(chatId: Int32, userId: Int32, inviterId: Int32, date: Int32, version: Int32) - case updateChatParticipantDelete(chatId: Int32, userId: Int32, version: Int32) + case updateEncryptedMessagesRead(chatId: Int64, maxDate: Int32, date: Int32) + case updateChatParticipantAdd(chatId: Int64, userId: Int64, inviterId: Int64, date: Int32, version: Int32) + case updateChatParticipantDelete(chatId: Int64, userId: Int64, version: Int32) case updateDcOptions(dcOptions: [Api.DcOption]) case updateNotifySettings(peer: Api.NotifyPeer, notifySettings: Api.PeerNotifySettings) case updateServiceNotification(flags: Int32, inboxDate: Int32?, type: String, message: String, media: Api.MessageMedia, entities: [Api.MessageEntity]) case updatePrivacy(key: Api.PrivacyKey, rules: [Api.PrivacyRule]) - case updateUserPhone(userId: Int32, phone: String) + case updateUserPhone(userId: Int64, phone: String) case updateReadHistoryInbox(flags: Int32, folderId: Int32?, peer: Api.Peer, maxId: Int32, stillUnreadCount: Int32, pts: Int32, ptsCount: Int32) case updateReadHistoryOutbox(peer: Api.Peer, maxId: Int32, pts: Int32, ptsCount: Int32) case updateWebPage(webpage: Api.WebPage, pts: Int32, ptsCount: Int32) case updateReadMessagesContents(messages: [Int32], pts: Int32, ptsCount: Int32) - case updateChannelTooLong(flags: Int32, channelId: Int32, pts: Int32?) - case updateChannel(channelId: Int32) + case updateChannelTooLong(flags: Int32, channelId: Int64, pts: Int32?) + case updateChannel(channelId: Int64) case updateNewChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32) - case updateReadChannelInbox(flags: Int32, folderId: Int32?, channelId: Int32, maxId: Int32, stillUnreadCount: Int32, pts: Int32) - case updateDeleteChannelMessages(channelId: Int32, messages: [Int32], pts: Int32, ptsCount: Int32) - case updateChannelMessageViews(channelId: Int32, id: Int32, views: Int32) - case updateChatParticipantAdmin(chatId: Int32, userId: Int32, isAdmin: Api.Bool, version: Int32) + case updateReadChannelInbox(flags: Int32, folderId: Int32?, channelId: Int64, maxId: Int32, stillUnreadCount: Int32, pts: Int32) + case updateDeleteChannelMessages(channelId: Int64, messages: [Int32], pts: Int32, ptsCount: Int32) + case updateChannelMessageViews(channelId: Int64, id: Int32, views: Int32) + case updateChatParticipantAdmin(chatId: Int64, userId: Int64, isAdmin: Api.Bool, version: Int32) case updateNewStickerSet(stickerset: Api.messages.StickerSet) case updateStickerSetsOrder(flags: Int32, order: [Int64]) case updateStickerSets case updateSavedGifs - case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int32, query: String, geo: Api.GeoPoint?, peerType: Api.InlineQueryPeerType?, offset: String) - case updateBotInlineSend(flags: Int32, userId: Int32, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?) + case updateBotInlineQuery(flags: Int32, queryId: Int64, userId: Int64, query: String, geo: Api.GeoPoint?, peerType: Api.InlineQueryPeerType?, offset: String) + case updateBotInlineSend(flags: Int32, userId: Int64, query: String, geo: Api.GeoPoint?, id: String, msgId: Api.InputBotInlineMessageID?) case updateEditChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32) - case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?) + case updateBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int64, peer: Api.Peer, msgId: Int32, chatInstance: Int64, data: Buffer?, gameShortName: String?) case updateEditMessage(message: Api.Message, pts: Int32, ptsCount: Int32) - case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int32, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?) - case updateReadChannelOutbox(channelId: Int32, maxId: Int32) + case updateInlineBotCallbackQuery(flags: Int32, queryId: Int64, userId: Int64, msgId: Api.InputBotInlineMessageID, chatInstance: Int64, data: Buffer?, gameShortName: String?) + case updateReadChannelOutbox(channelId: Int64, maxId: Int32) case updateDraftMessage(peer: Api.Peer, draft: Api.DraftMessage) case updateReadFeaturedStickers case updateRecentStickers case updateConfig case updatePtsChanged - case updateChannelWebPage(channelId: Int32, webpage: Api.WebPage, pts: Int32, ptsCount: Int32) + case updateChannelWebPage(channelId: Int64, webpage: Api.WebPage, pts: Int32, ptsCount: Int32) case updateDialogPinned(flags: Int32, folderId: Int32?, peer: Api.DialogPeer) case updatePinnedDialogs(flags: Int32, folderId: Int32?, order: [Api.DialogPeer]?) case updateBotWebhookJSON(data: Api.DataJSON) case updateBotWebhookJSONQuery(queryId: Int64, data: Api.DataJSON, timeout: Int32) - case updateBotShippingQuery(queryId: Int64, userId: Int32, payload: Buffer, shippingAddress: Api.PostAddress) - case updateBotPrecheckoutQuery(flags: Int32, queryId: Int64, userId: Int32, payload: Buffer, info: Api.PaymentRequestedInfo?, shippingOptionId: String?, currency: String, totalAmount: Int64) + case updateBotShippingQuery(queryId: Int64, userId: Int64, payload: Buffer, shippingAddress: Api.PostAddress) + case updateBotPrecheckoutQuery(flags: Int32, queryId: Int64, userId: Int64, payload: Buffer, info: Api.PaymentRequestedInfo?, shippingOptionId: String?, currency: String, totalAmount: Int64) case updatePhoneCall(phoneCall: Api.PhoneCall) case updateLangPackTooLong(langCode: String) case updateLangPack(difference: Api.LangPackDifference) case updateFavedStickers - case updateChannelReadMessagesContents(channelId: Int32, messages: [Int32]) + case updateChannelReadMessagesContents(channelId: Int64, messages: [Int32]) case updateContactsReset - case updateChannelAvailableMessages(channelId: Int32, availableMinId: Int32) + case updateChannelAvailableMessages(channelId: Int64, availableMinId: Int32) case updateDialogUnreadMark(flags: Int32, peer: Api.DialogPeer) case updateMessagePoll(flags: Int32, pollId: Int64, poll: Api.Poll?, results: Api.PollResults) case updateChatDefaultBannedRights(peer: Api.Peer, defaultBannedRights: Api.ChatBannedRights, version: Int32) @@ -4670,26 +4670,27 @@ public extension Api { case updateTheme(theme: Api.Theme) case updateGeoLiveViewed(peer: Api.Peer, msgId: Int32) case updateLoginToken - case updateMessagePollVote(pollId: Int64, userId: Int32, options: [Buffer], qts: Int32) + case updateMessagePollVote(pollId: Int64, userId: Int64, options: [Buffer]) case updateDialogFilter(flags: Int32, id: Int32, filter: Api.DialogFilter?) case updateDialogFilterOrder(order: [Int32]) case updateDialogFilters case updatePhoneCallSignalingData(phoneCallId: Int64, data: Buffer) - case updateChannelMessageForwards(channelId: Int32, id: Int32, forwards: Int32) - case updateReadChannelDiscussionInbox(flags: Int32, channelId: Int32, topMsgId: Int32, readMaxId: Int32, broadcastId: Int32?, broadcastPost: Int32?) - case updateReadChannelDiscussionOutbox(channelId: Int32, topMsgId: Int32, readMaxId: Int32) + case updateChannelMessageForwards(channelId: Int64, id: Int32, forwards: Int32) + case updateReadChannelDiscussionInbox(flags: Int32, channelId: Int64, topMsgId: Int32, readMaxId: Int32, broadcastId: Int64?, broadcastPost: Int32?) + case updateReadChannelDiscussionOutbox(channelId: Int64, topMsgId: Int32, readMaxId: Int32) case updatePeerBlocked(peerId: Api.Peer, blocked: Api.Bool) - case updateChannelUserTyping(flags: Int32, channelId: Int32, topMsgId: Int32?, fromId: Api.Peer, action: Api.SendMessageAction) + case updateChannelUserTyping(flags: Int32, channelId: Int64, topMsgId: Int32?, fromId: Api.Peer, action: Api.SendMessageAction) case updatePinnedMessages(flags: Int32, peer: Api.Peer, messages: [Int32], pts: Int32, ptsCount: Int32) - case updatePinnedChannelMessages(flags: Int32, channelId: Int32, messages: [Int32], pts: Int32, ptsCount: Int32) - case updateChat(chatId: Int32) + case updatePinnedChannelMessages(flags: Int32, channelId: Int64, messages: [Int32], pts: Int32, ptsCount: Int32) + case updateChat(chatId: Int64) case updateGroupCallParticipants(call: Api.InputGroupCall, participants: [Api.GroupCallParticipant], version: Int32) - case updateGroupCall(chatId: Int32, call: Api.GroupCall) + case updateGroupCall(chatId: Int64, call: Api.GroupCall) case updatePeerHistoryTTL(flags: Int32, peer: Api.Peer, ttlPeriod: Int32?) - case updateChatParticipant(flags: Int32, chatId: Int32, date: Int32, actorId: Int32, userId: Int32, prevParticipant: Api.ChatParticipant?, newParticipant: Api.ChatParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) - case updateChannelParticipant(flags: Int32, channelId: Int32, date: Int32, actorId: Int32, userId: Int32, prevParticipant: Api.ChannelParticipant?, newParticipant: Api.ChannelParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) - case updateBotStopped(userId: Int32, date: Int32, stopped: Api.Bool, qts: Int32) + case updateChatParticipant(flags: Int32, chatId: Int64, date: Int32, actorId: Int64, userId: Int64, prevParticipant: Api.ChatParticipant?, newParticipant: Api.ChatParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) + case updateChannelParticipant(flags: Int32, channelId: Int64, date: Int32, actorId: Int64, userId: Int64, prevParticipant: Api.ChannelParticipant?, newParticipant: Api.ChannelParticipant?, invite: Api.ExportedChatInvite?, qts: Int32) + case updateBotStopped(userId: Int64, date: Int32, stopped: Api.Bool, qts: Int32) case updateGroupCallConnection(flags: Int32, params: Api.DataJSON) + case updateBotCommands(peer: Api.Peer, botId: Int64, commands: [Api.BotCommand]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -4722,16 +4723,16 @@ public extension Api { break case .updateUserTyping(let userId, let action): if boxed { - buffer.appendInt32(1548249383) + buffer.appendInt32(-1071741569) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) action.serialize(buffer, true) break case .updateChatUserTyping(let chatId, let fromId, let action): if boxed { - buffer.appendInt32(-2033525908) + buffer.appendInt32(-2092401936) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) fromId.serialize(buffer, true) action.serialize(buffer, true) break @@ -4743,25 +4744,25 @@ public extension Api { break case .updateUserStatus(let userId, let status): if boxed { - buffer.appendInt32(469489699) + buffer.appendInt32(-440534818) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) status.serialize(buffer, true) break case .updateUserName(let userId, let firstName, let lastName, let username): if boxed { - buffer.appendInt32(-1489818765) + buffer.appendInt32(-1007549728) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(firstName, buffer: buffer, boxed: false) serializeString(lastName, buffer: buffer, boxed: false) serializeString(username, buffer: buffer, boxed: false) break case .updateUserPhoto(let userId, let date, let photo, let previous): if boxed { - buffer.appendInt32(-1791935732) + buffer.appendInt32(-232290676) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) photo.serialize(buffer, true) previous.serialize(buffer, true) @@ -4775,9 +4776,9 @@ public extension Api { break case .updateEncryptedChatTyping(let chatId): if boxed { - buffer.appendInt32(386986326) + buffer.appendInt32(1677363374) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .updateEncryption(let chat, let date): if boxed { @@ -4788,28 +4789,28 @@ public extension Api { break case .updateEncryptedMessagesRead(let chatId, let maxDate, let date): if boxed { - buffer.appendInt32(956179895) + buffer.appendInt32(122695484) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeInt32(maxDate, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .updateChatParticipantAdd(let chatId, let userId, let inviterId, let date, let version): if boxed { - buffer.appendInt32(-364179876) + buffer.appendInt32(1037718609) } - serializeInt32(chatId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) serializeInt32(version, buffer: buffer, boxed: false) break case .updateChatParticipantDelete(let chatId, let userId, let version): if boxed { - buffer.appendInt32(1851755554) + buffer.appendInt32(-483443337) } - serializeInt32(chatId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(version, buffer: buffer, boxed: false) break case .updateDcOptions(let dcOptions): @@ -4857,9 +4858,9 @@ public extension Api { break case .updateUserPhone(let userId, let phone): if boxed { - buffer.appendInt32(314130811) + buffer.appendInt32(88680979) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(phone, buffer: buffer, boxed: false) break case .updateReadHistoryInbox(let flags, let folderId, let peer, let maxId, let stillUnreadCount, let pts, let ptsCount): @@ -4905,17 +4906,17 @@ public extension Api { break case .updateChannelTooLong(let flags, let channelId, let pts): if boxed { - buffer.appendInt32(-352032773) + buffer.appendInt32(277713951) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(pts!, buffer: buffer, boxed: false)} break case .updateChannel(let channelId): if boxed { - buffer.appendInt32(-1227598250) + buffer.appendInt32(1666927625) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break case .updateNewChannelMessage(let message, let pts, let ptsCount): if boxed { @@ -4927,20 +4928,20 @@ public extension Api { break case .updateReadChannelInbox(let flags, let folderId, let channelId, let maxId, let stillUnreadCount, let pts): if boxed { - buffer.appendInt32(856380452) + buffer.appendInt32(-1842450928) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)} - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(stillUnreadCount, buffer: buffer, boxed: false) serializeInt32(pts, buffer: buffer, boxed: false) break case .updateDeleteChannelMessages(let channelId, let messages, let pts, let ptsCount): if boxed { - buffer.appendInt32(-1015733815) + buffer.appendInt32(-1020437742) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(messages.count)) for item in messages { @@ -4951,18 +4952,18 @@ public extension Api { break case .updateChannelMessageViews(let channelId, let id, let views): if boxed { - buffer.appendInt32(-1734268085) + buffer.appendInt32(-232346616) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(views, buffer: buffer, boxed: false) break case .updateChatParticipantAdmin(let chatId, let userId, let isAdmin, let version): if boxed { - buffer.appendInt32(-1232070311) + buffer.appendInt32(-674602590) } - serializeInt32(chatId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) isAdmin.serialize(buffer, true) serializeInt32(version, buffer: buffer, boxed: false) break @@ -4997,11 +4998,11 @@ public extension Api { break case .updateBotInlineQuery(let flags, let queryId, let userId, let query, let geo, let peerType, let offset): if boxed { - buffer.appendInt32(1059076315) + buffer.appendInt32(1232025500) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(query, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {geo!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {peerType!.serialize(buffer, true)} @@ -5009,10 +5010,10 @@ public extension Api { break case .updateBotInlineSend(let flags, let userId, let query, let geo, let id, let msgId): if boxed { - buffer.appendInt32(239663460) + buffer.appendInt32(317794823) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(query, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {geo!.serialize(buffer, true)} serializeString(id, buffer: buffer, boxed: false) @@ -5028,11 +5029,11 @@ public extension Api { break case .updateBotCallbackQuery(let flags, let queryId, let userId, let peer, let msgId, let chatInstance, let data, let gameShortName): if boxed { - buffer.appendInt32(-415938591) + buffer.appendInt32(-1177566067) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) serializeInt64(chatInstance, buffer: buffer, boxed: false) @@ -5049,11 +5050,11 @@ public extension Api { break case .updateInlineBotCallbackQuery(let flags, let queryId, let userId, let msgId, let chatInstance, let data, let gameShortName): if boxed { - buffer.appendInt32(-103646630) + buffer.appendInt32(1763610706) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) msgId.serialize(buffer, true) serializeInt64(chatInstance, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeBytes(data!, buffer: buffer, boxed: false)} @@ -5061,9 +5062,9 @@ public extension Api { break case .updateReadChannelOutbox(let channelId, let maxId): if boxed { - buffer.appendInt32(634833351) + buffer.appendInt32(-1218471511) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) break case .updateDraftMessage(let peer, let draft): @@ -5099,9 +5100,9 @@ public extension Api { break case .updateChannelWebPage(let channelId, let webpage, let pts, let ptsCount): if boxed { - buffer.appendInt32(1081547008) + buffer.appendInt32(791390623) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) webpage.serialize(buffer, true) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) @@ -5142,20 +5143,20 @@ public extension Api { break case .updateBotShippingQuery(let queryId, let userId, let payload, let shippingAddress): if boxed { - buffer.appendInt32(-523384512) + buffer.appendInt32(-1246823043) } serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeBytes(payload, buffer: buffer, boxed: false) shippingAddress.serialize(buffer, true) break case .updateBotPrecheckoutQuery(let flags, let queryId, let userId, let payload, let info, let shippingOptionId, let currency, let totalAmount): if boxed { - buffer.appendInt32(1563376297) + buffer.appendInt32(-1934976362) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeBytes(payload, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {info!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {serializeString(shippingOptionId!, buffer: buffer, boxed: false)} @@ -5188,9 +5189,9 @@ public extension Api { break case .updateChannelReadMessagesContents(let channelId, let messages): if boxed { - buffer.appendInt32(-1987495099) + buffer.appendInt32(1153291573) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(messages.count)) for item in messages { @@ -5205,9 +5206,9 @@ public extension Api { break case .updateChannelAvailableMessages(let channelId, let availableMinId): if boxed { - buffer.appendInt32(1893427255) + buffer.appendInt32(-1304443240) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(availableMinId, buffer: buffer, boxed: false) break case .updateDialogUnreadMark(let flags, let peer): @@ -5299,18 +5300,17 @@ public extension Api { } break - case .updateMessagePollVote(let pollId, let userId, let options, let qts): + case .updateMessagePollVote(let pollId, let userId, let options): if boxed { - buffer.appendInt32(938909451) + buffer.appendInt32(1421152257) } serializeInt64(pollId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(options.count)) for item in options { serializeBytes(item, buffer: buffer, boxed: false) } - serializeInt32(qts, buffer: buffer, boxed: false) break case .updateDialogFilter(let flags, let id, let filter): if boxed { @@ -5345,28 +5345,28 @@ public extension Api { break case .updateChannelMessageForwards(let channelId, let id, let forwards): if boxed { - buffer.appendInt32(1854571743) + buffer.appendInt32(-761649164) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(forwards, buffer: buffer, boxed: false) break case .updateReadChannelDiscussionInbox(let flags, let channelId, let topMsgId, let readMaxId, let broadcastId, let broadcastPost): if boxed { - buffer.appendInt32(482860628) + buffer.appendInt32(-693004986) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(topMsgId, buffer: buffer, boxed: false) serializeInt32(readMaxId, buffer: buffer, boxed: false) - if Int(flags) & Int(1 << 0) != 0 {serializeInt32(broadcastId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 0) != 0 {serializeInt64(broadcastId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 0) != 0 {serializeInt32(broadcastPost!, buffer: buffer, boxed: false)} break case .updateReadChannelDiscussionOutbox(let channelId, let topMsgId, let readMaxId): if boxed { - buffer.appendInt32(1178116716) + buffer.appendInt32(1767677564) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(topMsgId, buffer: buffer, boxed: false) serializeInt32(readMaxId, buffer: buffer, boxed: false) break @@ -5379,10 +5379,10 @@ public extension Api { break case .updateChannelUserTyping(let flags, let channelId, let topMsgId, let fromId, let action): if boxed { - buffer.appendInt32(1796675352) + buffer.appendInt32(-1937192669) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)} fromId.serialize(buffer, true) action.serialize(buffer, true) @@ -5403,10 +5403,10 @@ public extension Api { break case .updatePinnedChannelMessages(let flags, let channelId, let messages, let pts, let ptsCount): if boxed { - buffer.appendInt32(-2054649973) + buffer.appendInt32(1538885128) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(messages.count)) for item in messages { @@ -5417,9 +5417,9 @@ public extension Api { break case .updateChat(let chatId): if boxed { - buffer.appendInt32(321954198) + buffer.appendInt32(-124097970) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .updateGroupCallParticipants(let call, let participants, let version): if boxed { @@ -5435,9 +5435,9 @@ public extension Api { break case .updateGroupCall(let chatId, let call): if boxed { - buffer.appendInt32(-1537295973) + buffer.appendInt32(347227392) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) call.serialize(buffer, true) break case .updatePeerHistoryTTL(let flags, let peer, let ttlPeriod): @@ -5450,13 +5450,13 @@ public extension Api { break case .updateChatParticipant(let flags, let chatId, let date, let actorId, let userId, let prevParticipant, let newParticipant, let invite, let qts): if boxed { - buffer.appendInt32(-206342113) + buffer.appendInt32(-796432838) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(actorId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(actorId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {prevParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {newParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {invite!.serialize(buffer, true)} @@ -5464,13 +5464,13 @@ public extension Api { break case .updateChannelParticipant(let flags, let channelId, let date, let actorId, let userId, let prevParticipant, let newParticipant, let invite, let qts): if boxed { - buffer.appendInt32(2146218476) + buffer.appendInt32(-1738720581) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(actorId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(actorId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {prevParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {newParticipant!.serialize(buffer, true)} if Int(flags) & Int(1 << 2) != 0 {invite!.serialize(buffer, true)} @@ -5478,9 +5478,9 @@ public extension Api { break case .updateBotStopped(let userId, let date, let stopped, let qts): if boxed { - buffer.appendInt32(133777546) + buffer.appendInt32(-997782967) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) stopped.serialize(buffer, true) serializeInt32(qts, buffer: buffer, boxed: false) @@ -5492,6 +5492,18 @@ public extension Api { serializeInt32(flags, buffer: buffer, boxed: false) params.serialize(buffer, true) break + case .updateBotCommands(let peer, let botId, let commands): + if boxed { + buffer.appendInt32(1299263278) + } + peer.serialize(buffer, true) + serializeInt64(botId, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(commands.count)) + for item in commands { + item.serialize(buffer, true) + } + break } } @@ -5641,8 +5653,8 @@ public extension Api { return ("updateGeoLiveViewed", [("peer", peer), ("msgId", msgId)]) case .updateLoginToken: return ("updateLoginToken", []) - case .updateMessagePollVote(let pollId, let userId, let options, let qts): - return ("updateMessagePollVote", [("pollId", pollId), ("userId", userId), ("options", options), ("qts", qts)]) + case .updateMessagePollVote(let pollId, let userId, let options): + return ("updateMessagePollVote", [("pollId", pollId), ("userId", userId), ("options", options)]) case .updateDialogFilter(let flags, let id, let filter): return ("updateDialogFilter", [("flags", flags), ("id", id), ("filter", filter)]) case .updateDialogFilterOrder(let order): @@ -5681,6 +5693,8 @@ public extension Api { return ("updateBotStopped", [("userId", userId), ("date", date), ("stopped", stopped), ("qts", qts)]) case .updateGroupCallConnection(let flags, let params): return ("updateGroupCallConnection", [("flags", flags), ("params", params)]) + case .updateBotCommands(let peer, let botId, let commands): + return ("updateBotCommands", [("peer", peer), ("botId", botId), ("commands", commands)]) } } @@ -5737,8 +5751,8 @@ public extension Api { } } public static func parse_updateUserTyping(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.SendMessageAction? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.SendMessageAction @@ -5753,8 +5767,8 @@ public extension Api { } } public static func parse_updateChatUserTyping(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.Peer? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.Peer @@ -5787,8 +5801,8 @@ public extension Api { } } public static func parse_updateUserStatus(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.UserStatus? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.UserStatus @@ -5803,8 +5817,8 @@ public extension Api { } } public static func parse_updateUserName(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) var _3: String? @@ -5823,8 +5837,8 @@ public extension Api { } } public static func parse_updateUserPhoto(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Api.UserProfilePhoto? @@ -5863,8 +5877,8 @@ public extension Api { } } public static func parse_updateEncryptedChatTyping(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Update.updateEncryptedChatTyping(chatId: _1!) @@ -5890,8 +5904,8 @@ public extension Api { } } public static func parse_updateEncryptedMessagesRead(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -5907,12 +5921,12 @@ public extension Api { } } public static func parse_updateChatParticipantAdd(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Int32? @@ -5930,10 +5944,10 @@ public extension Api { } } public static func parse_updateChatParticipantDelete(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -6026,8 +6040,8 @@ public extension Api { } } public static func parse_updateUserPhone(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) let _c1 = _1 != nil @@ -6133,8 +6147,8 @@ public extension Api { public static func parse_updateChannelTooLong(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() } let _c1 = _1 != nil @@ -6148,8 +6162,8 @@ public extension Api { } } public static func parse_updateChannel(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Update.updateChannel(channelId: _1!) @@ -6182,8 +6196,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() } - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Int32? @@ -6204,8 +6218,8 @@ public extension Api { } } public static func parse_updateDeleteChannelMessages(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Int32]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) @@ -6226,8 +6240,8 @@ public extension Api { } } public static func parse_updateChannelMessageViews(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -6243,10 +6257,10 @@ public extension Api { } } public static func parse_updateChatParticipantAdmin(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Api.Bool? if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.Bool @@ -6304,8 +6318,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: String? _4 = parseString(reader) var _5: Api.GeoPoint? @@ -6335,8 +6349,8 @@ public extension Api { public static func parse_updateBotInlineSend(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: Api.GeoPoint? @@ -6386,8 +6400,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.Peer? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.Peer @@ -6439,8 +6453,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.InputBotInlineMessageID? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessageID @@ -6466,8 +6480,8 @@ public extension Api { } } public static func parse_updateReadChannelOutbox(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -6510,8 +6524,8 @@ public extension Api { return Api.Update.updatePtsChanged } public static func parse_updateChannelWebPage(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.WebPage? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.WebPage @@ -6604,8 +6618,8 @@ public extension Api { public static func parse_updateBotShippingQuery(_ reader: BufferReader) -> Update? { var _1: Int64? _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Buffer? _3 = parseBytes(reader) var _4: Api.PostAddress? @@ -6628,8 +6642,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Buffer? _4 = parseBytes(reader) var _5: Api.PaymentRequestedInfo? @@ -6698,8 +6712,8 @@ public extension Api { return Api.Update.updateFavedStickers } public static func parse_updateChannelReadMessagesContents(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Int32]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) @@ -6717,8 +6731,8 @@ public extension Api { return Api.Update.updateContactsReset } public static func parse_updateChannelAvailableMessages(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -6907,20 +6921,17 @@ public extension Api { public static func parse_updateMessagePollVote(_ reader: BufferReader) -> Update? { var _1: Int64? _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: [Buffer]? if let _ = reader.readInt32() { _3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self) } - var _4: Int32? - _4 = reader.readInt32() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.Update.updateMessagePollVote(pollId: _1!, userId: _2!, options: _3!, qts: _4!) + if _c1 && _c2 && _c3 { + return Api.Update.updateMessagePollVote(pollId: _1!, userId: _2!, options: _3!) } else { return nil @@ -6976,8 +6987,8 @@ public extension Api { } } public static func parse_updateChannelMessageForwards(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -6995,14 +7006,14 @@ public extension Api { public static func parse_updateReadChannelDiscussionInbox(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() } + var _5: Int64? + if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt64() } var _6: Int32? if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt32() } let _c1 = _1 != nil @@ -7019,8 +7030,8 @@ public extension Api { } } public static func parse_updateReadChannelDiscussionOutbox(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -7056,8 +7067,8 @@ public extension Api { public static func parse_updateChannelUserTyping(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() } var _4: Api.Peer? @@ -7110,8 +7121,8 @@ public extension Api { public static func parse_updatePinnedChannelMessages(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: [Int32]? if let _ = reader.readInt32() { _3 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) @@ -7133,8 +7144,8 @@ public extension Api { } } public static func parse_updateChat(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.Update.updateChat(chatId: _1!) @@ -7165,8 +7176,8 @@ public extension Api { } } public static func parse_updateGroupCall(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.GroupCall? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.GroupCall @@ -7202,14 +7213,14 @@ public extension Api { public static func parse_updateChatParticipant(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() var _6: Api.ChatParticipant? if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { _6 = Api.parse(reader, signature: signature) as? Api.ChatParticipant @@ -7243,14 +7254,14 @@ public extension Api { public static func parse_updateChannelParticipant(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() var _6: Api.ChannelParticipant? if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { _6 = Api.parse(reader, signature: signature) as? Api.ChannelParticipant @@ -7282,8 +7293,8 @@ public extension Api { } } public static func parse_updateBotStopped(_ reader: BufferReader) -> Update? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Api.Bool? @@ -7319,6 +7330,27 @@ public extension Api { return nil } } + public static func parse_updateBotCommands(_ reader: BufferReader) -> Update? { + var _1: Api.Peer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Peer + } + var _2: Int64? + _2 = reader.readInt64() + var _3: [Api.BotCommand]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.BotCommand.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.Update.updateBotCommands(peer: _1!, botId: _2!, commands: _3!) + } + else { + return nil + } + } } public enum PopularContact: TypeConstructorDescription { @@ -7444,58 +7476,58 @@ public extension Api { } public enum ChannelParticipant: TypeConstructorDescription { - case channelParticipant(userId: Int32, date: Int32) - case channelParticipantSelf(userId: Int32, inviterId: Int32, date: Int32) - case channelParticipantCreator(flags: Int32, userId: Int32, adminRights: Api.ChatAdminRights, rank: String?) - case channelParticipantAdmin(flags: Int32, userId: Int32, inviterId: Int32?, promotedBy: Int32, date: Int32, adminRights: Api.ChatAdminRights, rank: String?) - case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int32, date: Int32, bannedRights: Api.ChatBannedRights) + case channelParticipant(userId: Int64, date: Int32) + case channelParticipantSelf(userId: Int64, inviterId: Int64, date: Int32) + case channelParticipantCreator(flags: Int32, userId: Int64, adminRights: Api.ChatAdminRights, rank: String?) + case channelParticipantAdmin(flags: Int32, userId: Int64, inviterId: Int64?, promotedBy: Int64, date: Int32, adminRights: Api.ChatAdminRights, rank: String?) + case channelParticipantBanned(flags: Int32, peer: Api.Peer, kickedBy: Int64, date: Int32, bannedRights: Api.ChatBannedRights) case channelParticipantLeft(peer: Api.Peer) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .channelParticipant(let userId, let date): if boxed { - buffer.appendInt32(367766557) + buffer.appendInt32(-1072953408) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .channelParticipantSelf(let userId, let inviterId, let date): if boxed { - buffer.appendInt32(-1557620115) + buffer.appendInt32(682146919) } - serializeInt32(userId, buffer: buffer, boxed: false) - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .channelParticipantCreator(let flags, let userId, let adminRights, let rank): if boxed { - buffer.appendInt32(1149094475) + buffer.appendInt32(803602899) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) adminRights.serialize(buffer, true) if Int(flags) & Int(1 << 0) != 0 {serializeString(rank!, buffer: buffer, boxed: false)} break case .channelParticipantAdmin(let flags, let userId, let inviterId, let promotedBy, let date, let adminRights, let rank): if boxed { - buffer.appendInt32(-859915345) + buffer.appendInt32(885242707) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) - if Int(flags) & Int(1 << 1) != 0 {serializeInt32(inviterId!, buffer: buffer, boxed: false)} - serializeInt32(promotedBy, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 1) != 0 {serializeInt64(inviterId!, buffer: buffer, boxed: false)} + serializeInt64(promotedBy, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) adminRights.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {serializeString(rank!, buffer: buffer, boxed: false)} break case .channelParticipantBanned(let flags, let peer, let kickedBy, let date, let bannedRights): if boxed { - buffer.appendInt32(1352785878) + buffer.appendInt32(1844969806) } serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) - serializeInt32(kickedBy, buffer: buffer, boxed: false) + serializeInt64(kickedBy, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) bannedRights.serialize(buffer, true) break @@ -7526,8 +7558,8 @@ public extension Api { } public static func parse_channelParticipant(_ reader: BufferReader) -> ChannelParticipant? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -7540,10 +7572,10 @@ public extension Api { } } public static func parse_channelParticipantSelf(_ reader: BufferReader) -> ChannelParticipant? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -7559,8 +7591,8 @@ public extension Api { public static func parse_channelParticipantCreator(_ reader: BufferReader) -> ChannelParticipant? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Api.ChatAdminRights? if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights @@ -7581,12 +7613,12 @@ public extension Api { public static func parse_channelParticipantAdmin(_ reader: BufferReader) -> ChannelParticipant? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() } - var _4: Int32? - _4 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt64() } + var _4: Int64? + _4 = reader.readInt64() var _5: Int32? _5 = reader.readInt32() var _6: Api.ChatAdminRights? @@ -7616,8 +7648,8 @@ public extension Api { if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.Peer } - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Api.ChatBannedRights? @@ -7652,32 +7684,32 @@ public extension Api { } public enum MessageUserVote: TypeConstructorDescription { - case messageUserVote(userId: Int32, option: Buffer, date: Int32) - case messageUserVoteInputOption(userId: Int32, date: Int32) - case messageUserVoteMultiple(userId: Int32, options: [Buffer], date: Int32) + case messageUserVote(userId: Int64, option: Buffer, date: Int32) + case messageUserVoteInputOption(userId: Int64, date: Int32) + case messageUserVoteMultiple(userId: Int64, options: [Buffer], date: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .messageUserVote(let userId, let option, let date): if boxed { - buffer.appendInt32(-1567730343) + buffer.appendInt32(886196148) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeBytes(option, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .messageUserVoteInputOption(let userId, let date): if boxed { - buffer.appendInt32(909603888) + buffer.appendInt32(1017491692) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break case .messageUserVoteMultiple(let userId, let options, let date): if boxed { - buffer.appendInt32(244310238) + buffer.appendInt32(-1973033641) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(options.count)) for item in options { @@ -7700,8 +7732,8 @@ public extension Api { } public static func parse_messageUserVote(_ reader: BufferReader) -> MessageUserVote? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Buffer? _2 = parseBytes(reader) var _3: Int32? @@ -7717,8 +7749,8 @@ public extension Api { } } public static func parse_messageUserVoteInputOption(_ reader: BufferReader) -> MessageUserVote? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -7731,8 +7763,8 @@ public extension Api { } } public static func parse_messageUserVoteMultiple(_ reader: BufferReader) -> MessageUserVote? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Buffer]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self) @@ -8106,15 +8138,15 @@ public extension Api { } public enum ContactStatus: TypeConstructorDescription { - case contactStatus(userId: Int32, status: Api.UserStatus) + case contactStatus(userId: Int64, status: Api.UserStatus) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .contactStatus(let userId, let status): if boxed { - buffer.appendInt32(-748155807) + buffer.appendInt32(383348795) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) status.serialize(buffer, true) break } @@ -8128,8 +8160,8 @@ public extension Api { } public static func parse_contactStatus(_ reader: BufferReader) -> ContactStatus? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.UserStatus? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.UserStatus @@ -9790,15 +9822,15 @@ public extension Api { } public enum ChatAdminWithInvites: TypeConstructorDescription { - case chatAdminWithInvites(adminId: Int32, invitesCount: Int32, revokedInvitesCount: Int32) + case chatAdminWithInvites(adminId: Int64, invitesCount: Int32, revokedInvitesCount: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatAdminWithInvites(let adminId, let invitesCount, let revokedInvitesCount): if boxed { - buffer.appendInt32(-539872497) + buffer.appendInt32(-219353309) } - serializeInt32(adminId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) serializeInt32(invitesCount, buffer: buffer, boxed: false) serializeInt32(revokedInvitesCount, buffer: buffer, boxed: false) break @@ -9813,8 +9845,8 @@ public extension Api { } public static func parse_chatAdminWithInvites(_ reader: BufferReader) -> ChatAdminWithInvites? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -10538,11 +10570,11 @@ public extension Api { indirect public enum InputPeer: TypeConstructorDescription { case inputPeerEmpty case inputPeerSelf - case inputPeerChat(chatId: Int32) - case inputPeerUser(userId: Int32, accessHash: Int64) - case inputPeerChannel(channelId: Int32, accessHash: Int64) - case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int32) - case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int32) + case inputPeerChat(chatId: Int64) + case inputPeerUser(userId: Int64, accessHash: Int64) + case inputPeerChannel(channelId: Int64, accessHash: Int64) + case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64) + case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -10560,39 +10592,39 @@ public extension Api { break case .inputPeerChat(let chatId): if boxed { - buffer.appendInt32(396093539) + buffer.appendInt32(900291769) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .inputPeerUser(let userId, let accessHash): if boxed { - buffer.appendInt32(2072935910) + buffer.appendInt32(-571955892) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputPeerChannel(let channelId, let accessHash): if boxed { - buffer.appendInt32(548253432) + buffer.appendInt32(666680316) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputPeerUserFromMessage(let peer, let msgId, let userId): if boxed { - buffer.appendInt32(398123750) + buffer.appendInt32(-1468331492) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .inputPeerChannelFromMessage(let peer, let msgId, let channelId): if boxed { - buffer.appendInt32(-1667893317) + buffer.appendInt32(-1121318848) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break } } @@ -10623,8 +10655,8 @@ public extension Api { return Api.InputPeer.inputPeerSelf } public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.InputPeer.inputPeerChat(chatId: _1!) @@ -10634,8 +10666,8 @@ public extension Api { } } public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -10648,8 +10680,8 @@ public extension Api { } } public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -10668,8 +10700,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -10687,8 +10719,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -10702,15 +10734,15 @@ public extension Api { } public enum Contact: TypeConstructorDescription { - case contact(userId: Int32, mutual: Api.Bool) + case contact(userId: Int64, mutual: Api.Bool) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .contact(let userId, let mutual): if boxed { - buffer.appendInt32(-116274796) + buffer.appendInt32(341499403) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) mutual.serialize(buffer, true) break } @@ -10724,8 +10756,8 @@ public extension Api { } public static func parse_contact(_ reader: BufferReader) -> Contact? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Api.Bool? if let signature = reader.readInt32() { _2 = Api.parse(reader, signature: signature) as? Api.Bool @@ -11060,8 +11092,8 @@ public extension Api { case inputPrivacyValueDisallowContacts case inputPrivacyValueDisallowAll case inputPrivacyValueDisallowUsers(users: [Api.InputUser]) - case inputPrivacyValueAllowChatParticipants(chats: [Int32]) - case inputPrivacyValueDisallowChatParticipants(chats: [Int32]) + case inputPrivacyValueAllowChatParticipants(chats: [Int64]) + case inputPrivacyValueDisallowChatParticipants(chats: [Int64]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -11111,22 +11143,22 @@ public extension Api { break case .inputPrivacyValueAllowChatParticipants(let chats): if boxed { - buffer.appendInt32(1283572154) + buffer.appendInt32(-2079962673) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .inputPrivacyValueDisallowChatParticipants(let chats): if boxed { - buffer.appendInt32(-668769361) + buffer.appendInt32(-380694650) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break } @@ -11192,9 +11224,9 @@ public extension Api { } } public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -11205,9 +11237,9 @@ public extension Api { } } public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -11238,7 +11270,7 @@ public extension Api { case channelAdminLogEventActionTogglePreHistoryHidden(newValue: Api.Bool) case channelAdminLogEventActionDefaultBannedRights(prevBannedRights: Api.ChatBannedRights, newBannedRights: Api.ChatBannedRights) case channelAdminLogEventActionStopPoll(message: Api.Message) - case channelAdminLogEventActionChangeLinkedChat(prevValue: Int32, newValue: Int32) + case channelAdminLogEventActionChangeLinkedChat(prevValue: Int64, newValue: Int64) case channelAdminLogEventActionChangeLocation(prevValue: Api.ChannelLocation, newValue: Api.ChannelLocation) case channelAdminLogEventActionToggleSlowMode(prevValue: Int32, newValue: Int32) case channelAdminLogEventActionStartGroupCall(call: Api.InputGroupCall) @@ -11374,10 +11406,10 @@ public extension Api { break case .channelAdminLogEventActionChangeLinkedChat(let prevValue, let newValue): if boxed { - buffer.appendInt32(-1569748965) + buffer.appendInt32(84703944) } - serializeInt32(prevValue, buffer: buffer, boxed: false) - serializeInt32(newValue, buffer: buffer, boxed: false) + serializeInt64(prevValue, buffer: buffer, boxed: false) + serializeInt64(newValue, buffer: buffer, boxed: false) break case .channelAdminLogEventActionChangeLocation(let prevValue, let newValue): if boxed { @@ -11781,10 +11813,10 @@ public extension Api { } } public static func parse_channelAdminLogEventActionChangeLinkedChat(_ reader: BufferReader) -> ChannelAdminLogEventAction? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -12636,15 +12668,15 @@ public extension Api { } public enum StatsGroupTopPoster: TypeConstructorDescription { - case statsGroupTopPoster(userId: Int32, messages: Int32, avgChars: Int32) + case statsGroupTopPoster(userId: Int64, messages: Int32, avgChars: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .statsGroupTopPoster(let userId, let messages, let avgChars): if boxed { - buffer.appendInt32(418631927) + buffer.appendInt32(-1660637285) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(messages, buffer: buffer, boxed: false) serializeInt32(avgChars, buffer: buffer, boxed: false) break @@ -12659,8 +12691,8 @@ public extension Api { } public static func parse_statsGroupTopPoster(_ reader: BufferReader) -> StatsGroupTopPoster? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() var _3: Int32? @@ -13476,16 +13508,16 @@ public extension Api { } public enum HighScore: TypeConstructorDescription { - case highScore(pos: Int32, userId: Int32, score: Int32) + case highScore(pos: Int32, userId: Int64, score: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .highScore(let pos, let userId, let score): if boxed { - buffer.appendInt32(1493171408) + buffer.appendInt32(1940093419) } serializeInt32(pos, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(score, buffer: buffer, boxed: false) break } @@ -13501,8 +13533,8 @@ public extension Api { public static func parse_highScore(_ reader: BufferReader) -> HighScore? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() let _c1 = _1 != nil @@ -13844,8 +13876,8 @@ public extension Api { public enum InputUser: TypeConstructorDescription { case inputUserEmpty case inputUserSelf - case inputUser(userId: Int32, accessHash: Int64) - case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int32) + case inputUser(userId: Int64, accessHash: Int64) + case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -13863,18 +13895,18 @@ public extension Api { break case .inputUser(let userId, let accessHash): if boxed { - buffer.appendInt32(-668391402) + buffer.appendInt32(-233744186) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break case .inputUserFromMessage(let peer, let msgId, let userId): if boxed { - buffer.appendInt32(756118935) + buffer.appendInt32(497305826) } peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break } } @@ -13899,8 +13931,8 @@ public extension Api { return Api.InputUser.inputUserSelf } public static func parse_inputUser(_ reader: BufferReader) -> InputUser? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil @@ -13919,8 +13951,8 @@ public extension Api { } var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -14648,15 +14680,15 @@ public extension Api { } public enum ChatInviteImporter: TypeConstructorDescription { - case chatInviteImporter(userId: Int32, date: Int32) + case chatInviteImporter(userId: Int64, date: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatInviteImporter(let userId, let date): if boxed { - buffer.appendInt32(507405952) + buffer.appendInt32(190633460) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) break } @@ -14670,8 +14702,8 @@ public extension Api { } public static func parse_chatInviteImporter(_ reader: BufferReader) -> ChatInviteImporter? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -14724,13 +14756,13 @@ public extension Api { } public enum MessageReplies: TypeConstructorDescription { - case messageReplies(flags: Int32, replies: Int32, repliesPts: Int32, recentRepliers: [Api.Peer]?, channelId: Int32?, maxId: Int32?, readMaxId: Int32?) + case messageReplies(flags: Int32, replies: Int32, repliesPts: Int32, recentRepliers: [Api.Peer]?, channelId: Int64?, maxId: Int32?, readMaxId: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .messageReplies(let flags, let replies, let repliesPts, let recentRepliers, let channelId, let maxId, let readMaxId): if boxed { - buffer.appendInt32(1093204652) + buffer.appendInt32(-2083123262) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(replies, buffer: buffer, boxed: false) @@ -14740,7 +14772,7 @@ public extension Api { for item in recentRepliers! { item.serialize(buffer, true) }} - if Int(flags) & Int(1 << 0) != 0 {serializeInt32(channelId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 0) != 0 {serializeInt64(channelId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeInt32(maxId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {serializeInt32(readMaxId!, buffer: buffer, boxed: false)} break @@ -14765,8 +14797,8 @@ public extension Api { if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() { _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) } } - var _5: Int32? - if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() } + var _5: Int64? + if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt64() } var _6: Int32? if Int(_1!) & Int(1 << 2) != 0 {_6 = reader.readInt32() } var _7: Int32? @@ -15567,8 +15599,8 @@ public extension Api { } public enum Updates: TypeConstructorDescription { case updatesTooLong - case updateShortMessage(flags: Int32, id: Int32, userId: Int32, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) - case updateShortChatMessage(flags: Int32, id: Int32, fromId: Int32, chatId: Int32, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) + case updateShortMessage(flags: Int32, id: Int32, userId: Int64, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) + case updateShortChatMessage(flags: Int32, id: Int32, fromId: Int64, chatId: Int64, message: String, pts: Int32, ptsCount: Int32, date: Int32, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, replyTo: Api.MessageReplyHeader?, entities: [Api.MessageEntity]?, ttlPeriod: Int32?) case updateShort(update: Api.Update, date: Int32) case updatesCombined(updates: [Api.Update], users: [Api.User], chats: [Api.Chat], date: Int32, seqStart: Int32, seq: Int32) case updates(updates: [Api.Update], users: [Api.User], chats: [Api.Chat], date: Int32, seq: Int32) @@ -15584,17 +15616,17 @@ public extension Api { break case .updateShortMessage(let flags, let id, let userId, let message, let pts, let ptsCount, let date, let fwdFrom, let viaBotId, let replyTo, let entities, let ttlPeriod): if boxed { - buffer.appendInt32(-84936653) + buffer.appendInt32(826001400) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)} - if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 11) != 0 {serializeInt64(viaBotId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)} if Int(flags) & Int(1 << 7) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(entities!.count)) @@ -15605,18 +15637,18 @@ public extension Api { break case .updateShortChatMessage(let flags, let id, let fromId, let chatId, let message, let pts, let ptsCount, let date, let fwdFrom, let viaBotId, let replyTo, let entities, let ttlPeriod): if boxed { - buffer.appendInt32(290961496) + buffer.appendInt32(1299050149) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) - serializeInt32(fromId, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(fromId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(ptsCount, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)} - if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 11) != 0 {serializeInt64(viaBotId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)} if Int(flags) & Int(1 << 7) != 0 {buffer.appendInt32(481674261) buffer.appendInt32(Int32(entities!.count)) @@ -15724,8 +15756,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: String? _4 = parseString(reader) var _5: Int32? @@ -15738,8 +15770,8 @@ public extension Api { if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { _8 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader } } - var _9: Int32? - if Int(_1!) & Int(1 << 11) != 0 {_9 = reader.readInt32() } + var _9: Int64? + if Int(_1!) & Int(1 << 11) != 0 {_9 = reader.readInt64() } var _10: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { _10 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader @@ -15774,10 +15806,10 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int64? + _4 = reader.readInt64() var _5: String? _5 = parseString(reader) var _6: Int32? @@ -15790,8 +15822,8 @@ public extension Api { if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { _9 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader } } - var _10: Int32? - if Int(_1!) & Int(1 << 11) != 0 {_10 = reader.readInt32() } + var _10: Int64? + if Int(_1!) & Int(1 << 11) != 0 {_10 = reader.readInt64() } var _11: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { _11 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader @@ -15979,7 +16011,7 @@ public extension Api { case messageMediaEmpty case messageMediaPhoto(flags: Int32, photo: Api.Photo?, ttlSeconds: Int32?) case messageMediaGeo(geo: Api.GeoPoint) - case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int32) + case messageMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String, userId: Int64) case messageMediaUnsupported case messageMediaDocument(flags: Int32, document: Api.Document?, ttlSeconds: Int32?) case messageMediaWebPage(webpage: Api.WebPage) @@ -16014,13 +16046,13 @@ public extension Api { break case .messageMediaContact(let phoneNumber, let firstName, let lastName, let vcard, let userId): if boxed { - buffer.appendInt32(-873313984) + buffer.appendInt32(1882335561) } serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(firstName, buffer: buffer, boxed: false) serializeString(lastName, buffer: buffer, boxed: false) serializeString(vcard, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .messageMediaUnsupported: if boxed { @@ -16174,8 +16206,8 @@ public extension Api { _3 = parseString(reader) var _4: String? _4 = parseString(reader) - var _5: Int32? - _5 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -16898,15 +16930,15 @@ public extension Api { } public enum BotInfo: TypeConstructorDescription { - case botInfo(userId: Int32, description: String, commands: [Api.BotCommand]) + case botInfo(userId: Int64, description: String, commands: [Api.BotCommand]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .botInfo(let userId, let description, let commands): if boxed { - buffer.appendInt32(-1729618630) + buffer.appendInt32(460632885) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeString(description, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(commands.count)) @@ -16925,8 +16957,8 @@ public extension Api { } public static func parse_botInfo(_ reader: BufferReader) -> BotInfo? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: String? _2 = parseString(reader) var _3: [Api.BotCommand]? @@ -16946,23 +16978,23 @@ public extension Api { } public enum User: TypeConstructorDescription { - case userEmpty(id: Int32) - case user(flags: Int32, id: Int32, accessHash: Int64?, firstName: String?, lastName: String?, username: String?, phone: String?, photo: Api.UserProfilePhoto?, status: Api.UserStatus?, botInfoVersion: Int32?, restrictionReason: [Api.RestrictionReason]?, botInlinePlaceholder: String?, langCode: String?) + case userEmpty(id: Int64) + case user(flags: Int32, id: Int64, accessHash: Int64?, firstName: String?, lastName: String?, username: String?, phone: String?, photo: Api.UserProfilePhoto?, status: Api.UserStatus?, botInfoVersion: Int32?, restrictionReason: [Api.RestrictionReason]?, botInlinePlaceholder: String?, langCode: String?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .userEmpty(let id): if boxed { - buffer.appendInt32(537022650) + buffer.appendInt32(-742634630) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) break case .user(let flags, let id, let accessHash, let firstName, let lastName, let username, let phone, let photo, let status, let botInfoVersion, let restrictionReason, let botInlinePlaceholder, let langCode): if boxed { - buffer.appendInt32(-1820043071) + buffer.appendInt32(1073147056) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt64(accessHash!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeString(firstName!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeString(lastName!, buffer: buffer, boxed: false)} @@ -16992,8 +17024,8 @@ public extension Api { } public static func parse_userEmpty(_ reader: BufferReader) -> User? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.User.userEmpty(id: _1!) @@ -17005,8 +17037,8 @@ public extension Api { public static func parse_user(_ reader: BufferReader) -> User? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Int64? if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt64() } var _4: String? @@ -17059,7 +17091,7 @@ public extension Api { } public enum Message: TypeConstructorDescription { case messageEmpty(flags: Int32, id: Int32, peerId: Api.Peer?) - case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?) + case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?) case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction, ttlPeriod: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -17074,14 +17106,14 @@ public extension Api { break case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason, let ttlPeriod): if boxed { - buffer.appendInt32(-1125940270) + buffer.appendInt32(-2049520670) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 8) != 0 {fromId!.serialize(buffer, true)} peerId.serialize(buffer, true) if Int(flags) & Int(1 << 2) != 0 {fwdFrom!.serialize(buffer, true)} - if Int(flags) & Int(1 << 11) != 0 {serializeInt32(viaBotId!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 11) != 0 {serializeInt64(viaBotId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {replyTo!.serialize(buffer, true)} serializeInt32(date, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) @@ -17168,8 +17200,8 @@ public extension Api { if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() { _5 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader } } - var _6: Int32? - if Int(_1!) & Int(1 << 11) != 0 {_6 = reader.readInt32() } + var _6: Int64? + if Int(_1!) & Int(1 << 11) != 0 {_6 = reader.readInt64() } var _7: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() { _7 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader @@ -17280,15 +17312,15 @@ public extension Api { } public enum StatsGroupTopInviter: TypeConstructorDescription { - case statsGroupTopInviter(userId: Int32, invitations: Int32) + case statsGroupTopInviter(userId: Int64, invitations: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .statsGroupTopInviter(let userId, let invitations): if boxed { - buffer.appendInt32(831924812) + buffer.appendInt32(1398765469) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt32(invitations, buffer: buffer, boxed: false) break } @@ -17302,8 +17334,8 @@ public extension Api { } public static func parse_statsGroupTopInviter(_ reader: BufferReader) -> StatsGroupTopInviter? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() let _c1 = _1 != nil @@ -17752,24 +17784,24 @@ public extension Api { } public enum ChatParticipants: TypeConstructorDescription { - case chatParticipantsForbidden(flags: Int32, chatId: Int32, selfParticipant: Api.ChatParticipant?) - case chatParticipants(chatId: Int32, participants: [Api.ChatParticipant], version: Int32) + case chatParticipantsForbidden(flags: Int32, chatId: Int64, selfParticipant: Api.ChatParticipant?) + case chatParticipants(chatId: Int64, participants: [Api.ChatParticipant], version: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatParticipantsForbidden(let flags, let chatId, let selfParticipant): if boxed { - buffer.appendInt32(-57668565) + buffer.appendInt32(-2023500831) } serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {selfParticipant!.serialize(buffer, true)} break case .chatParticipants(let chatId, let participants, let version): if boxed { - buffer.appendInt32(1061556205) + buffer.appendInt32(1018991608) } - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(participants.count)) for item in participants { @@ -17792,8 +17824,8 @@ public extension Api { public static func parse_chatParticipantsForbidden(_ reader: BufferReader) -> ChatParticipants? { var _1: Int32? _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: Api.ChatParticipant? if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.ChatParticipant @@ -17809,8 +17841,8 @@ public extension Api { } } public static func parse_chatParticipants(_ reader: BufferReader) -> ChatParticipants? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: [Api.ChatParticipant]? if let _ = reader.readInt32() { _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ChatParticipant.self) @@ -18710,17 +18742,17 @@ public extension Api { } public enum ChannelAdminLogEvent: TypeConstructorDescription { - case channelAdminLogEvent(id: Int64, date: Int32, userId: Int32, action: Api.ChannelAdminLogEventAction) + case channelAdminLogEvent(id: Int64, date: Int32, userId: Int64, action: Api.ChannelAdminLogEventAction) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .channelAdminLogEvent(let id, let date, let userId, let action): if boxed { - buffer.appendInt32(995769920) + buffer.appendInt32(531458253) } serializeInt64(id, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) action.serialize(buffer, true) break } @@ -18738,8 +18770,8 @@ public extension Api { _1 = reader.readInt64() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.ChannelAdminLogEventAction? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.ChannelAdminLogEventAction @@ -19794,17 +19826,17 @@ public extension Api { } public enum ExportedChatInvite: TypeConstructorDescription { - case chatInviteExported(flags: Int32, link: String, adminId: Int32, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, usage: Int32?) + case chatInviteExported(flags: Int32, link: String, adminId: Int64, date: Int32, startDate: Int32?, expireDate: Int32?, usageLimit: Int32?, usage: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .chatInviteExported(let flags, let link, let adminId, let date, let startDate, let expireDate, let usageLimit, let usage): if boxed { - buffer.appendInt32(1847917725) + buffer.appendInt32(-1316944408) } serializeInt32(flags, buffer: buffer, boxed: false) serializeString(link, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 4) != 0 {serializeInt32(startDate!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeInt32(expireDate!, buffer: buffer, boxed: false)} @@ -19826,8 +19858,8 @@ public extension Api { _1 = reader.readInt32() var _2: String? _2 = parseString(reader) - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() var _5: Int32? @@ -20528,12 +20560,12 @@ public extension Api { public enum PrivacyRule: TypeConstructorDescription { case privacyValueAllowContacts case privacyValueAllowAll - case privacyValueAllowUsers(users: [Int32]) + case privacyValueAllowUsers(users: [Int64]) case privacyValueDisallowContacts case privacyValueDisallowAll - case privacyValueDisallowUsers(users: [Int32]) - case privacyValueAllowChatParticipants(chats: [Int32]) - case privacyValueDisallowChatParticipants(chats: [Int32]) + case privacyValueDisallowUsers(users: [Int64]) + case privacyValueAllowChatParticipants(chats: [Int64]) + case privacyValueDisallowChatParticipants(chats: [Int64]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -20551,12 +20583,12 @@ public extension Api { break case .privacyValueAllowUsers(let users): if boxed { - buffer.appendInt32(1297858060) + buffer.appendInt32(-1198497870) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .privacyValueDisallowContacts: @@ -20573,32 +20605,32 @@ public extension Api { break case .privacyValueDisallowUsers(let users): if boxed { - buffer.appendInt32(209668535) + buffer.appendInt32(-463335103) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .privacyValueAllowChatParticipants(let chats): if boxed { - buffer.appendInt32(415136107) + buffer.appendInt32(1796427406) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .privacyValueDisallowChatParticipants(let chats): if boxed { - buffer.appendInt32(-1397881200) + buffer.appendInt32(1103656293) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(chats.count)) for item in chats { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break } @@ -20632,9 +20664,9 @@ public extension Api { return Api.PrivacyRule.privacyValueAllowAll } public static func parse_privacyValueAllowUsers(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20651,9 +20683,9 @@ public extension Api { return Api.PrivacyRule.privacyValueDisallowAll } public static func parse_privacyValueDisallowUsers(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20664,9 +20696,9 @@ public extension Api { } } public static func parse_privacyValueAllowChatParticipants(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20677,9 +20709,9 @@ public extension Api { } } public static func parse_privacyValueDisallowChatParticipants(_ reader: BufferReader) -> PrivacyRule? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -20693,16 +20725,16 @@ public extension Api { } public enum MessageAction: TypeConstructorDescription { case messageActionEmpty - case messageActionChatCreate(title: String, users: [Int32]) + case messageActionChatCreate(title: String, users: [Int64]) case messageActionChatEditTitle(title: String) case messageActionChatEditPhoto(photo: Api.Photo) case messageActionChatDeletePhoto - case messageActionChatAddUser(users: [Int32]) - case messageActionChatDeleteUser(userId: Int32) - case messageActionChatJoinedByLink(inviterId: Int32) + case messageActionChatAddUser(users: [Int64]) + case messageActionChatDeleteUser(userId: Int64) + case messageActionChatJoinedByLink(inviterId: Int64) case messageActionChannelCreate(title: String) - case messageActionChatMigrateTo(channelId: Int32) - case messageActionChannelMigrateFrom(title: String, chatId: Int32) + case messageActionChatMigrateTo(channelId: Int64) + case messageActionChannelMigrateFrom(title: String, chatId: Int64) case messageActionPinMessage case messageActionHistoryClear case messageActionGameScore(gameId: Int64, score: Int32) @@ -20717,7 +20749,7 @@ public extension Api { case messageActionContactSignUp case messageActionGeoProximityReached(fromId: Api.Peer, toId: Api.Peer, distance: Int32) case messageActionGroupCall(flags: Int32, call: Api.InputGroupCall, duration: Int32?) - case messageActionInviteToGroupCall(call: Api.InputGroupCall, users: [Int32]) + case messageActionInviteToGroupCall(call: Api.InputGroupCall, users: [Int64]) case messageActionSetMessagesTTL(period: Int32) case messageActionGroupCallScheduled(call: Api.InputGroupCall, scheduleDate: Int32) @@ -20731,13 +20763,13 @@ public extension Api { break case .messageActionChatCreate(let title, let users): if boxed { - buffer.appendInt32(-1503425638) + buffer.appendInt32(-1119368275) } serializeString(title, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .messageActionChatEditTitle(let title): @@ -20760,25 +20792,25 @@ public extension Api { break case .messageActionChatAddUser(let users): if boxed { - buffer.appendInt32(1217033015) + buffer.appendInt32(365886720) } buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .messageActionChatDeleteUser(let userId): if boxed { - buffer.appendInt32(-1297179892) + buffer.appendInt32(-1539362612) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .messageActionChatJoinedByLink(let inviterId): if boxed { - buffer.appendInt32(-123931160) + buffer.appendInt32(51520707) } - serializeInt32(inviterId, buffer: buffer, boxed: false) + serializeInt64(inviterId, buffer: buffer, boxed: false) break case .messageActionChannelCreate(let title): if boxed { @@ -20788,16 +20820,16 @@ public extension Api { break case .messageActionChatMigrateTo(let channelId): if boxed { - buffer.appendInt32(1371385889) + buffer.appendInt32(-519864430) } - serializeInt32(channelId, buffer: buffer, boxed: false) + serializeInt64(channelId, buffer: buffer, boxed: false) break case .messageActionChannelMigrateFrom(let title, let chatId): if boxed { - buffer.appendInt32(-1336546578) + buffer.appendInt32(-365344535) } serializeString(title, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) break case .messageActionPinMessage: if boxed { @@ -20909,13 +20941,13 @@ public extension Api { break case .messageActionInviteToGroupCall(let call, let users): if boxed { - buffer.appendInt32(1991897370) + buffer.appendInt32(1345295095) } call.serialize(buffer, true) buffer.appendInt32(481674261) buffer.appendInt32(Int32(users.count)) for item in users { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } break case .messageActionSetMessagesTTL(let period): @@ -21001,9 +21033,9 @@ public extension Api { public static func parse_messageActionChatCreate(_ reader: BufferReader) -> MessageAction? { var _1: String? _1 = parseString(reader) - var _2: [Int32]? + var _2: [Int64]? if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil let _c2 = _2 != nil @@ -21042,9 +21074,9 @@ public extension Api { return Api.MessageAction.messageActionChatDeletePhoto } public static func parse_messageActionChatAddUser(_ reader: BufferReader) -> MessageAction? { - var _1: [Int32]? + var _1: [Int64]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil if _c1 { @@ -21055,8 +21087,8 @@ public extension Api { } } public static func parse_messageActionChatDeleteUser(_ reader: BufferReader) -> MessageAction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.MessageAction.messageActionChatDeleteUser(userId: _1!) @@ -21066,8 +21098,8 @@ public extension Api { } } public static func parse_messageActionChatJoinedByLink(_ reader: BufferReader) -> MessageAction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.MessageAction.messageActionChatJoinedByLink(inviterId: _1!) @@ -21088,8 +21120,8 @@ public extension Api { } } public static func parse_messageActionChatMigrateTo(_ reader: BufferReader) -> MessageAction? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() let _c1 = _1 != nil if _c1 { return Api.MessageAction.messageActionChatMigrateTo(channelId: _1!) @@ -21101,8 +21133,8 @@ public extension Api { public static func parse_messageActionChannelMigrateFrom(_ reader: BufferReader) -> MessageAction? { var _1: String? _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil if _c1 && _c2 { @@ -21305,9 +21337,9 @@ public extension Api { if let signature = reader.readInt32() { _1 = Api.parse(reader, signature: signature) as? Api.InputGroupCall } - var _2: [Int32]? + var _2: [Int64]? if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + _2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } let _c1 = _1 != nil let _c2 = _2 != nil @@ -21349,10 +21381,10 @@ public extension Api { } public enum PhoneCall: TypeConstructorDescription { case phoneCallEmpty(id: Int64) - case phoneCallWaiting(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, protocol: Api.PhoneCallProtocol, receiveDate: Int32?) - case phoneCallRequested(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAHash: Buffer, protocol: Api.PhoneCallProtocol) - case phoneCallAccepted(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gB: Buffer, protocol: Api.PhoneCallProtocol) - case phoneCall(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAOrB: Buffer, keyFingerprint: Int64, protocol: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32) + case phoneCallWaiting(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, protocol: Api.PhoneCallProtocol, receiveDate: Int32?) + case phoneCallRequested(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAHash: Buffer, protocol: Api.PhoneCallProtocol) + case phoneCallAccepted(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gB: Buffer, protocol: Api.PhoneCallProtocol) + case phoneCall(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64, protocol: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32) case phoneCallDiscarded(flags: Int32, id: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -21365,53 +21397,53 @@ public extension Api { break case .phoneCallWaiting(let flags, let id, let accessHash, let date, let adminId, let participantId, let `protocol`, let receiveDate): if boxed { - buffer.appendInt32(462375633) + buffer.appendInt32(-987599081) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(receiveDate!, buffer: buffer, boxed: false)} break case .phoneCallRequested(let flags, let id, let accessHash, let date, let adminId, let participantId, let gAHash, let `protocol`): if boxed { - buffer.appendInt32(-2014659757) + buffer.appendInt32(347139340) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gAHash, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) break case .phoneCallAccepted(let flags, let id, let accessHash, let date, let adminId, let participantId, let gB, let `protocol`): if boxed { - buffer.appendInt32(-1719909046) + buffer.appendInt32(912311057) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gB, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) break case .phoneCall(let flags, let id, let accessHash, let date, let adminId, let participantId, let gAOrB, let keyFingerprint, let `protocol`, let connections, let startDate): if boxed { - buffer.appendInt32(-2025673089) + buffer.appendInt32(-1770029977) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gAOrB, buffer: buffer, boxed: false) serializeInt64(keyFingerprint, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) @@ -21471,10 +21503,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Api.PhoneCallProtocol? if let signature = reader.readInt32() { _7 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol @@ -21505,10 +21537,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Buffer? _7 = parseBytes(reader) var _8: Api.PhoneCallProtocol? @@ -21539,10 +21571,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Buffer? _7 = parseBytes(reader) var _8: Api.PhoneCallProtocol? @@ -21573,10 +21605,10 @@ public extension Api { _3 = reader.readInt64() var _4: Int32? _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() var _7: Buffer? _7 = parseBytes(reader) var _8: Int64? @@ -22295,7 +22327,7 @@ public extension Api { case messageEntityCode(offset: Int32, length: Int32) case messageEntityPre(offset: Int32, length: Int32, language: String) case messageEntityTextUrl(offset: Int32, length: Int32, url: String) - case messageEntityMentionName(offset: Int32, length: Int32, userId: Int32) + case messageEntityMentionName(offset: Int32, length: Int32, userId: Int64) case inputMessageEntityMentionName(offset: Int32, length: Int32, userId: Api.InputUser) case messageEntityPhone(offset: Int32, length: Int32) case messageEntityCashtag(offset: Int32, length: Int32) @@ -22387,11 +22419,11 @@ public extension Api { break case .messageEntityMentionName(let offset, let length, let userId): if boxed { - buffer.appendInt32(892193368) + buffer.appendInt32(-595914432) } serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(length, buffer: buffer, boxed: false) - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) break case .inputMessageEntityMentionName(let offset, let length, let userId): if boxed { @@ -22654,8 +22686,8 @@ public extension Api { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -22897,9 +22929,9 @@ public extension Api { } public enum EncryptedChat: TypeConstructorDescription { case encryptedChatEmpty(id: Int32) - case encryptedChatWaiting(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32) - case encryptedChatRequested(flags: Int32, folderId: Int32?, id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gA: Buffer) - case encryptedChat(id: Int32, accessHash: Int64, date: Int32, adminId: Int32, participantId: Int32, gAOrB: Buffer, keyFingerprint: Int64) + case encryptedChatWaiting(id: Int32, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64) + case encryptedChatRequested(flags: Int32, folderId: Int32?, id: Int32, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gA: Buffer) + case encryptedChat(id: Int32, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64) case encryptedChatDiscarded(flags: Int32, id: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -22912,36 +22944,36 @@ public extension Api { break case .encryptedChatWaiting(let id, let accessHash, let date, let adminId, let participantId): if boxed { - buffer.appendInt32(1006044124) + buffer.appendInt32(1722964307) } serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) break case .encryptedChatRequested(let flags, let folderId, let id, let accessHash, let date, let adminId, let participantId, let gA): if boxed { - buffer.appendInt32(1651608194) + buffer.appendInt32(1223809356) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeInt32(folderId!, buffer: buffer, boxed: false)} serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gA, buffer: buffer, boxed: false) break case .encryptedChat(let id, let accessHash, let date, let adminId, let participantId, let gAOrB, let keyFingerprint): if boxed { - buffer.appendInt32(-94974410) + buffer.appendInt32(1643173063) } serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(adminId, buffer: buffer, boxed: false) - serializeInt32(participantId, buffer: buffer, boxed: false) + serializeInt64(adminId, buffer: buffer, boxed: false) + serializeInt64(participantId, buffer: buffer, boxed: false) serializeBytes(gAOrB, buffer: buffer, boxed: false) serializeInt64(keyFingerprint, buffer: buffer, boxed: false) break @@ -22988,10 +23020,10 @@ public extension Api { _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil @@ -23015,10 +23047,10 @@ public extension Api { _4 = reader.readInt64() var _5: Int32? _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() - var _7: Int32? - _7 = reader.readInt32() + var _6: Int64? + _6 = reader.readInt64() + var _7: Int64? + _7 = reader.readInt64() var _8: Buffer? _8 = parseBytes(reader) let _c1 = _1 != nil @@ -23043,10 +23075,10 @@ public extension Api { _2 = reader.readInt64() var _3: Int32? _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int64? + _5 = reader.readInt64() var _6: Buffer? _6 = parseBytes(reader) var _7: Int64? @@ -23258,16 +23290,16 @@ public extension Api { } public enum WebAuthorization: TypeConstructorDescription { - case webAuthorization(hash: Int64, botId: Int32, domain: String, browser: String, platform: String, dateCreated: Int32, dateActive: Int32, ip: String, region: String) + case webAuthorization(hash: Int64, botId: Int64, domain: String, browser: String, platform: String, dateCreated: Int32, dateActive: Int32, ip: String, region: String) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .webAuthorization(let hash, let botId, let domain, let browser, let platform, let dateCreated, let dateActive, let ip, let region): if boxed { - buffer.appendInt32(-892779534) + buffer.appendInt32(-1493633966) } serializeInt64(hash, buffer: buffer, boxed: false) - serializeInt32(botId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) serializeString(domain, buffer: buffer, boxed: false) serializeString(browser, buffer: buffer, boxed: false) serializeString(platform, buffer: buffer, boxed: false) @@ -23289,8 +23321,8 @@ public extension Api { public static func parse_webAuthorization(_ reader: BufferReader) -> WebAuthorization? { var _1: Int64? _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() var _3: String? _3 = parseString(reader) var _4: String? @@ -23324,15 +23356,15 @@ public extension Api { } public enum ImportedContact: TypeConstructorDescription { - case importedContact(userId: Int32, clientId: Int64) + case importedContact(userId: Int64, clientId: Int64) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .importedContact(let userId, let clientId): if boxed { - buffer.appendInt32(-805141448) + buffer.appendInt32(-1052885936) } - serializeInt32(userId, buffer: buffer, boxed: false) + serializeInt64(userId, buffer: buffer, boxed: false) serializeInt64(clientId, buffer: buffer, boxed: false) break } @@ -23346,8 +23378,8 @@ public extension Api { } public static func parse_importedContact(_ reader: BufferReader) -> ImportedContact? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Int64? _2 = reader.readInt64() let _c1 = _1 != nil diff --git a/submodules/TelegramApi/Sources/Api3.swift b/submodules/TelegramApi/Sources/Api3.swift index da75f10e38..80854e60f0 100644 --- a/submodules/TelegramApi/Sources/Api3.swift +++ b/submodules/TelegramApi/Sources/Api3.swift @@ -301,19 +301,19 @@ public struct payments { } public enum PaymentForm: TypeConstructorDescription { - case paymentForm(flags: Int32, formId: Int64, botId: Int32, invoice: Api.Invoice, providerId: Int32, url: String, nativeProvider: String?, nativeParams: Api.DataJSON?, savedInfo: Api.PaymentRequestedInfo?, savedCredentials: Api.PaymentSavedCredentials?, users: [Api.User]) + case paymentForm(flags: Int32, formId: Int64, botId: Int64, invoice: Api.Invoice, providerId: Int64, url: String, nativeProvider: String?, nativeParams: Api.DataJSON?, savedInfo: Api.PaymentRequestedInfo?, savedCredentials: Api.PaymentSavedCredentials?, users: [Api.User]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .paymentForm(let flags, let formId, let botId, let invoice, let providerId, let url, let nativeProvider, let nativeParams, let savedInfo, let savedCredentials, let users): if boxed { - buffer.appendInt32(-1928649707) + buffer.appendInt32(378828315) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(formId, buffer: buffer, boxed: false) - serializeInt32(botId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) invoice.serialize(buffer, true) - serializeInt32(providerId, buffer: buffer, boxed: false) + serializeInt64(providerId, buffer: buffer, boxed: false) serializeString(url, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 4) != 0 {serializeString(nativeProvider!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 4) != 0 {nativeParams!.serialize(buffer, true)} @@ -340,14 +340,14 @@ public struct payments { _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() var _4: Api.Invoice? if let signature = reader.readInt32() { _4 = Api.parse(reader, signature: signature) as? Api.Invoice } - var _5: Int32? - _5 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() var _6: String? _6 = parseString(reader) var _7: String? @@ -389,18 +389,18 @@ public struct payments { } public enum PaymentReceipt: TypeConstructorDescription { - case paymentReceipt(flags: Int32, date: Int32, botId: Int32, providerId: Int32, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User]) + case paymentReceipt(flags: Int32, date: Int32, botId: Int64, providerId: Int64, title: String, description: String, photo: Api.WebDocument?, invoice: Api.Invoice, info: Api.PaymentRequestedInfo?, shipping: Api.ShippingOption?, tipAmount: Int64?, currency: String, totalAmount: Int64, credentialsTitle: String, users: [Api.User]) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .paymentReceipt(let flags, let date, let botId, let providerId, let title, let description, let photo, let invoice, let info, let shipping, let tipAmount, let currency, let totalAmount, let credentialsTitle, let users): if boxed { - buffer.appendInt32(280319440) + buffer.appendInt32(1891958275) } serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(date, buffer: buffer, boxed: false) - serializeInt32(botId, buffer: buffer, boxed: false) - serializeInt32(providerId, buffer: buffer, boxed: false) + serializeInt64(botId, buffer: buffer, boxed: false) + serializeInt64(providerId, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) serializeString(description, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)} @@ -432,10 +432,10 @@ public struct payments { _1 = reader.readInt32() var _2: Int32? _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int64? + _4 = reader.readInt64() var _5: String? _5 = parseString(reader) var _6: String? @@ -1081,15 +1081,15 @@ public struct auth { } public enum ExportedAuthorization: TypeConstructorDescription { - case exportedAuthorization(id: Int32, bytes: Buffer) + case exportedAuthorization(id: Int64, bytes: Buffer) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { case .exportedAuthorization(let id, let bytes): if boxed { - buffer.appendInt32(-543777747) + buffer.appendInt32(-1271602504) } - serializeInt32(id, buffer: buffer, boxed: false) + serializeInt64(id, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) break } @@ -1103,8 +1103,8 @@ public struct auth { } public static func parse_exportedAuthorization(_ reader: BufferReader) -> ExportedAuthorization? { - var _1: Int32? - _1 = reader.readInt32() + var _1: Int64? + _1 = reader.readInt64() var _2: Buffer? _2 = parseBytes(reader) let _c1 = _1 != nil diff --git a/submodules/TelegramApi/Sources/Api4.swift b/submodules/TelegramApi/Sources/Api4.swift index 3e7bdcfd25..deaf0be59b 100644 --- a/submodules/TelegramApi/Sources/Api4.swift +++ b/submodules/TelegramApi/Sources/Api4.swift @@ -1171,6 +1171,72 @@ public struct account { } } + } + public enum ResetPasswordResult: TypeConstructorDescription { + case resetPasswordFailedWait(retryDate: Int32) + case resetPasswordRequestedWait(untilDate: Int32) + case resetPasswordOk + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .resetPasswordFailedWait(let retryDate): + if boxed { + buffer.appendInt32(-478701471) + } + serializeInt32(retryDate, buffer: buffer, boxed: false) + break + case .resetPasswordRequestedWait(let untilDate): + if boxed { + buffer.appendInt32(-370148227) + } + serializeInt32(untilDate, buffer: buffer, boxed: false) + break + case .resetPasswordOk: + if boxed { + buffer.appendInt32(-383330754) + } + + break + } + } + + public func descriptionFields() -> (String, [(String, Any)]) { + switch self { + case .resetPasswordFailedWait(let retryDate): + return ("resetPasswordFailedWait", [("retryDate", retryDate)]) + case .resetPasswordRequestedWait(let untilDate): + return ("resetPasswordRequestedWait", [("untilDate", untilDate)]) + case .resetPasswordOk: + return ("resetPasswordOk", []) + } + } + + public static func parse_resetPasswordFailedWait(_ reader: BufferReader) -> ResetPasswordResult? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.account.ResetPasswordResult.resetPasswordFailedWait(retryDate: _1!) + } + else { + return nil + } + } + public static func parse_resetPasswordRequestedWait(_ reader: BufferReader) -> ResetPasswordResult? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.account.ResetPasswordResult.resetPasswordRequestedWait(untilDate: _1!) + } + else { + return nil + } + } + public static func parse_resetPasswordOk(_ reader: BufferReader) -> ResetPasswordResult? { + return Api.account.ResetPasswordResult.resetPasswordOk + } + } public enum ContentSettings: TypeConstructorDescription { case contentSettings(flags: Int32) @@ -1325,13 +1391,13 @@ public struct account { } public enum Password: TypeConstructorDescription { - case password(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer) + case password(flags: Int32, currentAlgo: Api.PasswordKdfAlgo?, srpB: Buffer?, srpId: Int64?, hint: String?, emailUnconfirmedPattern: String?, newAlgo: Api.PasswordKdfAlgo, newSecureAlgo: Api.SecurePasswordKdfAlgo, secureRandom: Buffer, pendingResetDate: Int32?) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom): + case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate): if boxed { - buffer.appendInt32(-1390001672) + buffer.appendInt32(408623183) } serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {currentAlgo!.serialize(buffer, true)} @@ -1342,14 +1408,15 @@ public struct account { newAlgo.serialize(buffer, true) newSecureAlgo.serialize(buffer, true) serializeBytes(secureRandom, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 5) != 0 {serializeInt32(pendingResetDate!, buffer: buffer, boxed: false)} break } } public func descriptionFields() -> (String, [(String, Any)]) { switch self { - case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom): - return ("password", [("flags", flags), ("currentAlgo", currentAlgo), ("srpB", srpB), ("srpId", srpId), ("hint", hint), ("emailUnconfirmedPattern", emailUnconfirmedPattern), ("newAlgo", newAlgo), ("newSecureAlgo", newSecureAlgo), ("secureRandom", secureRandom)]) + case .password(let flags, let currentAlgo, let srpB, let srpId, let hint, let emailUnconfirmedPattern, let newAlgo, let newSecureAlgo, let secureRandom, let pendingResetDate): + return ("password", [("flags", flags), ("currentAlgo", currentAlgo), ("srpB", srpB), ("srpId", srpId), ("hint", hint), ("emailUnconfirmedPattern", emailUnconfirmedPattern), ("newAlgo", newAlgo), ("newSecureAlgo", newSecureAlgo), ("secureRandom", secureRandom), ("pendingResetDate", pendingResetDate)]) } } @@ -1378,6 +1445,8 @@ public struct account { } var _9: Buffer? _9 = parseBytes(reader) + var _10: Int32? + if Int(_1!) & Int(1 << 5) != 0 {_10 = reader.readInt32() } let _c1 = _1 != nil let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil @@ -1387,8 +1456,9 @@ public struct account { let _c7 = _7 != nil let _c8 = _8 != nil let _c9 = _9 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { - return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!) + let _c10 = (Int(_1!) & Int(1 << 5) == 0) || _10 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 { + return Api.account.Password.password(flags: _1!, currentAlgo: _2, srpB: _3, srpId: _4, hint: _5, emailUnconfirmedPattern: _6, newAlgo: _7!, newSecureAlgo: _8!, secureRandom: _9!, pendingResetDate: _10) } else { return nil @@ -2229,13 +2299,13 @@ public extension Api { }) } - public static func getChats(id: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getChats(id: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1013621127) + buffer.appendInt32(1240027791) buffer.appendInt32(481674261) buffer.appendInt32(Int32(id.count)) for item in id { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "messages.getChats", parameters: [("id", id)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) @@ -2247,10 +2317,10 @@ public extension Api { }) } - public static func getFullChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getFullChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(998448230) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-1364194508) + serializeInt64(chatId, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getFullChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in let reader = BufferReader(buffer) var result: Api.messages.ChatFull? @@ -2261,10 +2331,10 @@ public extension Api { }) } - public static func editChatTitle(chatId: Int32, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func editChatTitle(chatId: Int64, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-599447467) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(1937260541) + serializeInt64(chatId, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.editChatTitle", parameters: [("chatId", chatId), ("title", title)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) @@ -2276,10 +2346,10 @@ public extension Api { }) } - public static func editChatPhoto(chatId: Int32, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func editChatPhoto(chatId: Int64, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-900957736) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(903730804) + serializeInt64(chatId, buffer: buffer, boxed: false) photo.serialize(buffer, true) return (FunctionDescription(name: "messages.editChatPhoto", parameters: [("chatId", chatId), ("photo", photo)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) @@ -2291,10 +2361,10 @@ public extension Api { }) } - public static func addChatUser(chatId: Int32, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func addChatUser(chatId: Int64, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-106911223) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-230206493) + serializeInt64(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) serializeInt32(fwdLimit, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.addChatUser", parameters: [("chatId", chatId), ("userId", userId), ("fwdLimit", fwdLimit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in @@ -2307,11 +2377,11 @@ public extension Api { }) } - public static func deleteChatUser(flags: Int32, chatId: Int32, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func deleteChatUser(flags: Int32, chatId: Int64, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-986430054) + buffer.appendInt32(-1575461717) serializeInt32(flags, buffer: buffer, boxed: false) - serializeInt32(chatId, buffer: buffer, boxed: false) + serializeInt64(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) return (FunctionDescription(name: "messages.deleteChatUser", parameters: [("flags", flags), ("chatId", chatId), ("userId", userId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) @@ -2705,10 +2775,10 @@ public extension Api { }) } - public static func editChatAdmin(chatId: Int32, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func editChatAdmin(chatId: Int64, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1444503762) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-1470377534) + serializeInt64(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) isAdmin.serialize(buffer, true) return (FunctionDescription(name: "messages.editChatAdmin", parameters: [("chatId", chatId), ("userId", userId), ("isAdmin", isAdmin)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in @@ -2721,10 +2791,10 @@ public extension Api { }) } - public static func migrateChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func migrateChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(363051235) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(-1568189671) + serializeInt64(chatId, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.migrateChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? @@ -3224,11 +3294,11 @@ public extension Api { }) } - public static func getCommonChats(userId: Api.InputUser, maxId: Int32, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getCommonChats(userId: Api.InputUser, maxId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(218777796) + buffer.appendInt32(-468934396) userId.serialize(buffer, true) - serializeInt32(maxId, buffer: buffer, boxed: false) + serializeInt64(maxId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.getCommonChats", parameters: [("userId", userId), ("maxId", maxId), ("limit", limit)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) @@ -3240,13 +3310,13 @@ public extension Api { }) } - public static func getAllChats(exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getAllChats(exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-341307408) + buffer.appendInt32(-2023787330) buffer.appendInt32(481674261) buffer.appendInt32(Int32(exceptIds.count)) for item in exceptIds { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "messages.getAllChats", parameters: [("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) @@ -4074,10 +4144,10 @@ public extension Api { }) } - public static func deleteChat(chatId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func deleteChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-2094760687) - serializeInt32(chatId, buffer: buffer, boxed: false) + buffer.appendInt32(1540419152) + serializeInt64(chatId, buffer: buffer, boxed: false) return (FunctionDescription(name: "messages.deleteChat", parameters: [("chatId", chatId)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? @@ -5173,10 +5243,10 @@ public extension Api { }) } - public static func importAuthorization(id: Int32, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func importAuthorization(id: Int64, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-470837741) - serializeInt32(id, buffer: buffer, boxed: false) + buffer.appendInt32(-1518699091) + serializeInt64(id, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) return (FunctionDescription(name: "auth.importAuthorization", parameters: [("id", id), ("bytes", bytes)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) @@ -5250,11 +5320,13 @@ public extension Api { }) } - public static func recoverPassword(code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func recoverPassword(flags: Int32, code: String, newSettings: Api.account.PasswordInputSettings?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1319464594) + buffer.appendInt32(923364464) + serializeInt32(flags, buffer: buffer, boxed: false) serializeString(code, buffer: buffer, boxed: false) - return (FunctionDescription(name: "auth.recoverPassword", parameters: [("code", code)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in + if Int(flags) & Int(1 << 0) != 0 {newSettings!.serialize(buffer, true)} + return (FunctionDescription(name: "auth.recoverPassword", parameters: [("flags", flags), ("code", code), ("newSettings", newSettings)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -5312,15 +5384,15 @@ public extension Api { }) } - public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1313598185) + buffer.appendInt32(-1210022402) serializeInt32(apiId, buffer: buffer, boxed: false) serializeString(apiHash, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(exceptIds.count)) for item in exceptIds { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "auth.exportLoginToken", parameters: [("apiId", apiId), ("apiHash", apiHash), ("exceptIds", exceptIds)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.LoginToken? in let reader = BufferReader(buffer) @@ -5359,6 +5431,20 @@ public extension Api { return result }) } + + public static func checkRecoveryPassword(code: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(221691769) + serializeString(code, buffer: buffer, boxed: false) + return (FunctionDescription(name: "auth.checkRecoveryPassword", parameters: [("code", code)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + let reader = BufferReader(buffer) + var result: Api.Bool? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.Bool + } + return result + }) + } } public struct bots { public static func sendCustomRequest(customMethod: String, params: Api.DataJSON) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { @@ -6460,9 +6546,9 @@ public extension Api { } } public struct account { - public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(1754754159) + buffer.appendInt32(-326762118) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(tokenType, buffer: buffer, boxed: false) serializeString(token, buffer: buffer, boxed: false) @@ -6471,7 +6557,7 @@ public extension Api { buffer.appendInt32(481674261) buffer.appendInt32(Int32(otherUids.count)) for item in otherUids { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "account.registerDevice", parameters: [("flags", flags), ("tokenType", tokenType), ("token", token), ("appSandbox", appSandbox), ("secret", secret), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) @@ -6483,15 +6569,15 @@ public extension Api { }) } - public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int32]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(813089983) + buffer.appendInt32(1779249670) serializeInt32(tokenType, buffer: buffer, boxed: false) serializeString(token, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(otherUids.count)) for item in otherUids { - serializeInt32(item, buffer: buffer, boxed: false) + serializeInt64(item, buffer: buffer, boxed: false) } return (FunctionDescription(name: "account.unregisterDevice", parameters: [("tokenType", tokenType), ("token", token), ("otherUids", otherUids)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) @@ -6978,10 +7064,10 @@ public extension Api { }) } - public static func getAuthorizationForm(botId: Int32, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func getAuthorizationForm(botId: Int64, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-1200903967) - serializeInt32(botId, buffer: buffer, boxed: false) + buffer.appendInt32(-1456907910) + serializeInt64(botId, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false) serializeString(publicKey, buffer: buffer, boxed: false) return (FunctionDescription(name: "account.getAuthorizationForm", parameters: [("botId", botId), ("scope", scope), ("publicKey", publicKey)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.AuthorizationForm? in @@ -6994,10 +7080,10 @@ public extension Api { }) } - public static func acceptAuthorization(botId: Int32, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + public static func acceptAuthorization(botId: Int64, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-419267436) - serializeInt32(botId, buffer: buffer, boxed: false) + buffer.appendInt32(-202552205) + serializeInt64(botId, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false) serializeString(publicKey, buffer: buffer, boxed: false) buffer.appendInt32(481674261) @@ -7502,6 +7588,34 @@ public extension Api { return result }) } + + public static func resetPassword() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1828139493) + + return (FunctionDescription(name: "account.resetPassword", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.ResetPasswordResult? in + let reader = BufferReader(buffer) + var result: Api.account.ResetPasswordResult? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.account.ResetPasswordResult + } + return result + }) + } + + public static func declinePasswordReset() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(1284770294) + + return (FunctionDescription(name: "account.declinePasswordReset", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + let reader = BufferReader(buffer) + var result: Api.Bool? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.Bool + } + return result + }) + } } public struct langpack { public static func getLangPack(langPack: String, langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { diff --git a/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift b/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift index e816f62270..8126468359 100644 --- a/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift +++ b/submodules/TelegramCallsUI/Sources/CallKitIntegration.swift @@ -169,7 +169,7 @@ class CallKitProviderDelegate: NSObject, CXProviderDelegate { func startCall(account: Account, peerId: PeerId, isVideo: Bool, displayTitle: String) { let uuid = UUID() self.currentStartCallAccount = (uuid, account) - let handle = CXHandle(type: .generic, value: "\(peerId.id._internalGetInt32Value())") + let handle = CXHandle(type: .generic, value: "\(peerId.id._internalGetInt64Value())") let startCallAction = CXStartCallAction(call: uuid, handle: handle) startCallAction.contactIdentifier = displayTitle diff --git a/submodules/TelegramCallsUI/Sources/CallRatingController.swift b/submodules/TelegramCallsUI/Sources/CallRatingController.swift index 72ce0d4316..54a6d5e494 100644 --- a/submodules/TelegramCallsUI/Sources/CallRatingController.swift +++ b/submodules/TelegramCallsUI/Sources/CallRatingController.swift @@ -241,7 +241,7 @@ private final class CallRatingAlertContentNode: AlertContentNode { } func rateCallAndSendLogs(account: Account, callId: CallId, starsCount: Int, comment: String, userInitiated: Bool, includeLogs: Bool) -> Signal { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(4244000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(4244000)) let rate = rateCall(account: account, callId: callId, starsCount: Int32(starsCount), comment: comment, userInitiated: userInitiated) if includeLogs { diff --git a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift index f0d671d9ca..232c3e5bd2 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationCallManager.swift @@ -205,8 +205,8 @@ public final class PresentationCallManagerImpl: PresentationCallManager { }) startCallImpl = { [weak self] account, uuid, handle, isVideo in - if let strongSelf = self, let userId = Int32(handle) { - return strongSelf.startCall(account: account, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), isVideo: isVideo, internalId: uuid) + if let strongSelf = self, let userId = Int64(handle) { + return strongSelf.startCall(account: account, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), isVideo: isVideo, internalId: uuid) |> take(1) |> map { result -> Bool in return result diff --git a/submodules/TelegramCore/Sources/Account.swift b/submodules/TelegramCore/Sources/Account.swift index 2782aec531..808361feb3 100644 --- a/submodules/TelegramCore/Sources/Account.swift +++ b/submodules/TelegramCore/Sources/Account.swift @@ -377,8 +377,7 @@ public func twoStepAuthData(_ network: Network) -> Signal map { config -> TwoStepAuthData in switch config { - case let .password(flags, currentAlgo, srpB, srpId, hint, emailUnconfirmedPattern, newAlgo, newSecureAlgo, secureRandom/*, pendingResetDate*/): - let pendingResetDate: Int32? = nil + case let .password(flags, currentAlgo, srpB, srpId, hint, emailUnconfirmedPattern, newAlgo, newSecureAlgo, secureRandom, pendingResetDate): let hasRecovery = (flags & (1 << 0)) != 0 let hasSecureValues = (flags & (1 << 1)) != 0 diff --git a/submodules/TelegramCore/Sources/AccountIntermediateState.swift b/submodules/TelegramCore/Sources/AccountIntermediateState.swift index dcce140d9e..5eb955c0b2 100644 --- a/submodules/TelegramCore/Sources/AccountIntermediateState.swift +++ b/submodules/TelegramCore/Sources/AccountIntermediateState.swift @@ -417,7 +417,7 @@ struct AccountMutableState { switch user { case let .user(_, id, _, _, _, _, _, _, status, _, _, _, _): if let status = status { - presences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))] = status + presences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] = status } break case .userEmpty: diff --git a/submodules/TelegramCore/Sources/AddPeerMember.swift b/submodules/TelegramCore/Sources/AddPeerMember.swift index f58bdc6e24..7ee9f8ec58 100644 --- a/submodules/TelegramCore/Sources/AddPeerMember.swift +++ b/submodules/TelegramCore/Sources/AddPeerMember.swift @@ -18,7 +18,7 @@ public func addGroupMember(account: Account, peerId: PeerId, memberId: PeerId) - return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let memberPeer = transaction.getPeer(memberId), let inputUser = apiInputUser(memberPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.addChatUser(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, fwdLimit: 100)) + return account.network.request(Api.functions.messages.addChatUser(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, fwdLimit: 100)) |> mapError { error -> AddGroupMemberError in switch error.errorDescription { case "USERS_TOO_MUCH": diff --git a/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift b/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift index bb4734b39a..37708f9945 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ApiGroupOrChannel.swift @@ -30,7 +30,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { if let migratedTo = migratedTo { switch migratedTo { case let .inputChannel(channelId, accessHash): - migrationReference = TelegramGroupToChannelMigrationReference(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), accessHash: accessHash) + migrationReference = TelegramGroupToChannelMigrationReference(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), accessHash: accessHash) case .inputChannelEmpty: break case .inputChannelFromMessage: @@ -53,11 +53,11 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { if (flags & Int32(1 << 24)) != 0 { groupFlags.insert(.hasActiveVoiceChat) } - return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), role: role, membership: left ? .Left : .Member, flags: groupFlags, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init(apiBannedRights:)), migrationReference: migrationReference, creationDate: date, version: Int(version)) + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: imageRepresentationsForApiChatPhoto(photo), participantCount: Int(participantsCount), role: role, membership: left ? .Left : .Member, flags: groupFlags, defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init(apiBannedRights:)), migrationReference: migrationReference, creationDate: date, version: Int(version)) case let .chatEmpty(id): - return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: "", photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) case let .chatForbidden(id, title): - return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + return TelegramGroup(id: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), title: title, photo: [], participantCount: 0, role: .member, membership: .Removed, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) case let .channel(flags, id, accessHash, title, username, photo, date, version, restrictionReason, adminRights, bannedRights, defaultBannedRights, _): let isMin = (flags & (1 << 12)) != 0 @@ -129,7 +129,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { } } - return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: version, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init)) + return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, title: title, username: username, photo: imageRepresentationsForApiChatPhoto(photo), creationDate: date, version: version, participationStatus: participationStatus, info: info, flags: channelFlags, restrictionInfo: restrictionInfo, adminRights: adminRights.flatMap(TelegramChatAdminRights.init), bannedRights: bannedRights.flatMap(TelegramChatBannedRights.init), defaultBannedRights: defaultBannedRights.flatMap(TelegramChatBannedRights.init)) case let .channelForbidden(flags, id, accessHash, title, untilDate): let info: TelegramChannelInfo if (flags & Int32(1 << 8)) != 0 { @@ -138,7 +138,7 @@ func parseTelegramGroupOrChannel(chat: Api.Chat) -> Peer? { info = .broadcast(TelegramChannelBroadcastInfo(flags: [])) } - return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)), accessHash: .personal(accessHash), title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil, adminRights: nil, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: untilDate ?? Int32.max), defaultBannedRights: nil) + return TelegramChannel(id: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)), accessHash: .personal(accessHash), title: title, username: nil, photo: [], creationDate: 0, version: 0, participationStatus: .kicked, info: info, flags: TelegramChannelFlags(), restrictionInfo: nil, adminRights: nil, bannedRights: TelegramChatBannedRights(flags: [.banReadMessages], untilDate: untilDate ?? Int32.max), defaultBannedRights: nil) } } diff --git a/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift b/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift index 9f9ffc38f9..f040d7dc31 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ApiUtils.swift @@ -8,11 +8,11 @@ public extension PeerReference { var id: PeerId { switch self { case let .user(id, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) case let .group(id): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)) case let .channel(id, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)) } } } @@ -49,12 +49,12 @@ extension PeerReference { func forceApiInputPeer(_ peer: Peer) -> Api.InputPeer? { switch peer { case let user as TelegramUser: - return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt32Value(), accessHash: user.accessHash?.value ?? 0) + return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt64Value(), accessHash: user.accessHash?.value ?? 0) case let group as TelegramGroup: - return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt32Value()) + return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt64Value()) case let channel as TelegramChannel: if let accessHash = channel.accessHash { - return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -66,12 +66,12 @@ func forceApiInputPeer(_ peer: Peer) -> Api.InputPeer? { func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { switch peer { case let user as TelegramUser where user.accessHash != nil: - return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt32Value(), accessHash: user.accessHash!.value) + return Api.InputPeer.inputPeerUser(userId: user.id.id._internalGetInt64Value(), accessHash: user.accessHash!.value) case let group as TelegramGroup: - return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt32Value()) + return Api.InputPeer.inputPeerChat(chatId: group.id.id._internalGetInt64Value()) case let channel as TelegramChannel: if let accessHash = channel.accessHash { - return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputPeer.inputPeerChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -82,7 +82,7 @@ func apiInputPeer(_ peer: Peer) -> Api.InputPeer? { func apiInputChannel(_ peer: Peer) -> Api.InputChannel? { if let channel = peer as? TelegramChannel, let accessHash = channel.accessHash { - return Api.InputChannel.inputChannel(channelId: channel.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputChannel.inputChannel(channelId: channel.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -90,7 +90,7 @@ func apiInputChannel(_ peer: Peer) -> Api.InputChannel? { func apiInputUser(_ peer: Peer) -> Api.InputUser? { if let user = peer as? TelegramUser, let accessHash = user.accessHash { - return Api.InputUser.inputUser(userId: user.id.id._internalGetInt32Value(), accessHash: accessHash.value) + return Api.InputUser.inputUser(userId: user.id.id._internalGetInt64Value(), accessHash: accessHash.value) } else { return nil } @@ -98,7 +98,7 @@ func apiInputUser(_ peer: Peer) -> Api.InputUser? { func apiInputSecretChat(_ peer: Peer) -> Api.InputEncryptedChat? { if let chat = peer as? TelegramSecretChat { - return Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: chat.accessHash) + return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: chat.accessHash) } else { return nil } diff --git a/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift b/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift index 8964880bd0..d9f69149c1 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/CachedChannelParticipants.swift @@ -199,17 +199,17 @@ extension ChannelParticipant { init(apiParticipant: Api.ChannelParticipant) { switch apiParticipant { case let .channelParticipant(userId, date): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) case let .channelParticipantCreator(_, userId, adminRights, rank): - self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), canBeEditedByAccountPeer: true), rank: rank) + self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), canBeEditedByAccountPeer: true), rank: rank) case let .channelParticipantBanned(flags, userId, restrictedBy, date, bannedRights): let hasLeft = (flags & (1 << 0)) != 0 - let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(restrictedBy)), timestamp: date, isMember: !hasLeft) + let banInfo = ChannelParticipantBannedInfo(rights: TelegramChatBannedRights(apiBannedRights: bannedRights), restrictedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(restrictedBy)), timestamp: date, isMember: !hasLeft) self = .member(id: userId.peerId, invitedAt: date, adminInfo: nil, banInfo: banInfo, rank: nil) case let .channelParticipantAdmin(flags, userId, _, promotedBy, date, adminRights, rank: rank): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedAt: date, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(promotedBy)), canBeEditedByAccountPeer: (flags & (1 << 0)) != 0), banInfo: nil, rank: rank) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: ChannelParticipantAdminInfo(rights: TelegramChatAdminRights(apiAdminRights: adminRights) ?? TelegramChatAdminRights(rights: []), promotedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(promotedBy)), canBeEditedByAccountPeer: (flags & (1 << 0)) != 0), banInfo: nil, rank: rank) case let .channelParticipantSelf(userId, _, date): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedAt: date, adminInfo: nil, banInfo: nil, rank: nil) case let .channelParticipantLeft(userId): self = .member(id: userId.peerId, invitedAt: 0, adminInfo: nil, banInfo: nil, rank: nil) } diff --git a/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift b/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift index c536963ca3..a0ba3ea169 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/CachedGroupParticipants.swift @@ -8,11 +8,11 @@ extension GroupParticipant { init(apiParticipant: Api.ChatParticipant) { switch apiParticipant { case let .chatParticipantCreator(userId): - self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + self = .creator(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) case let .chatParticipantAdmin(userId, inviterId, date): - self = .admin(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)), invitedAt: date) + self = .admin(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)), invitedAt: date) case let .chatParticipant(userId, inviterId, date): - self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)), invitedAt: date) + self = .member(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), invitedBy: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)), invitedAt: date) } } } diff --git a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift index 19efa3f4c5..5b9b202e19 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift @@ -157,14 +157,14 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] { } if let viaBotId = viaBotId { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(viaBotId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(viaBotId))) } if let media = media { switch media { case let .messageMediaContact(_, _, _, _, userId): if userId != 0 { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) } default: break @@ -175,7 +175,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] { for entity in entities { switch entity { case let .messageEntityMentionName(_, _, userId): - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) default: break } @@ -199,27 +199,27 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] { case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled: break case let .messageActionChannelMigrateFrom(_, chatId): - result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))) case let .messageActionChatAddUser(users): for id in users { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))) } case let .messageActionChatCreate(_, users): for id in users { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))) } case let .messageActionChatDeleteUser(userId): - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) case let .messageActionChatJoinedByLink(inviterId): - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId))) case let .messageActionChatMigrateTo(channelId): - result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + result.append(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) case let .messageActionGeoProximityReached(fromId, toId, _): result.append(fromId.peerId) result.append(toId.peerId) case let .messageActionInviteToGroupCall(_, userIds): for id in userIds { - result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))) + result.append(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))) } } @@ -263,7 +263,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI return (TelegramMediaExpiredContent(data: .image), nil) } case let .messageMediaContact(phoneNumber, firstName, lastName, vcard, userId): - let contactPeerId: PeerId? = userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let contactPeerId: PeerId? = userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) let mediaContact = TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: contactPeerId, vCardData: vcard.isEmpty ? nil : vcard) return (mediaContact, nil) case let .messageMediaGeo(geo): @@ -354,7 +354,7 @@ func messageTextEntitiesFromApiEntities(_ entities: [Api.MessageEntity]) -> [Mes case let .messageEntityTextUrl(offset, length, url): result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextUrl(url: url))) case let .messageEntityMentionName(offset, length, userId): - result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextMention(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))))) + result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .TextMention(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))))) case let .messageEntityPhone(offset, length): result.append(MessageTextEntity(range: Int(offset) ..< Int(offset + length), type: .PhoneNumber)) case let .messageEntityCashtag(offset, length): @@ -385,10 +385,10 @@ extension StoreMessage { peerId = chatPeerId.peerId authorId = resolvedFromId case let .peerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) authorId = resolvedFromId case let .peerChannel(channelId): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) authorId = resolvedFromId } @@ -502,7 +502,7 @@ extension StoreMessage { } if let viaBotId = viaBotId { - attributes.append(InlineBotMessageAttribute(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(viaBotId)), title: nil)) + attributes.append(InlineBotMessageAttribute(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(viaBotId)), title: nil)) } if namespace != Namespaces.Message.ScheduledCloud { @@ -561,7 +561,7 @@ extension StoreMessage { recentRepliersPeerIds = nil } - let commentsPeerId = channelId.flatMap { PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value($0)) } + let commentsPeerId = channelId.flatMap { PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value($0)) } attributes.append(ReplyThreadMessageAttribute(count: repliesCount, latestUsers: recentRepliersPeerIds ?? [], commentsPeerId: commentsPeerId, maxMessageId: maxId, maxReadMessageId: readMaxId)) } diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift index d21d94f107..c43c49dc11 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaAction.swift @@ -9,23 +9,23 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe case let .messageActionChannelCreate(title): return TelegramMediaAction(action: .groupCreated(title: title)) case let .messageActionChannelMigrateFrom(title, chatId): - return TelegramMediaAction(action: .channelMigratedFromGroup(title: title, groupId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)))) + return TelegramMediaAction(action: .channelMigratedFromGroup(title: title, groupId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))) case let .messageActionChatAddUser(users): - return TelegramMediaAction(action: .addedMembers(peerIds: users.map({ PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value($0)) }))) + return TelegramMediaAction(action: .addedMembers(peerIds: users.map({ PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) }))) case let .messageActionChatCreate(title, _): return TelegramMediaAction(action: .groupCreated(title: title)) case .messageActionChatDeletePhoto: return TelegramMediaAction(action: .photoUpdated(image: nil)) case let .messageActionChatDeleteUser(userId): - return TelegramMediaAction(action: .removedMembers(peerIds: [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))])) + return TelegramMediaAction(action: .removedMembers(peerIds: [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))])) case let .messageActionChatEditPhoto(photo): return TelegramMediaAction(action: .photoUpdated(image: telegramMediaImageFromApiPhoto(photo))) case let .messageActionChatEditTitle(title): return TelegramMediaAction(action: .titleUpdated(title: title)) case let .messageActionChatJoinedByLink(inviterId): - return TelegramMediaAction(action: .joinedByLink(inviter: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)))) + return TelegramMediaAction(action: .joinedByLink(inviter: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)))) case let .messageActionChatMigrateTo(channelId): - return TelegramMediaAction(action: .groupMigratedToChannel(channelId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)))) + return TelegramMediaAction(action: .groupMigratedToChannel(channelId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)))) case .messageActionHistoryClear: return TelegramMediaAction(action: .historyCleared) case .messageActionPinMessage: @@ -68,7 +68,7 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe switch call { case let .inputGroupCall(id, accessHash): return TelegramMediaAction(action: .inviteToGroupPhoneCall(callId: id, accessHash: accessHash, peerIds: userIds.map { userId in - PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) })) } case let .messageActionSetMessagesTTL(period): diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift index 2d45433129..75d73ea375 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift @@ -36,7 +36,7 @@ extension TelegramMediaPollResults { } self.init(voters: results.flatMap({ $0.map(TelegramMediaPollOptionVoters.init(apiVoters:)) }), totalVoters: totalVoters, recentVoters: recentVoters.flatMap { recentVoters in - return recentVoters.map { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value($0)) } + return recentVoters.map { PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value($0)) } } ?? [], solution: parsedSolution) } } diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift index 83cbbca4f8..d797a5ef1e 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramUser.swift @@ -70,9 +70,9 @@ extension TelegramUser { let restrictionInfo: PeerAccessRestrictionInfo? = restrictionReason.flatMap(PeerAccessRestrictionInfo.init(apiReasons:)) - self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)), accessHash: accessHashValue, firstName: firstName, lastName: lastName, username: username, phone: phone, photo: representations, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags) + self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)), accessHash: accessHashValue, firstName: firstName, lastName: lastName, username: username, phone: phone, photo: representations, botInfo: botInfo, restrictionInfo: restrictionInfo, flags: userFlags) case let .userEmpty(id): - self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)), accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + self.init(id: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)), accessHash: nil, firstName: nil, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) } } diff --git a/submodules/TelegramCore/Sources/Authorization.swift b/submodules/TelegramCore/Sources/Authorization.swift index 834810a6f1..3808504740 100644 --- a/submodules/TelegramCore/Sources/Authorization.swift +++ b/submodules/TelegramCore/Sources/Authorization.swift @@ -374,7 +374,7 @@ public enum PasswordRecoveryError { } public func performPasswordRecovery(accountManager: AccountManager, account: UnauthorizedAccount, code: String, syncContacts: Bool) -> Signal { - return account.network.request(Api.functions.auth.recoverPassword(code: code)) + return account.network.request(Api.functions.auth.recoverPassword(flags: 0, code: code, newSettings: nil)) |> mapError { error -> PasswordRecoveryError in if error.errorDescription.hasPrefix("FLOOD_WAIT") { return .limitExceeded diff --git a/submodules/TelegramCore/Sources/ChannelAdminEventLogs.swift b/submodules/TelegramCore/Sources/ChannelAdminEventLogs.swift index acafdd8af0..a9b0b3c8fa 100644 --- a/submodules/TelegramCore/Sources/ChannelAdminEventLogs.swift +++ b/submodules/TelegramCore/Sources/ChannelAdminEventLogs.swift @@ -220,7 +220,7 @@ public func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: Pe action = .pollStopped(rendered) } case let .channelAdminLogEventActionChangeLinkedChat(prevValue, newValue): - action = .linkedPeerUpdated(previous: prevValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(prevValue))], updated: newValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(newValue))]) + action = .linkedPeerUpdated(previous: prevValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(prevValue))], updated: newValue == 0 ? nil : peers[PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(newValue))]) case let .channelAdminLogEventActionChangeLocation(prevValue, newValue): action = .changeGeoLocation(previous: PeerGeoLocation(apiLocation: prevValue), updated: PeerGeoLocation(apiLocation: newValue)) case let .channelAdminLogEventActionToggleSlowMode(prevValue, newValue): @@ -251,7 +251,7 @@ public func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: Pe case let .channelAdminLogEventActionChangeHistoryTTL(prevValue, newValue): action = .changeHistoryTTL(previousValue: prevValue, updatedValue: newValue) } - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) if let action = action { events.append(AdminLogEvent(id: id, peerId: peerId, date: date, action: action)) } diff --git a/submodules/TelegramCore/Sources/ChannelAdmins.swift b/submodules/TelegramCore/Sources/ChannelAdmins.swift index 105e7070a8..82ee34ae97 100644 --- a/submodules/TelegramCore/Sources/ChannelAdmins.swift +++ b/submodules/TelegramCore/Sources/ChannelAdmins.swift @@ -63,9 +63,9 @@ public func channelAdminIds(postbox: Postbox, network: Network, peerId: PeerId, return participants.contains(where: { participant in switch participant { case let .channelParticipantAdmin(_, userId, _, _, _, _, _): - return user.peerId.id._internalGetInt32Value() == userId + return user.peerId.id._internalGetInt64Value() == userId case let .channelParticipantCreator(_, userId, _, _): - return user.peerId.id._internalGetInt32Value() == userId + return user.peerId.id._internalGetInt64Value() == userId default: return false } diff --git a/submodules/TelegramCore/Sources/ChatListFiltering.swift b/submodules/TelegramCore/Sources/ChatListFiltering.swift index c2061ac38b..05a4c0cf1d 100644 --- a/submodules/TelegramCore/Sources/ChatListFiltering.swift +++ b/submodules/TelegramCore/Sources/ChatListFiltering.swift @@ -298,22 +298,22 @@ extension ChatListFilter { includePeers: ChatListFilterIncludePeers(rawPeers: includePeers.compactMap { peer -> PeerId? in switch peer { case let .inputPeerUser(userId, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: return nil } }, rawPinnedPeers: pinnedPeers.compactMap { peer -> PeerId? in switch peer { case let .inputPeerUser(userId, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: return nil } @@ -321,11 +321,11 @@ extension ChatListFilter { excludePeers: excludePeers.compactMap { peer -> PeerId? in switch peer { case let .inputPeerUser(userId, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: return nil } @@ -426,11 +426,11 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net var peerId: PeerId? switch peer { case let .inputPeerUser(userId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: break } @@ -446,11 +446,11 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net var peerId: PeerId? switch peer { case let .inputPeerUser(userId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .inputPeerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .inputPeerChannel(channelId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: break } @@ -471,7 +471,7 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net var missingUsers: [Api.InputUser] = [] var missingChannels: [Api.InputChannel] = [] - var missingGroups: [Int32] = [] + var missingGroups: [Int64] = [] for peer in missingPeers { switch peer { case let .inputPeerUser(userId, accessHash): diff --git a/submodules/TelegramCore/Sources/ContactManagement.swift b/submodules/TelegramCore/Sources/ContactManagement.swift index 944e33db9e..c614a0eda8 100644 --- a/submodules/TelegramCore/Sources/ContactManagement.swift +++ b/submodules/TelegramCore/Sources/ContactManagement.swift @@ -39,7 +39,7 @@ private func updatedRemoteContactPeers(network: Network, hash: Int32) -> Signal< } } -private func hashForCountAndIds(count: Int32, ids: [Int32]) -> Int32 { +private func hashForCountAndIds(count: Int32, ids: [Int64]) -> Int32 { var acc: Int64 = 0 acc = (acc &* 20261) &+ Int64(count) @@ -56,7 +56,7 @@ func syncContactsOnce(network: Network, postbox: Postbox, accountPeerId: PeerId) let contactPeerIds = transaction.getContactPeerIds() let totalCount = transaction.getRemoteContactCount() let peerIds = Set(contactPeerIds.filter({ $0.namespace == Namespaces.Peer.CloudUser })) - return hashForCountAndIds(count: totalCount, ids: peerIds.map({ $0.id._internalGetInt32Value() }).sorted()) + return hashForCountAndIds(count: totalCount, ids: peerIds.map({ $0.id._internalGetInt64Value() }).sorted()) } let updatedPeers = initialContactPeerIdsHash diff --git a/submodules/TelegramCore/Sources/ExportedInvitation.swift b/submodules/TelegramCore/Sources/ExportedInvitation.swift index 48b008b36c..5f2503f3df 100644 --- a/submodules/TelegramCore/Sources/ExportedInvitation.swift +++ b/submodules/TelegramCore/Sources/ExportedInvitation.swift @@ -8,7 +8,7 @@ extension ExportedInvitation { init(apiExportedInvite: Api.ExportedChatInvite) { switch apiExportedInvite { case let .chatInviteExported(flags, link, adminId, date, startDate, expireDate, usageLimit, usage): - self = ExportedInvitation(link: link, isPermanent: (flags & (1 << 5)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage) + self = ExportedInvitation(link: link, isPermanent: (flags & (1 << 5)) != 0, isRevoked: (flags & (1 << 0)) != 0, adminId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), date: date, startDate: startDate, expireDate: expireDate, usageLimit: usageLimit, count: usage) } } } diff --git a/submodules/TelegramCore/Sources/GroupReturnAndLeft.swift b/submodules/TelegramCore/Sources/GroupReturnAndLeft.swift index 5073e42342..452366babe 100644 --- a/submodules/TelegramCore/Sources/GroupReturnAndLeft.swift +++ b/submodules/TelegramCore/Sources/GroupReturnAndLeft.swift @@ -9,7 +9,7 @@ public func returnGroup(account: Account, peerId: PeerId) -> Signal take(1) |> mapToSignal { peer -> Signal in if let inputUser = apiInputUser(peer) { - return account.network.request(Api.functions.messages.addChatUser(chatId: peerId.id._internalGetInt32Value(), userId: inputUser, fwdLimit: 50)) + return account.network.request(Api.functions.messages.addChatUser(chatId: peerId.id._internalGetInt64Value(), userId: inputUser, fwdLimit: 50)) |> retryRequest |> mapToSignal { updates -> Signal in account.stateManager.addUpdates(updates) @@ -26,7 +26,7 @@ public func leftGroup(account: Account, peerId: PeerId) -> Signal |> take(1) |> mapToSignal { peer -> Signal in if let inputUser = apiInputUser(peer) { - return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peerId.id._internalGetInt32Value(), userId: inputUser)) + return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peerId.id._internalGetInt64Value(), userId: inputUser)) |> retryRequest |> mapToSignal { updates -> Signal in account.stateManager.addUpdates(updates) diff --git a/submodules/TelegramCore/Sources/GroupsInCommon.swift b/submodules/TelegramCore/Sources/GroupsInCommon.swift index 53a5450cad..91dce5ae96 100644 --- a/submodules/TelegramCore/Sources/GroupsInCommon.swift +++ b/submodules/TelegramCore/Sources/GroupsInCommon.swift @@ -58,7 +58,7 @@ private final class GroupsInCommonContextImpl { guard let inputUser = inputUser else { return .single(([], 0)) } - return network.request(Api.functions.messages.getCommonChats(userId: inputUser, maxId: maxId?._internalGetInt32Value() ?? 0, limit: limit)) + return network.request(Api.functions.messages.getCommonChats(userId: inputUser, maxId: maxId?._internalGetInt64Value() ?? 0, limit: limit)) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/HistoryViewStateValidation.swift b/submodules/TelegramCore/Sources/HistoryViewStateValidation.swift index 9dfa747529..06b9f0669f 100644 --- a/submodules/TelegramCore/Sources/HistoryViewStateValidation.swift +++ b/submodules/TelegramCore/Sources/HistoryViewStateValidation.swift @@ -403,6 +403,21 @@ private func hashForScheduledMessages(_ messages: [Message]) -> Int32 { return Int32(bitPattern: acc & UInt32(0x7FFFFFFF)) } +public func combineInt32Hash(_ acc: inout UInt32, with value: UInt32) { + acc = (acc &* 20261) &+ value +} + +public func combineInt32Hash(_ acc: inout UInt32, with peerId: PeerId) { + let value = UInt64(bitPattern: peerId.id._internalGetInt64Value()) + let highBits = value >> 32 + let lowBits = value & 0xffffffff + var acc = acc + if highBits != 0 { + combineInt32Hash(&acc, with: UInt32(highBits)) + } + combineInt32Hash(&acc, with: UInt32(lowBits)) +} + private func hashForMessages(_ messages: [Message], withChannelIds: Bool) -> Int32 { var acc: UInt32 = 0 @@ -410,7 +425,7 @@ private func hashForMessages(_ messages: [Message], withChannelIds: Bool) -> Int for message in sorted { if withChannelIds { - acc = (acc &* 20261) &+ UInt32(message.id.peerId.id._internalGetInt32Value()) + combineInt32Hash(&acc, with: message.id.peerId) } acc = (acc &* 20261) &+ UInt32(message.id.id) @@ -435,7 +450,7 @@ private func hashForMessages(_ messages: [StoreMessage], withChannelIds: Bool) - for message in messages { if case let .Id(id) = message.id { if withChannelIds { - acc = (acc &* 20261) &+ UInt32(id.peerId.id._internalGetInt32Value()) + combineInt32Hash(&acc, with: id.peerId) } acc = (acc &* 20261) &+ UInt32(id.id) var timestamp = message.timestamp diff --git a/submodules/TelegramCore/Sources/InvitationLinks.swift b/submodules/TelegramCore/Sources/InvitationLinks.swift index 32e6a8cbf4..1bb8d95165 100644 --- a/submodules/TelegramCore/Sources/InvitationLinks.swift +++ b/submodules/TelegramCore/Sources/InvitationLinks.swift @@ -654,12 +654,12 @@ final class CachedPeerInvitationImporters: PostboxCoding { self.peerIds = decoder.decodeInt64ArrayForKey("peerIds").map(PeerId.init) var dates: [PeerId: Int32] = [:] - let datesArray = decoder.decodeInt32ArrayForKey("dates") + let datesArray = decoder.decodeInt64ArrayForKey("dates") for index in stride(from: 0, to: datesArray.endIndex, by: 2) { let userId = datesArray[index] let date = datesArray[index + 1] - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) - dates[peerId] = date + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) + dates[peerId] = Int32(clamping: date) } self.dates = dates @@ -669,12 +669,12 @@ final class CachedPeerInvitationImporters: PostboxCoding { public func encode(_ encoder: PostboxEncoder) { encoder.encodeInt64Array(self.peerIds.map { $0.toInt64() }, forKey: "peerIds") - var dates: [Int32] = [] + var dates: [Int64] = [] for (peerId, date) in self.dates { - dates.append(peerId.id._internalGetInt32Value()) - dates.append(date) + dates.append(peerId.id._internalGetInt64Value()) + dates.append(Int64(date)) } - encoder.encodeInt32Array(dates, forKey: "dates") + encoder.encodeInt64Array(dates, forKey: "dates") encoder.encodeInt32(self.count, forKey: "count") } @@ -791,7 +791,7 @@ private final class PeerInvitationImportersContextImpl { let date: Int32 switch importer { case let .chatInviteImporter(userId, dateValue): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) date = dateValue } if let peer = transaction.getPeer(peerId) { @@ -911,7 +911,7 @@ public func peerExportedInvitationsCreators(account: Account, peerId: PeerId) -> for admin in admins { switch admin { case let .chatAdminWithInvites(adminId, invitesCount, revokedInvitesCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)) if let peer = peersMap[peerId], peerId != account.peerId { creators.append(ExportedInvitationCreator(peer: RenderedPeer(peer: peer), count: invitesCount, revokedCount: revokedInvitesCount)) } diff --git a/submodules/TelegramCore/Sources/NotificationExceptionsList.swift b/submodules/TelegramCore/Sources/NotificationExceptionsList.swift index 1210a78445..cf27345ec7 100644 --- a/submodules/TelegramCore/Sources/NotificationExceptionsList.swift +++ b/submodules/TelegramCore/Sources/NotificationExceptionsList.swift @@ -49,11 +49,11 @@ public func notificationExceptionsList(postbox: Postbox, network: Network) -> Si let peerId: PeerId switch notifyPeer { case let .peerUser(userId): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .peerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .peerChannel(channelId): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) } settings[peerId] = TelegramPeerNotificationSettings(apiSettings: notifySettings) default: diff --git a/submodules/TelegramCore/Sources/PeerAdmins.swift b/submodules/TelegramCore/Sources/PeerAdmins.swift index 5f9c1f3f3f..db12ab124d 100644 --- a/submodules/TelegramCore/Sources/PeerAdmins.swift +++ b/submodules/TelegramCore/Sources/PeerAdmins.swift @@ -14,7 +14,7 @@ public func removeGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let adminPeer = transaction.getPeer(adminId), let inputUser = apiInputUser(adminPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, isAdmin: .boolFalse)) + return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, isAdmin: .boolFalse)) |> mapError { _ -> RemoveGroupAdminError in return .generic } |> mapToSignal { result -> Signal in return account.postbox.transaction { transaction -> Void in @@ -62,7 +62,7 @@ public func addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) -> return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let adminPeer = transaction.getPeer(adminId), let inputUser = apiInputUser(adminPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, isAdmin: .boolTrue)) + return account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, isAdmin: .boolTrue)) |> `catch` { error -> Signal in if error.errorDescription == "USER_NOT_PARTICIPANT" { return addGroupMember(account: account, peerId: peerId, memberId: adminId) @@ -73,7 +73,7 @@ public func addGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId) -> return .complete() } |> then( - account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt32Value(), userId: inputUser, isAdmin: .boolTrue)) + account.network.request(Api.functions.messages.editChatAdmin(chatId: group.id.id._internalGetInt64Value(), userId: inputUser, isAdmin: .boolTrue)) |> mapError { error -> AddGroupAdminError in return .generic } diff --git a/submodules/TelegramCore/Sources/PeerPhotoUpdater.swift b/submodules/TelegramCore/Sources/PeerPhotoUpdater.swift index a5eb6c5ccf..1b787357bb 100644 --- a/submodules/TelegramCore/Sources/PeerPhotoUpdater.swift +++ b/submodules/TelegramCore/Sources/PeerPhotoUpdater.swift @@ -214,7 +214,7 @@ public func updatePeerPhotoInternal(postbox: Postbox, network: Network, stateMan let request: Signal if let peer = peer as? TelegramGroup { - request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt32Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp))) + request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp))) } else if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) { request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatUploadedPhoto(flags: flags, file: file, video: videoFile, videoStartTs: videoStartTimestamp))) } else { @@ -302,7 +302,7 @@ public func updatePeerPhotoInternal(postbox: Postbox, network: Network, stateMan } else { let request: Signal if let peer = peer as? TelegramGroup { - request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt32Value(), photo: .inputChatPhotoEmpty)) + request = network.request(Api.functions.messages.editChatPhoto(chatId: peer.id.id._internalGetInt64Value(), photo: .inputChatPhotoEmpty)) } else if let peer = peer as? TelegramChannel, let inputChannel = apiInputChannel(peer) { request = network.request(Api.functions.channels.editPhoto(channel: inputChannel, photo: .inputChatPhotoEmpty)) } else { diff --git a/submodules/TelegramCore/Sources/PeerStatistics.swift b/submodules/TelegramCore/Sources/PeerStatistics.swift index 21726144ca..6ee8997486 100644 --- a/submodules/TelegramCore/Sources/PeerStatistics.swift +++ b/submodules/TelegramCore/Sources/PeerStatistics.swift @@ -1065,7 +1065,7 @@ extension GroupStatsTopPoster { init(apiStatsGroupTopPoster: Api.StatsGroupTopPoster) { switch apiStatsGroupTopPoster { case let .statsGroupTopPoster(userId, messages, avgChars): - self = GroupStatsTopPoster(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), messageCount: messages, averageChars: avgChars) + self = GroupStatsTopPoster(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), messageCount: messages, averageChars: avgChars) } } } @@ -1074,7 +1074,7 @@ extension GroupStatsTopAdmin { init(apiStatsGroupTopAdmin: Api.StatsGroupTopAdmin) { switch apiStatsGroupTopAdmin { case let .statsGroupTopAdmin(userId, deleted, kicked, banned): - self = GroupStatsTopAdmin(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), deletedCount: deleted, kickedCount: kicked, bannedCount: banned) + self = GroupStatsTopAdmin(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), deletedCount: deleted, kickedCount: kicked, bannedCount: banned) } } } @@ -1083,7 +1083,7 @@ extension GroupStatsTopInviter { init(apiStatsGroupTopInviter: Api.StatsGroupTopInviter) { switch apiStatsGroupTopInviter { case let .statsGroupTopInviter(userId, invitations): - self = GroupStatsTopInviter(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), inviteCount: invitations) + self = GroupStatsTopInviter(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), inviteCount: invitations) } } } diff --git a/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift b/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift index 16831f3f70..60cf43ae4b 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/StandaloneUploadedMedia.swift @@ -87,7 +87,7 @@ public func standaloneUploadedImage(account: Account, peerId: PeerId, text: Stri case let .inputSecretFile(file, _, key): return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in if let peer = transaction.getPeer(peerId) as? TelegramSecretChat { - return Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash) + return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash) } return nil } @@ -181,7 +181,7 @@ public func standaloneUploadedFile(account: Account, peerId: PeerId, text: Strin case let .inputSecretFile(file, _, key): return account.postbox.transaction { transaction -> Api.InputEncryptedChat? in if let peer = transaction.getPeer(peerId) as? TelegramSecretChat { - return Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash) + return Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash) } return nil } diff --git a/submodules/TelegramCore/Sources/Polls.swift b/submodules/TelegramCore/Sources/Polls.swift index b8228f08e5..f01fa7ac56 100644 --- a/submodules/TelegramCore/Sources/Polls.swift +++ b/submodules/TelegramCore/Sources/Polls.swift @@ -286,11 +286,11 @@ private final class PollResultsOptionContext { let peerId: PeerId switch vote { case let .messageUserVote(userId, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .messageUserVoteInputOption(userId, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .messageUserVoteMultiple(userId, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) } if let peer = transaction.getPeer(peerId) { resultPeers.append(RenderedPeer(peer: peer)) diff --git a/submodules/TelegramCore/Sources/RecentWebSessions.swift b/submodules/TelegramCore/Sources/RecentWebSessions.swift index e881ca75d1..064a14b19e 100644 --- a/submodules/TelegramCore/Sources/RecentWebSessions.swift +++ b/submodules/TelegramCore/Sources/RecentWebSessions.swift @@ -32,7 +32,7 @@ public func webSessions(network: Network) -> Signal<([WebAuthorization], [PeerId for authorization in authorizations { switch authorization { case let .webAuthorization(hash, botId, domain, browser, platform, dateCreated, dateActive, ip, region): - sessions.append(WebAuthorization(hash: hash, botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), domain: domain, browser: browser, platform: platform, dateCreated: dateCreated, dateActive: dateActive, ip: ip, region: region)) + sessions.append(WebAuthorization(hash: hash, botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), domain: domain, browser: browser, platform: platform, dateCreated: dateCreated, dateActive: dateActive, ip: ip, region: region)) } } diff --git a/submodules/TelegramCore/Sources/RegisterNotificationToken.swift b/submodules/TelegramCore/Sources/RegisterNotificationToken.swift index 5d6ee65829..401e4706ee 100644 --- a/submodules/TelegramCore/Sources/RegisterNotificationToken.swift +++ b/submodules/TelegramCore/Sources/RegisterNotificationToken.swift @@ -18,7 +18,7 @@ public func unregisterNotificationToken(account: Account, token: Data, type: Not case .voip: mappedType = 9 } - return account.network.request(Api.functions.account.unregisterDevice(tokenType: mappedType, token: hexString(token), otherUids: otherAccountUserIds.map({ $0._internalGetInt32Value() }))) + return account.network.request(Api.functions.account.unregisterDevice(tokenType: mappedType, token: hexString(token), otherUids: otherAccountUserIds.map({ $0._internalGetInt64Value() }))) |> retryRequest |> ignoreValues } @@ -42,7 +42,7 @@ public func registerNotificationToken(account: Account, token: Data, type: Notif if excludeMutedChats { flags |= 1 << 0 } - return account.network.request(Api.functions.account.registerDevice(flags: flags, tokenType: mappedType, token: hexString(token), appSandbox: sandbox ? .boolTrue : .boolFalse, secret: Buffer(data: keyData), otherUids: otherAccountUserIds.map({ $0._internalGetInt32Value() }))) + return account.network.request(Api.functions.account.registerDevice(flags: flags, tokenType: mappedType, token: hexString(token), appSandbox: sandbox ? .boolTrue : .boolFalse, secret: Buffer(data: keyData), otherUids: otherAccountUserIds.map({ $0._internalGetInt64Value() }))) |> retryRequest |> ignoreValues } diff --git a/submodules/TelegramCore/Sources/RemovePeerMember.swift b/submodules/TelegramCore/Sources/RemovePeerMember.swift index 1e052b1659..a84fc4562f 100644 --- a/submodules/TelegramCore/Sources/RemovePeerMember.swift +++ b/submodules/TelegramCore/Sources/RemovePeerMember.swift @@ -17,7 +17,7 @@ public func removePeerMember(account: Account, peerId: PeerId, memberId: PeerId) return account.postbox.transaction { transaction -> Signal in if let peer = transaction.getPeer(peerId), let memberPeer = transaction.getPeer(memberId), let inputUser = apiInputUser(memberPeer) { if let group = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: group.id.id._internalGetInt32Value(), userId: inputUser)) + return account.network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: group.id.id._internalGetInt64Value(), userId: inputUser)) |> mapError { error -> Void in return Void() } diff --git a/submodules/TelegramCore/Sources/ReportPeer.swift b/submodules/TelegramCore/Sources/ReportPeer.swift index 34cb965184..bc413ebf30 100644 --- a/submodules/TelegramCore/Sources/ReportPeer.swift +++ b/submodules/TelegramCore/Sources/ReportPeer.swift @@ -10,7 +10,7 @@ public func reportPeer(account: Account, peerId: PeerId) -> Signal Signal in if let peer = transaction.getPeer(peerId) { if let peer = peer as? TelegramSecretChat { - return account.network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash))) + return account.network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift b/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift index 6977f48dad..152524a10e 100644 --- a/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift +++ b/submodules/TelegramCore/Sources/SecretChats/SecretChatIncomingEncryptedOperation.swift @@ -17,9 +17,9 @@ extension SecretChatIncomingEncryptedOperation { convenience init(message: Api.EncryptedMessage) { switch message { case let .encryptedMessage(randomId, chatId, date, bytes, file): - self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), globallyUniqueId: randomId, timestamp: date, type: .message, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: SecretChatFileReference(file)) + self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))), globallyUniqueId: randomId, timestamp: date, type: .message, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: SecretChatFileReference(file)) case let .encryptedMessageService(randomId, chatId, date, bytes): - self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), globallyUniqueId: randomId, timestamp: date, type: .service, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: nil) + self.init(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))), globallyUniqueId: randomId, timestamp: date, type: .service, keyFingerprint: keyFingerprintFromBytes(bytes), contents: MemoryBuffer(bytes), mediaFileReference: nil) } } } diff --git a/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift b/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift index b3bcc86e9f..afc1153d24 100644 --- a/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift +++ b/submodules/TelegramCore/Sources/SecretChats/UpdateSecretChat.swift @@ -19,7 +19,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee assert((currentPeer == nil) == (currentState == nil)) switch chat { case let .encryptedChat(_, _, _, adminId, _, gAOrB, remoteKeyFingerprint): - if let currentPeer = currentPeer, let currentState = currentState, adminId == accountPeerId.id._internalGetInt32Value() { + if let currentPeer = currentPeer, let currentState = currentState, adminId == accountPeerId.id._internalGetInt64Value() { if case let .handshake(handshakeState) = currentState.embeddedState, case let .requested(_, p, a) = handshakeState { let pData = p.makeData() let aData = a.makeData() @@ -88,7 +88,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee case .encryptedChatEmpty(_): break case let .encryptedChatRequested(_, folderId, _, accessHash, date, adminId, participantId, gA): - if currentPeer == nil && participantId == accountPeerId.id._internalGetInt32Value() { + if currentPeer == nil && participantId == accountPeerId.id._internalGetInt64Value() { if settings.acceptOnThisDevice { let state = SecretChatState(role: .participant, embeddedState: .handshake(.accepting), keychain: SecretChatKeychain(keys: []), keyFingerprint: nil, messageAutoremoveTimeout: nil) @@ -99,7 +99,7 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee let updatedState = addSecretChatOutgoingOperation(transaction: transaction, peerId: chat.peerId, operation: .initialHandshakeAccept(gA: MemoryBuffer(gA), accessHash: accessHash, b: b), state: state) transaction.setPeerChatState(chat.peerId, state: updatedState) - let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)), accessHash: accessHash, role: updatedState.role, embeddedState: updatedState.embeddedState.peerState, messageAutoremoveTimeout: nil) + let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), accessHash: accessHash, role: updatedState.role, embeddedState: updatedState.embeddedState.peerState, messageAutoremoveTimeout: nil) updatePeers(transaction: transaction, peers: [peer], update: { _, updated in return updated }) if folderId != nil { transaction.updatePeerChatListInclusion(peer.id, inclusion: .ifHasMessagesOrOneOf(groupId: Namespaces.PeerGroup.archive, pinningIndex: nil, minTimestamp: date)) @@ -122,9 +122,9 @@ func updateSecretChat(encryptionProvider: EncryptionProvider, accountPeerId: Pee Logger.shared.log("State", "got encryptedChatRequested, but peer already exists or this account is creator") } case let .encryptedChatWaiting(_, accessHash, date, adminId, participantId): - if let requestData = requestData, currentPeer == nil && adminId == accountPeerId.id._internalGetInt32Value() { + if let requestData = requestData, currentPeer == nil && adminId == accountPeerId.id._internalGetInt64Value() { let state = SecretChatState(role: .creator, embeddedState: .handshake(.requested(g: requestData.g, p: requestData.p, a: requestData.a)), keychain: SecretChatKeychain(keys: []), keyFingerprint: nil, messageAutoremoveTimeout: nil) - let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(participantId)), accessHash: accessHash, role: state.role, embeddedState: state.embeddedState.peerState, messageAutoremoveTimeout: nil) + let peer = TelegramSecretChat(id: chat.peerId, creationDate: date, regularPeerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(participantId)), accessHash: accessHash, role: state.role, embeddedState: state.embeddedState.peerState, messageAutoremoveTimeout: nil) updatePeers(transaction: transaction, peers: [peer], update: { _, updated in return updated }) transaction.setPeerChatState(peer.id, state: state) transaction.resetIncomingReadStates([peer.id: [ diff --git a/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift b/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift index 3f44df44b3..c2e460d750 100644 --- a/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift +++ b/submodules/TelegramCore/Sources/Settings/PrivacySettings.swift @@ -162,7 +162,7 @@ extension SelectivePrivacySettings { current = .enableContacts(enableFor: [:], disableFor: [:]) case let .privacyValueAllowUsers(users): for id in users { - if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))] { + if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] { enableFor[peer.peer.id] = peer } } @@ -172,13 +172,13 @@ extension SelectivePrivacySettings { break case let .privacyValueDisallowUsers(users): for id in users { - if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id))] { + if let peer = peers[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))] { disableFor[peer.peer.id] = peer } } case let .privacyValueAllowChatParticipants(chats): for id in chats { - for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id))] { + for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))] { if let peer = peers[possibleId] { enableFor[peer.peer.id] = peer } @@ -186,7 +186,7 @@ extension SelectivePrivacySettings { } case let .privacyValueDisallowChatParticipants(chats): for id in chats { - for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id))] { + for possibleId in [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)), PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id))] { if let peer = peers[possibleId] { disableFor[peer.peer.id] = peer } diff --git a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift index b604c6b532..9b333b10a3 100644 --- a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift +++ b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift @@ -23,7 +23,7 @@ private func peerIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set { } switch group { case let .updateChannelPts(channelId, _, _): - peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) default: break } @@ -77,7 +77,7 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update]) } switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) peerIds.insert(peerId) case let .updateFolderPeers(folderPeers, _, _): for peer in folderPeers { @@ -87,7 +87,7 @@ private func peerIdsRequiringLocalChatStateFromUpdates(_ updates: [Api.Update]) } } case let .updateReadChannelInbox(_, _, channelId, _, _, _): - peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + peerIds.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) case let .updateReadHistoryInbox(_, _, peer, _, _, _, _): peerIds.insert(peer.peerId) case let .updateDraftMessage(peer, draft): @@ -114,7 +114,7 @@ private func peerIdsRequiringLocalChatStateFromUpdateGroups(_ groups: [UpdateGro for update in group.updates { switch update { case let .updateChannel(channelId): - channelUpdates.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + channelUpdates.insert(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) default: break } @@ -147,7 +147,7 @@ private func locallyGeneratedMessageTimestampsFromUpdateGroups(_ groups: [Update switch update { case let .updateServiceNotification(_, date, _, _, _, _): if let date = date { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) if messageTimestamps[peerId] == nil { messageTimestamps[peerId] = [(Namespaces.Message.Local, date)] } else { @@ -303,7 +303,7 @@ private func peerIdsRequiringLocalChatStateFromDifference(_ difference: Api.upda } switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) peerIds.insert(peerId) default: break @@ -325,7 +325,7 @@ private func peerIdsRequiringLocalChatStateFromDifference(_ difference: Api.upda } switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) peerIds.insert(peerId) default: break @@ -358,7 +358,7 @@ private func locallyGeneratedMessageTimestampsFromDifference(_ difference: Api.u switch update { case let .updateServiceNotification(_, date, _, _, _, _): if let date = date { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) if messageTimestamps[peerId] == nil { messageTimestamps[peerId] = [(Namespaces.Message.Local, date)] } else { @@ -684,21 +684,21 @@ private func sortedUpdates(_ updates: [Api.Update]) -> [Api.Update] { for update in updates { switch update { case let .updateChannelTooLong(_, channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { updatesByChannel[peerId]!.append(update) } case let .updateDeleteChannelMessages(channelId, _, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { updatesByChannel[peerId]!.append(update) } case let .updatePinnedChannelMessages(_, channelId, _, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { @@ -725,14 +725,14 @@ private func sortedUpdates(_ updates: [Api.Update]) -> [Api.Update] { otherUpdates.append(update) } case let .updateChannelWebPage(channelId, _, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { updatesByChannel[peerId]!.append(update) } case let .updateChannelAvailableMessages(channelId, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if updatesByChannel[peerId] == nil { updatesByChannel[peerId] = [update] } else { @@ -817,7 +817,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo for update in sortedUpdates(updates) { switch update { case let .updateChannelTooLong(_, channelId, channelPts): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if !channelsToPoll.contains(peerId) { if let channelPts = channelPts, let channelState = state.channelStates[peerId], channelState.pts >= channelPts { Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip updateChannelTooLong by pts") @@ -826,7 +826,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } } case let .updateDeleteChannelMessages(channelId, messages, pts: pts, ptsCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old delete update") @@ -877,7 +877,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo Logger.shared.log("State", "Invalid updateEditChannelMessage") } case let .updateChannelWebPage(channelId, apiWebpage, pts, ptsCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { } else if previousState.pts + ptsCount == pts { @@ -903,7 +903,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } } case let .updateChannelAvailableMessages(channelId, minId): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) updatedState.updateMinAvailableMessage(MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: minId)) case let .updateDeleteMessages(messages, _, _): updatedState.deleteMessagesWithGlobalIds(messages) @@ -980,7 +980,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo if popup { updatedState.addDisplayAlert(text, isDropAuth: type.hasPrefix("AUTH_KEY_DROP_")) } else if let date = date { - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000)) if updatedState.peers[peerId] == nil { updatedState.updatePeer(peerId, { peer in @@ -1029,13 +1029,13 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } } case let .updateReadChannelInbox(_, folderId, channelId, maxId, stillUnreadCount, pts): - updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) + updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) case let .updateReadChannelOutbox(channelId, maxId): - updatedState.readOutbox(MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: maxId), timestamp: nil) + updatedState.readOutbox(MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: maxId), timestamp: nil) case let .updateChannel(channelId): - updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))) + updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))) case let .updateChat(chatId): - updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))) + updatedState.addExternallyUpdatedPeerId(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))) case let .updateReadHistoryInbox(_, folderId, peer, maxId, stillUnreadCount, pts, _): updatedState.resetIncomingReadState(groupId: PeerGroupId(rawValue: folderId ?? 0), peerId: peer.peerId, namespace: Namespaces.Message.Cloud, maxIncomingReadId: maxId, count: stillUnreadCount, pts: pts) case let .updateReadHistoryOutbox(peer, maxId, _, _): @@ -1043,11 +1043,11 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateReadChannelDiscussionInbox(_, channelId, topMsgId, readMaxId, mainChannelId, mainChannelPost): var mainChannelMessage: MessageId? if let mainChannelId = mainChannelId, let mainChannelPost = mainChannelPost { - mainChannelMessage = MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(mainChannelId)), namespace: Namespaces.Message.Cloud, id: mainChannelPost) + mainChannelMessage = MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(mainChannelId)), namespace: Namespaces.Message.Cloud, id: mainChannelPost) } - updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: true, mainChannelMessage: mainChannelMessage) + updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: true, mainChannelMessage: mainChannelMessage) case let .updateReadChannelDiscussionOutbox(channelId, topMsgId, readMaxId): - updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: false, mainChannelMessage: nil) + updatedState.readThread(threadMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: topMsgId), readMaxId: readMaxId, isIncoming: false, mainChannelMessage: nil) case let .updateDialogUnreadMark(flags, peer): switch peer { case let .dialogPeer(peer): @@ -1081,9 +1081,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo let groupPeerId: PeerId switch participants { case let .chatParticipants(chatId, _, _): - groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .chatParticipantsForbidden(_, chatId, _): - groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) } updatedState.updateCachedPeerData(groupPeerId, { current in let previous: CachedGroupData @@ -1095,9 +1095,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo return previous.withUpdatedParticipants(CachedGroupParticipants(apiParticipants: participants)) }) case let .updateChatParticipantAdd(chatId, userId, inviterId, date, _): - let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) - let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) - let inviterPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)) + let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) + let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) + let inviterPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)) updatedState.updateCachedPeerData(groupPeerId, { current in if let current = current as? CachedGroupData, let participants = current.participants { var updatedParticipants = participants.participants @@ -1110,8 +1110,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateChatParticipantDelete(chatId, userId, _): - let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) - let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) + let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) updatedState.updateCachedPeerData(groupPeerId, { current in if let current = current as? CachedGroupData, let participants = current.participants { var updatedParticipants = participants.participants @@ -1124,8 +1124,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateChatParticipantAdmin(chatId, userId, isAdmin, _): - let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) - let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) + let userPeerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) updatedState.updateCachedPeerData(groupPeerId, { current in if let current = current as? CachedGroupData, let participants = current.participants { var updatedParticipants = participants.participants @@ -1156,12 +1156,12 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updatePinnedChannelMessages(flags, channelId, messages, pts, ptsCount): - let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) if let previousState = updatedState.channelStates[peerId] { if previousState.pts >= pts { Logger.shared.log("State", "channel \(peerId) (\((updatedState.peers[peerId] as? TelegramChannel)?.title ?? "nil")) skip old pinned messages update") } else if previousState.pts + ptsCount == pts { - let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) updatedState.updateMessagesPinned(ids: messages.map { id in MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id) }, pinned: (flags & (1 << 0)) != 0) @@ -1190,10 +1190,10 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo return previous.withUpdatedIsBlocked(blocked == .boolTrue) }) case let .updateUserStatus(userId, status): - updatedState.mergePeerPresences([PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)): status], explicit: true) + updatedState.mergePeerPresences([PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)): status], explicit: true) case let .updateUserName(userId, firstName, lastName, username): //TODO add contact checking for apply first and last name - updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), { peer in + updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), { peer in if let user = peer as? TelegramUser { return user.withUpdatedUsername(username) } else { @@ -1201,7 +1201,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateUserPhoto(userId, _, photo, _): - updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), { peer in + updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), { peer in if let user = peer as? TelegramUser { return user.withUpdatedPhoto(parsedTelegramProfilePhoto(photo)) } else { @@ -1209,7 +1209,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } }) case let .updateUserPhone(userId, phone): - updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), { peer in + updatedState.updatePeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), { peer in if let user = peer as? TelegramUser { return user.withUpdatedPhone(phone.isEmpty ? nil : phone) } else { @@ -1252,7 +1252,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateNewEncryptedMessage(message, _): updatedState.addSecretMessages([message]) case let .updateEncryptedMessagesRead(chatId, maxDate, date): - updatedState.readSecretOutbox(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), timestamp: maxDate, actionTimestamp: date) + updatedState.readSecretOutbox(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(chatId)), timestamp: maxDate, actionTimestamp: date) case let .updateUserTyping(userId, type): if let date = updatesDate, date + 60 > serverTime { let activity = PeerInputActivity(apiType: type, timestamp: date) @@ -1261,7 +1261,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo category = .voiceChat } - updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), category: category), peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), activity: activity) + updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), category: category), peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), activity: activity) } case let .updateChatUserTyping(chatId, userId, type): if let date = updatesDate, date + 60 > serverTime { @@ -1271,11 +1271,11 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo category = .voiceChat } - updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), category: category), peerId: userId.peerId, activity: activity) + updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), category: category), peerId: userId.peerId, activity: activity) } case let .updateChannelUserTyping(_, channelId, topMsgId, userId, type): if let date = updatesDate, date + 60 > serverTime { - let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) let threadId = topMsgId.flatMap { makeMessageThreadId(MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: $0)) } let activity = PeerInputActivity(apiType: type, timestamp: date) @@ -1290,7 +1290,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo } case let .updateEncryptedChatTyping(chatId): if let date = updatesDate, date + 60 > serverTime { - updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)), category: .global), peerId: nil, activity: .typingText) + updatedState.addPeerInputActivity(chatPeerId: PeerActivitySpace(peerId: PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(chatId)), category: .global), peerId: nil, activity: .typingText) } case let .updateDialogPinned(flags, folderId, peer): let groupId: PeerGroupId = folderId.flatMap(PeerGroupId.init(rawValue:)) ?? .root @@ -1325,9 +1325,9 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo case let .updateReadMessagesContents(messages, _, _): updatedState.addReadMessagesContents((nil, messages)) case let .updateChannelReadMessagesContents(channelId, messages): - updatedState.addReadMessagesContents((PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), messages)) + updatedState.addReadMessagesContents((PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), messages)) case let .updateChannelMessageViews(channelId, id, views): - updatedState.addUpdateMessageImpressionCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: id), count: views) + updatedState.addUpdateMessageImpressionCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: id), count: views) /*case let .updateChannelMessageForwards(channelId, id, forwards): updatedState.addUpdateMessageForwardsCount(id: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId), namespace: Namespaces.Message.Cloud, id: id), count: forwards)*/ case let .updateNewStickerSet(stickerset): @@ -1367,8 +1367,8 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo updatedState.updateGroupCallParticipants(id: id, accessHash: accessHash, participants: participants, version: version) } case let .updateGroupCall(channelId, call): - updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), call: call) - updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(channelId)), call: call) + updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), call: call) + updatedState.updateGroupCall(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(channelId)), call: call) case let .updatePeerHistoryTTL(_, peer, ttl): updatedState.updateAutoremoveTimeout(peer: peer, value: CachedPeerAutoremoveTimeout.Value(ttl)) case let .updateLangPackTooLong(langCode): @@ -1959,7 +1959,7 @@ private func pollChannel(network: Network, peer: Peer, state: AccountMutableStat Logger.shared.log("State", "Invalid updateEditChannelMessage") } case let .updatePinnedChannelMessages(flags, channelId, messages, _, _): - let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + let channelPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) updatedState.updateMessagesPinned(ids: messages.map { id in MessageId(peerId: channelPeerId, namespace: Namespaces.Message.Cloud, id: id) }, pinned: (flags & (1 << 0)) != 0) diff --git a/submodules/TelegramCore/Sources/State/AccountViewTracker.swift b/submodules/TelegramCore/Sources/State/AccountViewTracker.swift index 9a91e1f4bd..dc71548147 100644 --- a/submodules/TelegramCore/Sources/State/AccountViewTracker.swift +++ b/submodules/TelegramCore/Sources/State/AccountViewTracker.swift @@ -717,7 +717,7 @@ public final class AccountViewTracker { switch replies { case let .messageReplies(_, repliesCountValue, _, recentRepliers, channelId, maxId, readMaxId): if let channelId = channelId { - commentsChannelId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + commentsChannelId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) } repliesCount = repliesCountValue if let recentRepliers = recentRepliers { diff --git a/submodules/TelegramCore/Sources/State/CallSessionManager.swift b/submodules/TelegramCore/Sources/State/CallSessionManager.swift index afd27413f2..b25a00c884 100644 --- a/submodules/TelegramCore/Sources/State/CallSessionManager.swift +++ b/submodules/TelegramCore/Sources/State/CallSessionManager.swift @@ -820,7 +820,7 @@ private final class CallSessionManagerContext { versions = libraryVersions } if self.contextIdByStableId[id] == nil { - let internalId = self.addIncoming(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(adminId)), stableId: id, accessHash: accessHash, timestamp: date, gAHash: gAHash.makeData(), versions: versions, isVideo: isVideo) + let internalId = self.addIncoming(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(adminId)), stableId: id, accessHash: accessHash, timestamp: date, gAHash: gAHash.makeData(), versions: versions, isVideo: isVideo) if let internalId = internalId { var resultRingingStateValue: CallSessionRingingState? for ringingState in self.ringingStatesValue() { diff --git a/submodules/TelegramCore/Sources/State/ChannelState.swift b/submodules/TelegramCore/Sources/State/ChannelState.swift index effa4e6c62..46264db97b 100644 --- a/submodules/TelegramCore/Sources/State/ChannelState.swift +++ b/submodules/TelegramCore/Sources/State/ChannelState.swift @@ -18,11 +18,11 @@ func channelUpdatesByPeerId(updates: [ChannelUpdate]) -> [PeerId: [ChannelUpdate case let .updateNewChannelMessage(message, _, _): peerId = apiMessagePeerId(message) case let .updateDeleteChannelMessages(channelId, _, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) case let .updateEditChannelMessage(message, _, _): peerId = apiMessagePeerId(message) case let .updateChannelWebPage(channelId, _, _, _): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) default: break } diff --git a/submodules/TelegramCore/Sources/State/ContactSyncManager.swift b/submodules/TelegramCore/Sources/State/ContactSyncManager.swift index b5b4aca039..604bc19ce6 100644 --- a/submodules/TelegramCore/Sources/State/ContactSyncManager.swift +++ b/submodules/TelegramCore/Sources/State/ContactSyncManager.swift @@ -345,7 +345,7 @@ private func pushDeviceContactData(postbox: Postbox, network: Network, contacts: for item in imported { switch item { case let .importedContact(userId, _): - addedContactPeerIds.insert(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))) + addedContactPeerIds.insert(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))) } } for item in retryContacts { @@ -399,7 +399,7 @@ private func updateContactPresences(postbox: Postbox, network: Network, accountP for status in statuses { switch status { case let .contactStatus(userId, status): - peerPresences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] = TelegramUserPresence(apiStatus: status) + peerPresences[PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] = TelegramUserPresence(apiStatus: status) } } updatePeerPresences(transaction: transaction, accountPeerId: accountPeerId, peerPresences: peerPresences) diff --git a/submodules/TelegramCore/Sources/State/FetchChatList.swift b/submodules/TelegramCore/Sources/State/FetchChatList.swift index 1fdf736c59..3f892604b8 100644 --- a/submodules/TelegramCore/Sources/State/FetchChatList.swift +++ b/submodules/TelegramCore/Sources/State/FetchChatList.swift @@ -113,11 +113,11 @@ private func parseDialogs(apiDialogs: [Api.Dialog], apiMessages: [Api.Message], let peerId: PeerId switch apiPeer { case let .peerUser(userId): - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) case let .peerChat(chatId): - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .peerChannel(channelId): - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) } if readStates[peerId] == nil { diff --git a/submodules/TelegramCore/Sources/State/Holes.swift b/submodules/TelegramCore/Sources/State/Holes.swift index 946a9faea0..4aeddbbc2e 100644 --- a/submodules/TelegramCore/Sources/State/Holes.swift +++ b/submodules/TelegramCore/Sources/State/Holes.swift @@ -573,13 +573,13 @@ func fetchMessageHistoryHole(accountPeerId: PeerId, source: FetchMessageHistoryH func groupBoundaryPeer(_ peerId: PeerId, accountPeerId: PeerId) -> Api.Peer { switch peerId.namespace { case Namespaces.Peer.CloudUser: - return Api.Peer.peerUser(userId: peerId.id._internalGetInt32Value()) + return Api.Peer.peerUser(userId: peerId.id._internalGetInt64Value()) case Namespaces.Peer.CloudGroup: - return Api.Peer.peerChat(chatId: peerId.id._internalGetInt32Value()) + return Api.Peer.peerChat(chatId: peerId.id._internalGetInt64Value()) case Namespaces.Peer.CloudChannel: - return Api.Peer.peerChannel(channelId: peerId.id._internalGetInt32Value()) + return Api.Peer.peerChannel(channelId: peerId.id._internalGetInt64Value()) default: - return Api.Peer.peerUser(userId: accountPeerId.id._internalGetInt32Value()) + return Api.Peer.peerUser(userId: accountPeerId.id._internalGetInt64Value()) } } diff --git a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift index eb40e138ec..b24a5d3bf6 100644 --- a/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedCloudChatRemoveMessagesOperations.swift @@ -177,7 +177,7 @@ private func removeMessages(postbox: Postbox, network: Network, stateManager: Ac if let result = result { switch result { case let .affectedMessages(pts, ptsCount): - stateManager.addUpdateGroups([.updateChannelPts(channelId: peer.id.id._internalGetInt32Value(), pts: pts, ptsCount: ptsCount)]) + stateManager.addUpdateGroups([.updateChannelPts(channelId: peer.id.id._internalGetInt64Value(), pts: pts, ptsCount: ptsCount)]) } } return .complete() @@ -267,7 +267,7 @@ private func removeChat(transaction: Transaction, postbox: Postbox, network: Net } else if peer.id.namespace == Namespaces.Peer.CloudGroup { let deleteUser: Signal if operation.deleteGloballyIfPossible { - deleteUser = network.request(Api.functions.messages.deleteChat(chatId: peer.id.id._internalGetInt32Value())) + deleteUser = network.request(Api.functions.messages.deleteChat(chatId: peer.id.id._internalGetInt64Value())) |> `catch` { _ in return .single(.boolFalse) } @@ -275,7 +275,7 @@ private func removeChat(transaction: Transaction, postbox: Postbox, network: Net return .complete() } } else { - deleteUser = network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peer.id.id._internalGetInt32Value(), userId: Api.InputUser.inputUserSelf)) + deleteUser = network.request(Api.functions.messages.deleteChatUser(flags: 0, chatId: peer.id.id._internalGetInt64Value(), userId: Api.InputUser.inputUserSelf)) |> map { result -> Api.Updates? in return result } diff --git a/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift b/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift index c422460cf4..bdc557754c 100644 --- a/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift +++ b/submodules/TelegramCore/Sources/State/ManagedLocalInputActivities.swift @@ -185,7 +185,7 @@ private func requestActivity(postbox: Postbox, network: Network, accountPeerId: } } else if let peer = peer as? TelegramSecretChat, activity == .typingText { let _ = PeerId(peer.id.toInt64()) - return network.request(Api.functions.messages.setEncryptedTyping(peer: .inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash), typing: .boolTrue)) + return network.request(Api.functions.messages.setEncryptedTyping(peer: .inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash), typing: .boolTrue)) |> `catch` { _ -> Signal in return .single(.boolFalse) } diff --git a/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift b/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift index 56262edfa6..d9ae338f10 100644 --- a/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedSecretChatOutgoingOperations.swift @@ -227,7 +227,7 @@ private func initialHandshakeAccept(postbox: Postbox, network: Network, peerId: memcpy(&keyFingerprint, bytes.advanced(by: keyHash.count - 8), 8) } - let result = network.request(Api.functions.messages.acceptEncryption(peer: .inputEncryptedChat(chatId: peerId.id._internalGetInt32Value(), accessHash: accessHash), gB: Buffer(data: gb), keyFingerprint: keyFingerprint)) + let result = network.request(Api.functions.messages.acceptEncryption(peer: .inputEncryptedChat(chatId: Int32(peerId.id._internalGetInt64Value()), accessHash: accessHash), gB: Buffer(data: gb), keyFingerprint: keyFingerprint)) let response = result |> map { result -> Api.EncryptedChat? in @@ -1636,7 +1636,7 @@ private func sendBoxedDecryptedMessage(postbox: Postbox, network: Network, peer: decryptedMessage.serialize(payload, role: state.role, sequenceInfo: sequenceInfo) let encryptedPayload = encryptedMessageContents(parameters: parameters, data: MemoryBuffer(payload)) let sendMessage: Signal - let inputPeer = Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash) + let inputPeer = Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash) var flags: Int32 = 0 if silent { @@ -1676,7 +1676,7 @@ private func requestTerminateSecretChat(postbox: Postbox, network: Network, peer if requestRemoteHistoryRemoval { flags |= 1 << 0 } - return network.request(Api.functions.messages.discardEncryption(flags: flags, chatId: peerId.id._internalGetInt32Value())) + return network.request(Api.functions.messages.discardEncryption(flags: flags, chatId: Int32(peerId.id._internalGetInt64Value()))) |> map(Optional.init) |> `catch` { _ in return .single(nil) @@ -1692,7 +1692,7 @@ private func requestTerminateSecretChat(postbox: Postbox, network: Network, peer } |> mapToSignal { peer -> Signal in if let peer = peer { - return network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: peer.id.id._internalGetInt32Value(), accessHash: peer.accessHash))) + return network.request(Api.functions.messages.reportEncryptedSpam(peer: Api.InputEncryptedChat.inputEncryptedChat(chatId: Int32(peer.id.id._internalGetInt64Value()), accessHash: peer.accessHash))) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift b/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift index 90280571f0..ccd6c9686b 100644 --- a/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift +++ b/submodules/TelegramCore/Sources/State/ManagedSynchronizePinnedChatsOperations.swift @@ -83,7 +83,7 @@ func managedSynchronizePinnedChatsOperations(postbox: Postbox, network: Network, let signal = withTakenOperation(postbox: postbox, peerId: entry.peerId, tagLocalIndex: entry.tagLocalIndex, { transaction, entry -> Signal in if let entry = entry { if let operation = entry.contents as? SynchronizePinnedChatsOperation { - return synchronizePinnedChats(transaction: transaction, postbox: postbox, network: network, accountPeerId: accountPeerId, stateManager: stateManager, groupId: PeerGroupId(rawValue: entry.peerId.id._internalGetInt32Value()), operation: operation) + return synchronizePinnedChats(transaction: transaction, postbox: postbox, network: network, accountPeerId: accountPeerId, stateManager: stateManager, groupId: PeerGroupId(rawValue: Int32(entry.peerId.id._internalGetInt64Value())), operation: operation) } else { assertionFailure() } diff --git a/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift b/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift index d9f28c1f79..8a77eb3396 100644 --- a/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift +++ b/submodules/TelegramCore/Sources/State/ProcessSecretChatIncomingDecryptedOperations.swift @@ -796,7 +796,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32 case let .decryptedMessageMediaGeoPoint(lat, long): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): - parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), vCardData: nil)) + parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(userId))), vCardData: nil)) case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case .decryptedMessageMediaEmpty: @@ -1015,7 +1015,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32 case let .decryptedMessageMediaGeoPoint(lat, long): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): - parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), vCardData: nil)) + parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(userId))), vCardData: nil)) case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case .decryptedMessageMediaEmpty: @@ -1253,7 +1253,7 @@ private func parseMessage(peerId: PeerId, authorId: PeerId, tagLocalIndex: Int32 case let .decryptedMessageMediaGeoPoint(lat, long): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: nil, liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case let .decryptedMessageMediaContact(phoneNumber, firstName, lastName, userId): - parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), vCardData: nil)) + parsedMedia.append(TelegramMediaContact(firstName: firstName, lastName: lastName, phoneNumber: phoneNumber, peerId: userId == 0 ? nil : PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(userId))), vCardData: nil)) case let .decryptedMessageMediaVenue(lat, long, title, address, provider, venueId): parsedMedia.append(TelegramMediaMap(latitude: lat, longitude: long, heading: nil, accuracyRadius: nil, geoPlace: nil, venue: MapVenue(title: title, address: address, provider: provider, id: venueId, type: nil), liveBroadcastingTimeout: nil, liveProximityNotificationRadius: nil)) case .decryptedMessageMediaEmpty: diff --git a/submodules/TelegramCore/Sources/State/Serialization.swift b/submodules/TelegramCore/Sources/State/Serialization.swift index 2d992c7f59..5de71bcf6d 100644 --- a/submodules/TelegramCore/Sources/State/Serialization.swift +++ b/submodules/TelegramCore/Sources/State/Serialization.swift @@ -236,7 +236,7 @@ public class Serialization: NSObject, MTSerialization { } } - public func importAuthorization(_ authId: Int32, bytes: Data!) -> Data! { + public func importAuthorization(_ authId: Int64, bytes: Data!) -> Data! { return Api.functions.auth.importAuthorization(id: authId, bytes: Buffer(data: bytes)).1.makeData() } diff --git a/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift b/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift index 7baa130399..e93efc9137 100644 --- a/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift +++ b/submodules/TelegramCore/Sources/State/SynchronizeEmojiKeywordsOperation.swift @@ -6,7 +6,7 @@ import SyncCore func addSynchronizeEmojiKeywordsOperation(transaction: Transaction, inputLanguageCode: String, languageCode: String?, fromVersion: Int32?) { let tag = OperationLogTags.SynchronizeEmojiKeywords - let peerId = PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt32Value(murMurHashString32(inputLanguageCode))) + let peerId = PeerId(namespace: PeerId.Namespace._internalFromInt32Value(0), id: PeerId.Id._internalFromInt64Value(Int64(murMurHashString32(inputLanguageCode)))) var hasExistingOperation = false transaction.operationLogEnumerateEntries(peerId: peerId, tag: tag) { entry -> Bool in diff --git a/submodules/TelegramCore/Sources/State/UpdateGroup.swift b/submodules/TelegramCore/Sources/State/UpdateGroup.swift index 8ae8b4c168..85ac1f8424 100644 --- a/submodules/TelegramCore/Sources/State/UpdateGroup.swift +++ b/submodules/TelegramCore/Sources/State/UpdateGroup.swift @@ -9,7 +9,7 @@ enum UpdateGroup { case withDate(updates: [Api.Update], date: Int32, users: [Api.User], chats: [Api.Chat]) case reset case updatePts(pts: Int32, ptsCount: Int32) - case updateChannelPts(channelId: Int32, pts: Int32, ptsCount: Int32) + case updateChannelPts(channelId: Int64, pts: Int32, ptsCount: Int32) case ensurePeerHasLocalState(id: PeerId) var updates: [Api.Update] { diff --git a/submodules/TelegramCore/Sources/State/UpdateMessageService.swift b/submodules/TelegramCore/Sources/State/UpdateMessageService.swift index fc375938cc..bbfbd80aec 100644 --- a/submodules/TelegramCore/Sources/State/UpdateMessageService.swift +++ b/submodules/TelegramCore/Sources/State/UpdateMessageService.swift @@ -67,7 +67,7 @@ class UpdateMessageService: NSObject, MTMessageService { case let .updateShortMessage(flags, id, userId, message, pts, ptsCount, date, fwdFrom, viaBotId, replyHeader, entities, ttlPeriod): let generatedFromId: Api.Peer if (Int(flags) & 1 << 1) != 0 { - generatedFromId = Api.Peer.peerUser(userId: self.peerId.id._internalGetInt32Value()) + generatedFromId = Api.Peer.peerUser(userId: self.peerId.id._internalGetInt64Value()) } else { generatedFromId = Api.Peer.peerUser(userId: userId) } diff --git a/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift b/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift index e32acae449..bde4a3fa9e 100644 --- a/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift +++ b/submodules/TelegramCore/Sources/State/UpdatesApiUtils.swift @@ -146,15 +146,15 @@ extension Api.Chat { var peerId: PeerId { switch self { case let .chat(chat): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chat.id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chat.id)) case let .chatEmpty(id): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)) case let .chatForbidden(id, _): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(id)) case let .channel(channel): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channel.id)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channel.id)) case let .channelForbidden(_, id, _, _, _): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(id)) } } } @@ -163,9 +163,9 @@ extension Api.User { var peerId: PeerId { switch self { case .user(_, let id, _, _, _, _, _, _, _, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) case let .userEmpty(id): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id)) } } } @@ -174,11 +174,11 @@ extension Api.Peer { var peerId: PeerId { switch self { case let .peerChannel(channelId): - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)) case let .peerChat(chatId): - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)) case let .peerUser(userId): - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) } } } @@ -248,40 +248,40 @@ extension Api.Update { var peerIds: [PeerId] { switch self { case let .updateChannel(channelId): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateChat(chatId): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))] case let .updateChannelTooLong(_, channelId, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateChatParticipantAdd(chatId, userId, inviterId, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId))] case let .updateChatParticipantAdmin(chatId, userId, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateChatParticipantDelete(chatId, userId, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateChatParticipants(participants): switch participants { case let .chatParticipants(chatId, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))] case let .chatParticipantsForbidden(_, chatId, _): - return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId))] + return [PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId))] } case let .updateDeleteChannelMessages(channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updatePinnedChannelMessages(_, channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateNewChannelMessage(message, _, _): return apiMessagePeerIds(message) case let .updateEditChannelMessage(message, _, _): return apiMessagePeerIds(message) case let .updateChannelWebPage(channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateNewMessage(message, _, _): return apiMessagePeerIds(message) case let .updateEditMessage(message, _, _): return apiMessagePeerIds(message) case let .updateReadChannelInbox(_, _, channelId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId))] + return [PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId))] case let .updateNotifySettings(peer, _): switch peer { case let .notifyPeer(peer): @@ -290,14 +290,14 @@ extension Api.Update { return [] } case let .updateUserName(userId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateUserPhone(userId, _): - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateUserPhoto(userId, _, _, _): - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))] case let .updateServiceNotification(_, inboxDate, _, _, _, _): if let _ = inboxDate { - return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(777000))] + return [PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(777000))] } else { return [] } @@ -418,9 +418,9 @@ extension Api.Updates { case .updatesTooLong: return [] case let .updateShortMessage(_, id, userId, _, _, _, _, _, _, _, _, _): - return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), namespace: Namespaces.Message.Cloud, id: id)] + return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), namespace: Namespaces.Message.Cloud, id: id)] case let .updateShortChatMessage(_, id, _, chatId, _, _, _, _, _, _, _, _, _): - return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(chatId)), namespace: Namespaces.Message.Cloud, id: id)] + return [MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)), namespace: Namespaces.Message.Cloud, id: id)] } } @@ -452,9 +452,9 @@ extension Api.Updates { return [:] case .updatesTooLong: return [:] - case let .updateShortMessage(_, id, userId, _, _, _, _, _, _, _, _, _): + case .updateShortMessage: return [:] - case let .updateShortChatMessage(_, id, _, chatId, _, _, _, _, _, _, _, _, _): + case .updateShortChatMessage: return [:] } } @@ -549,15 +549,15 @@ extension Api.EncryptedChat { var peerId: PeerId { switch self { case let .encryptedChat(id, _, _, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatDiscarded(_, id): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatEmpty(id): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatRequested(_, _, id, _, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) case let .encryptedChatWaiting(id, _, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(id)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(id))) } } } @@ -566,9 +566,9 @@ extension Api.EncryptedMessage { var peerId: PeerId { switch self { case let .encryptedMessage(_, chatId, _, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))) case let .encryptedMessageService(_, chatId, _, _): - return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(chatId)) + return PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(chatId))) } } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift index 0e5e086488..d30273cbd1 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Auth/AuthTransfer.swift @@ -22,7 +22,7 @@ public enum ExportAuthTransferTokenResult { } func _internal_exportAuthTransferToken(accountManager: AccountManager, account: UnauthorizedAccount, otherAccountUserIds: [PeerId.Id], syncContacts: Bool) -> Signal { - return account.network.request(Api.functions.auth.exportLoginToken(apiId: account.networkArguments.apiId, apiHash: account.networkArguments.apiHash, exceptIds: otherAccountUserIds.map({ $0._internalGetInt32Value() }))) + return account.network.request(Api.functions.auth.exportLoginToken(apiId: account.networkArguments.apiId, apiHash: account.networkArguments.apiHash, exceptIds: otherAccountUserIds.map({ $0._internalGetInt64Value() }))) |> map(Optional.init) |> `catch` { error -> Signal in if error.errorDescription == "SESSION_PASSWORD_NEEDED" { diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift b/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift index b5a7c60e04..e073157871 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Payments/BotPaymentForm.swift @@ -225,7 +225,7 @@ func _internal_fetchBotPaymentForm(postbox: Postbox, network: Network, messageId parsedSavedCredentials = .card(id: id, title: title) } } - return BotPaymentForm(id: id, canSaveCredentials: (flags & (1 << 2)) != 0, passwordMissing: (flags & (1 << 3)) != 0, invoice: parsedInvoice, paymentBotId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(providerId)), url: url, nativeProvider: parsedNativeProvider, savedInfo: parsedSavedInfo, savedCredentials: parsedSavedCredentials) + return BotPaymentForm(id: id, canSaveCredentials: (flags & (1 << 2)) != 0, passwordMissing: (flags & (1 << 3)) != 0, invoice: parsedInvoice, paymentBotId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(providerId)), url: url, nativeProvider: parsedNativeProvider, savedInfo: parsedSavedInfo, savedCredentials: parsedSavedCredentials) } } |> mapError { _ -> BotPaymentFormRequestError in } @@ -489,26 +489,6 @@ func _internal_requestBotPaymentReceipt(account: Account, messageId: MessageId) let parsedInfo = info.flatMap(BotPaymentRequestedInfo.init) let shippingOption = shipping.flatMap(BotPaymentShippingOption.init) - /*let fields = BotPaymentInvoiceFields() - - let form = BotPaymentForm( - id: 0, - canSaveCredentials: false, - passwordMissing: false, - invoice: BotPaymentInvoice( - isTest: false, - requestedFields: fields, - currency: currency, - prices: [], - tip: nil - ), - providerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(providerId)), - url: "", - nativeProvider: nil, - savedInfo: nil, - savedCredentials: nil - )*/ - let invoiceMedia = TelegramMediaInvoice( title: title, description: description, @@ -520,7 +500,7 @@ func _internal_requestBotPaymentReceipt(account: Account, messageId: MessageId) flags: [] ) - let botPaymentId = PeerId.init(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)) + let botPaymentId = PeerId.init(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)) return BotPaymentReceipt(invoice: parsedInvoice, info: parsedInfo, shippingOption: shippingOption, credentialsTitle: credentialsTitle, invoiceMedia: invoiceMedia, tipAmount: tipAmount, botPaymentId: botPaymentId) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift index 2edaf4434c..26f89f9310 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/ConvertGroupToSupergroup.swift @@ -10,7 +10,7 @@ public enum ConvertGroupToSupergroupError { } func _internal_convertGroupToSupergroup(account: Account, peerId: PeerId) -> Signal { - return account.network.request(Api.functions.messages.migrateChat(chatId: peerId.id._internalGetInt32Value())) + return account.network.request(Api.functions.messages.migrateChat(chatId: peerId.id._internalGetInt64Value())) |> mapError { error -> ConvertGroupToSupergroupError in if error.errorDescription == "CHANNELS_TOO_MUCH" { return .tooManyChannels diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift index 9d288f6278..7393db32fa 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/FindChannelById.swift @@ -3,7 +3,7 @@ import SwiftSignalKit import Postbox import TelegramApi -func _internal_findChannelById(postbox: Postbox, network: Network, channelId: Int32) -> Signal { +func _internal_findChannelById(postbox: Postbox, network: Network, channelId: Int64) -> Signal { return network.request(Api.functions.channels.getChannels(id: [.inputChannel(channelId: channelId, accessHash: 0)])) |> map(Optional.init) |> `catch` { _ -> Signal in diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift index 4ce9e85463..dcd213e42c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/TelegramEnginePeers.swift @@ -51,7 +51,7 @@ public extension TelegramEngine { } } - public func findChannelById(channelId: Int32) -> Signal { + public func findChannelById(channelId: Int64) -> Signal { return _internal_findChannelById(postbox: self.account.postbox, network: self.account.network, channelId: channelId) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift index c191a5b09b..03b336a081 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/GrantSecureIdAccess.swift @@ -333,7 +333,7 @@ public func grantSecureIdAccess(network: Network, peerId: PeerId, publicKey: Str valueHashes.append(.secureValueHash(type: apiSecureValueType(value: value.value), hash: Buffer(data: value.opaqueHash))) } - return network.request(Api.functions.account.acceptAuthorization(botId: peerId.id._internalGetInt32Value(), scope: scope, publicKey: publicKey, valueHashes: valueHashes, credentials: .secureCredentialsEncrypted(data: Buffer(data: encryptedCredentialsData), hash: Buffer(data: decryptedCredentialsHash), secret: Buffer(data: encryptedSecretData)))) + return network.request(Api.functions.account.acceptAuthorization(botId: peerId.id._internalGetInt64Value(), scope: scope, publicKey: publicKey, valueHashes: valueHashes, credentials: .secureCredentialsEncrypted(data: Buffer(data: encryptedCredentialsData), hash: Buffer(data: decryptedCredentialsHash), secret: Buffer(data: encryptedSecretData)))) |> mapError { error -> GrantSecureIdAccessError in return .generic } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift index e7d82f7a20..d0ffb80686 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/SecureId/RequestSecureIdForm.swift @@ -251,7 +251,7 @@ public func requestSecureIdForm(postbox: Postbox, network: Network, peerId: Peer if publicKey.isEmpty { return .fail(.serverError("PUBLIC_KEY_REQUIRED")) } - return network.request(Api.functions.account.getAuthorizationForm(botId: peerId.id._internalGetInt32Value(), scope: scope, publicKey: publicKey)) + return network.request(Api.functions.account.getAuthorizationForm(botId: peerId.id._internalGetInt64Value(), scope: scope, publicKey: publicKey)) |> mapError { error -> RequestSecureIdFormError in switch error.errorDescription { case "APP_VERSION_OUTDATED": diff --git a/submodules/TelegramCore/Sources/TwoStepVerification.swift b/submodules/TelegramCore/Sources/TwoStepVerification.swift index 9348a21714..a07b04932c 100644 --- a/submodules/TelegramCore/Sources/TwoStepVerification.swift +++ b/submodules/TelegramCore/Sources/TwoStepVerification.swift @@ -345,7 +345,7 @@ public func recoverTwoStepVerificationPassword(network: Network, code: String) - flags |= (1 << 0) } - return network.request(Api.functions.auth.recoverPassword(code: code), automaticFloodWait: false) + return network.request(Api.functions.auth.recoverPassword(flags: 0, code: code, newSettings: nil), automaticFloodWait: false) |> mapError { error -> RecoverTwoStepVerificationPasswordError in if error.errorDescription.hasPrefix("FLOOD_WAIT_") { return .limitExceeded diff --git a/submodules/TelegramCore/Sources/UpdateCachedPeerData.swift b/submodules/TelegramCore/Sources/UpdateCachedPeerData.swift index 56fb081c41..aaba92ba02 100644 --- a/submodules/TelegramCore/Sources/UpdateCachedPeerData.swift +++ b/submodules/TelegramCore/Sources/UpdateCachedPeerData.swift @@ -217,7 +217,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId } } } else if peerId.namespace == Namespaces.Peer.CloudGroup { - return network.request(Api.functions.messages.getFullChat(chatId: peerId.id._internalGetInt32Value())) + return network.request(Api.functions.messages.getFullChat(chatId: peerId.id._internalGetInt64Value())) |> retryRequest |> mapToSignal { result -> Signal in return postbox.transaction { transaction -> Bool in @@ -236,7 +236,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId for botInfo in chatFull.botInfo ?? [] { switch botInfo { case let .botInfo(userId, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) let parsedBotInfo = BotInfo(apiBotInfo: botInfo) botInfos.append(CachedPeerBotInfo(peerId: peerId, botInfo: parsedBotInfo)) } @@ -381,7 +381,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId let linkedDiscussionPeerId: PeerId? if let linkedChatId = linkedChatId, linkedChatId != 0 { - linkedDiscussionPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(linkedChatId)) + linkedDiscussionPeerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(linkedChatId))) } else { linkedDiscussionPeerId = nil } @@ -399,7 +399,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId for botInfo in apiBotInfos { switch botInfo { case let .botInfo(userId, _, _): - let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)) + let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)) let parsedBotInfo = BotInfo(apiBotInfo: botInfo) botInfos.append(CachedPeerBotInfo(peerId: peerId, botInfo: parsedBotInfo)) } @@ -421,7 +421,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId var migrationReference: ChannelMigrationReference? if let migratedFromChatId = migratedFromChatId, let migratedFromMaxId = migratedFromMaxId { - migrationReference = ChannelMigrationReference(maxMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(migratedFromChatId)), namespace: Namespaces.Message.Cloud, id: migratedFromMaxId)) + migrationReference = ChannelMigrationReference(maxMessageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(migratedFromChatId)), namespace: Namespaces.Message.Cloud, id: migratedFromMaxId)) } var peers: [Peer] = [] @@ -490,7 +490,7 @@ public func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPeerId case let.channelParticipant(participant, _, _): switch participant { case let .channelParticipantSelf(_, inviterId, _): - invitedBy = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(inviterId)) + invitedBy = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(inviterId)) default: break } diff --git a/submodules/TelegramCore/Sources/UpdatePeerInfo.swift b/submodules/TelegramCore/Sources/UpdatePeerInfo.swift index db1115c585..66b71dcd08 100644 --- a/submodules/TelegramCore/Sources/UpdatePeerInfo.swift +++ b/submodules/TelegramCore/Sources/UpdatePeerInfo.swift @@ -30,7 +30,7 @@ public func updatePeerTitle(account: Account, peerId: PeerId, title: String) -> } |> mapError { _ -> UpdatePeerTitleError in } } } else if let peer = peer as? TelegramGroup { - return account.network.request(Api.functions.messages.editChatTitle(chatId: peer.id.id._internalGetInt32Value(), title: title)) + return account.network.request(Api.functions.messages.editChatTitle(chatId: peer.id.id._internalGetInt64Value(), title: title)) |> mapError { _ -> UpdatePeerTitleError in return .generic } diff --git a/submodules/TelegramCore/Sources/UpdatedAccountPrivacySettings.swift b/submodules/TelegramCore/Sources/UpdatedAccountPrivacySettings.swift index ca6a3a84f5..ccbba896af 100644 --- a/submodules/TelegramCore/Sources/UpdatedAccountPrivacySettings.swift +++ b/submodules/TelegramCore/Sources/UpdatedAccountPrivacySettings.swift @@ -234,7 +234,7 @@ public func updateSelectiveAccountPrivacySettings(account: Account, type: Update rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: apiInputUsers(transaction: transaction, peerIds: enablePeers.users))) } if !enablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowAll) @@ -246,14 +246,14 @@ public func updateSelectiveAccountPrivacySettings(account: Account, type: Update rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: apiInputUsers(transaction: transaction, peerIds: enablePeers.users))) } if !enablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: enablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } if !disablePeers.users.isEmpty { rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: apiInputUsers(transaction: transaction, peerIds: disablePeers.users))) } if !disablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowContacts) @@ -264,7 +264,7 @@ public func updateSelectiveAccountPrivacySettings(account: Account, type: Update rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: apiInputUsers(transaction: transaction, peerIds: disablePeers.users))) } if !disablePeers.groups.isEmpty { - rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt32Value() }))) + rules.append(Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: disablePeers.groups.map({ $0.id._internalGetInt64Value() }))) } rules.append(Api.InputPrivacyRule.inputPrivacyValueAllowAll) diff --git a/submodules/TelegramCore/Sources/Utils/PeerUtils.swift b/submodules/TelegramCore/Sources/Utils/PeerUtils.swift index c39e549776..a71c90d816 100644 --- a/submodules/TelegramCore/Sources/Utils/PeerUtils.swift +++ b/submodules/TelegramCore/Sources/Utils/PeerUtils.swift @@ -241,7 +241,7 @@ public func isServicePeer(_ peer: Peer) -> Bool { if peer.id.isReplies { return true } - return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id._internalGetInt32Value() == 777000 || peer.id.id._internalGetInt32Value() == 333000)) + return (peer.id.namespace == Namespaces.Peer.CloudUser && (peer.id.id._internalGetInt64Value() == 777000 || peer.id.id._internalGetInt64Value() == 333000)) } return false } @@ -249,7 +249,7 @@ public func isServicePeer(_ peer: Peer) -> Bool { public extension PeerId { var isReplies: Bool { if self.namespace == Namespaces.Peer.CloudUser { - if self.id._internalGetInt32Value() == 708513 || self.id._internalGetInt32Value() == 1271266957 { + if self.id._internalGetInt64Value() == 708513 || self.id._internalGetInt64Value() == 1271266957 { return true } } @@ -268,7 +268,7 @@ public extension PeerId { var isImport: Bool { if self.namespace == Namespaces.Peer.CloudUser { - if self.id._internalGetInt32Value() == 225079 { + if self.id._internalGetInt64Value() == 225079 { return true } } diff --git a/submodules/TelegramUI/Sources/AppDelegate.swift b/submodules/TelegramUI/Sources/AppDelegate.swift index f89525e477..ec59cf61f4 100644 --- a/submodules/TelegramUI/Sources/AppDelegate.swift +++ b/submodules/TelegramUI/Sources/AppDelegate.swift @@ -280,13 +280,13 @@ final class SharedApplicationContext { var peerId: PeerId? if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let msgId = payload["msg_id"] { @@ -1697,8 +1697,8 @@ final class SharedApplicationContext { } if let startCallContacts = startCallContacts { - let startCall: (Int32) -> Void = { userId in - self.startCallWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), isVideo: startCallIsVideo) + let startCall: (Int64) -> Void = { userId in + self.startCallWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), isVideo: startCallIsVideo) } func cleanPhoneNumber(_ text: String) -> String { @@ -1729,7 +1729,7 @@ final class SharedApplicationContext { var processed = false if let handle = contact.customIdentifier, handle.hasPrefix("tg") { let string = handle.suffix(from: handle.index(handle.startIndex, offsetBy: 2)) - if let userId = Int32(string) { + if let userId = Int64(string) { startCall(userId) processed = true } @@ -1737,7 +1737,7 @@ final class SharedApplicationContext { if !processed, let handle = contact.personHandle, let value = handle.value { switch handle.type { case .unknown: - if let userId = Int32(value) { + if let userId = Int64(value) { startCall(userId) processed = true } @@ -1760,7 +1760,7 @@ final class SharedApplicationContext { return result } |> deliverOnMainQueue).start(next: { peerId in if let peerId = peerId { - startCall(peerId.id._internalGetInt32Value()) + startCall(peerId.id._internalGetInt64Value()) } }) processed = true @@ -1774,8 +1774,8 @@ final class SharedApplicationContext { } else if let sendMessageIntent = userActivity.interaction?.intent as? INSendMessageIntent { if let contact = sendMessageIntent.recipients?.first, let handle = contact.customIdentifier, handle.hasPrefix("tg") { let string = handle.suffix(from: handle.index(handle.startIndex, offsetBy: 2)) - if let userId = Int32(string) { - self.openChatWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(userId)), activateInput: true) + if let userId = Int64(string) { + self.openChatWhenReady(accountId: nil, peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId)), activateInput: true) } } } @@ -2319,7 +2319,7 @@ private func accountIdFromNotification(_ notification: UNNotification, sharedCon |> take(1) |> map { _, accounts, _ -> AccountRecordId? in for (_, account, _) in accounts { - if Int(account.peerId.id._internalGetInt32Value()) == userId { + if Int(account.peerId.id._internalGetInt64Value()) == userId { return account.id } } @@ -2341,16 +2341,16 @@ private func peerIdFromNotification(_ notification: UNNotification) -> PeerId? { var peerId: PeerId? if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["encryption_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } return peerId } diff --git a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift index 09274cb45b..f89744e8d6 100644 --- a/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageBubbleItemNode.swift @@ -1155,7 +1155,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode ignoreForward = true effectiveAuthor = forwardInfo.author if effectiveAuthor == nil, let authorSignature = forwardInfo.authorSignature { - effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(Int32(clamping: authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) + effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) } } displayAuthorInfo = !mergedTop.merged && incoming && effectiveAuthor != nil @@ -1171,7 +1171,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode displayAuthorInfo = !mergedTop.merged && incoming } else if let forwardInfo = item.content.firstMessage.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature { ignoreForward = true - effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(Int32(clamping: authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) + effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) displayAuthorInfo = !mergedTop.merged && incoming } else { effectiveAuthor = firstMessage.author @@ -1553,12 +1553,12 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode if initialDisplayHeader && displayAuthorInfo { if let peer = firstMessage.peers[firstMessage.id.peerId] as? TelegramChannel, case .broadcast = peer.info { authorNameString = peer.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) - authorNameColor = chatMessagePeerIdColors[Int(peer.id.id._internalGetInt32Value() % 7)] + authorNameColor = chatMessagePeerIdColors[Int(clamping: peer.id.id._internalGetInt64Value() % 7)] } else if let effectiveAuthor = effectiveAuthor { authorNameString = effectiveAuthor.displayTitle(strings: item.presentationData.strings, displayOrder: item.presentationData.nameDisplayOrder) if incoming { - authorNameColor = chatMessagePeerIdColors[Int(effectiveAuthor.id.id._internalGetInt32Value() % 7)] + authorNameColor = chatMessagePeerIdColors[Int(clamping: effectiveAuthor.id.id._internalGetInt64Value() % 7)] } else { authorNameColor = item.presentationData.theme.theme.chat.message.outgoing.accentTextColor } diff --git a/submodules/TelegramUI/Sources/ChatMessageItem.swift b/submodules/TelegramUI/Sources/ChatMessageItem.swift index 606da3ec2a..cb2eea1056 100644 --- a/submodules/TelegramUI/Sources/ChatMessageItem.swift +++ b/submodules/TelegramUI/Sources/ChatMessageItem.swift @@ -302,7 +302,7 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible { if let forwardInfo = content.firstMessage.forwardInfo { effectiveAuthor = forwardInfo.author if effectiveAuthor == nil, let authorSignature = forwardInfo.authorSignature { - effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt32Value(Int32(clamping: authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) + effectiveAuthor = TelegramUser(id: PeerId(namespace: Namespaces.Peer.Empty, id: PeerId.Id._internalFromInt64Value(Int64(authorSignature.persistentHashValue))), accessHash: nil, firstName: authorSignature, lastName: nil, username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: UserInfoFlags()) } } displayAuthorInfo = incoming && effectiveAuthor != nil diff --git a/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift b/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift index 5cc933f1a5..5ae17ea047 100644 --- a/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift +++ b/submodules/TelegramUI/Sources/ChatRecentActionsHistoryTransition.swift @@ -286,7 +286,7 @@ struct ChatRecentActionsEntry: Comparable, Identifiable { case .header: var peers = SimpleDictionary() var author: Peer? - if self.entry.event.peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(136817688)) { + if self.entry.event.peerId == PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(136817688)) { author = message?.effectiveAuthor } else if let peer = self.entry.peers[self.entry.event.peerId] { author = peer diff --git a/submodules/TelegramUI/Sources/CreateChannelController.swift b/submodules/TelegramUI/Sources/CreateChannelController.swift index acbcb9eacc..c70550a424 100644 --- a/submodules/TelegramUI/Sources/CreateChannelController.swift +++ b/submodules/TelegramUI/Sources/CreateChannelController.swift @@ -197,7 +197,7 @@ private func CreateChannelEntries(presentationData: PresentationData, state: Cre let groupInfoState = ItemListAvatarAndNameInfoItemState(editingName: state.editingName, updatingName: nil) - let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) entries.append(.channelInfo(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer, groupInfoState, state.avatar)) diff --git a/submodules/TelegramUI/Sources/CreateGroupController.swift b/submodules/TelegramUI/Sources/CreateGroupController.swift index 98bb6cf961..ac1aa3598f 100644 --- a/submodules/TelegramUI/Sources/CreateGroupController.swift +++ b/submodules/TelegramUI/Sources/CreateGroupController.swift @@ -298,7 +298,7 @@ private func createGroupEntries(presentationData: PresentationData, state: Creat let groupInfoState = ItemListAvatarAndNameInfoItemState(editingName: state.editingName, updatingName: nil) - let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) + let peer = TelegramGroup(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), title: state.editingName.composedTitle, photo: [], participantCount: 0, role: .creator(rank: nil), membership: .Member, flags: [], defaultBannedRights: nil, migrationReference: nil, creationDate: 0, version: 0) entries.append(.groupInfo(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, peer, groupInfoState, state.avatar)) diff --git a/submodules/TelegramUI/Sources/OpenUrl.swift b/submodules/TelegramUI/Sources/OpenUrl.swift index 106fd25f93..35f26f2424 100644 --- a/submodules/TelegramUI/Sources/OpenUrl.swift +++ b/submodules/TelegramUI/Sources/OpenUrl.swift @@ -42,7 +42,7 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? { if url.host == "passport" || url.host == "resolve" { if let components = URLComponents(string: "/?" + query) { var domain: String? - var botId: Int32? + var botId: Int64? var scope: String? var publicKey: String? var callbackUrl: String? @@ -54,7 +54,7 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? { if queryItem.name == "domain" { domain = value } else if queryItem.name == "bot_id" { - botId = Int32(value) + botId = Int64(value) } else if queryItem.name == "scope" { scope = value } else if queryItem.name == "public_key" { @@ -96,7 +96,7 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? { return nil } - return ParsedSecureIdUrl(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce) + return ParsedSecureIdUrl(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce) } } } @@ -395,7 +395,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur } else if parsedUrl.host == "passport" || parsedUrl.host == "resolve" { if let components = URLComponents(string: "/?" + query) { var domain: String? - var botId: Int32? + var botId: Int64? var scope: String? var publicKey: String? var callbackUrl: String? @@ -407,7 +407,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur if queryItem.name == "domain" { domain = value } else if queryItem.name == "bot_id" { - botId = Int32(value) + botId = Int64(value) } else if queryItem.name == "scope" { scope = value } else if queryItem.name == "public_key" { @@ -451,7 +451,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur if case .chat = urlContext { return } - let controller = SecureIdAuthController(context: context, mode: .form(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce)) + let controller = SecureIdAuthController(context: context, mode: .form(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(botId)), scope: scope, publicKey: publicKey, callbackUrl: callbackUrl, opaquePayload: opaquePayload, opaqueNonce: opaqueNonce)) if let navigationController = navigationController { context.sharedContext.applicationBindings.dismissNativeController() @@ -476,9 +476,9 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur } } - if let id = id, !id.isEmpty, let idValue = Int32(id), idValue > 0 { + if let id = id, !id.isEmpty, let idValue = Int64(id), idValue > 0 { let _ = (context.account.postbox.transaction { transaction -> Peer? in - return transaction.getPeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(idValue))) + return transaction.getPeer(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(idValue))) } |> deliverOnMainQueue).start(next: { peer in if let peer = peer, let controller = context.sharedContext.makePeerInfoController(context: context, peer: peer, mode: .generic, avatarInitiallyExpanded: false, fromChat: false) { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift index 662ae05eb1..5d929513ad 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoHeaderNode.swift @@ -415,7 +415,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode { representations = topRepresentations videoRepresentations = videoRepresentationsValue immediateThumbnailData = immediateThumbnail - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } @@ -426,7 +426,7 @@ final class PeerInfoAvatarTransformContainerNode: ASDisplayNode { if case let .cloud(imageId, _, _) = reference { id = imageId } else { - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() } } @@ -710,7 +710,7 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode { representations = topRepresentations videoRepresentations = videoRepresentationsValue immediateThumbnailData = immediateThumbnail - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() if let resource = videoRepresentations.first?.representation.resource as? CloudPhotoSizeMediaResource { id = id &+ resource.photoId } @@ -721,7 +721,7 @@ final class PeerInfoEditingAvatarNode: ASDisplayNode { if case let .cloud(imageId, _, _) = reference { id = imageId } else { - id = Int64(peer.id.id._internalGetInt32Value()) + id = peer.id.id._internalGetInt64Value() } } diff --git a/submodules/TelegramUI/Sources/PollResultsController.swift b/submodules/TelegramUI/Sources/PollResultsController.swift index 1efa4db7d6..0763e1f166 100644 --- a/submodules/TelegramUI/Sources/PollResultsController.swift +++ b/submodules/TelegramUI/Sources/PollResultsController.swift @@ -252,7 +252,7 @@ private func pollResultsControllerEntries(presentationData: PresentationData, po displayCount = Int(voterCount) } for peerIndex in 0 ..< displayCount { - let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt32Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) + let fakeUser = TelegramUser(id: PeerId(namespace: .max, id: PeerId.Id._internalFromInt64Value(0)), accessHash: nil, firstName: "", lastName: "", username: nil, phone: nil, photo: [], botInfo: nil, restrictionInfo: nil, flags: []) let peer = RenderedPeer(peer: fakeUser) entries.append(.optionPeer(optionId: i, index: peerIndex, peer: peer, optionText: optionTextHeader, optionAdditionalText: optionAdditionalTextHeader, optionCount: voterCount, optionExpanded: false, opaqueIdentifier: option.opaqueIdentifier, shimmeringAlternation: peerIndex % 2, isFirstInOption: peerIndex == 0)) } diff --git a/submodules/TelegramUI/Sources/SharedNotificationManager.swift b/submodules/TelegramUI/Sources/SharedNotificationManager.swift index 603a877a6f..197020a5ee 100644 --- a/submodules/TelegramUI/Sources/SharedNotificationManager.swift +++ b/submodules/TelegramUI/Sources/SharedNotificationManager.swift @@ -250,13 +250,13 @@ public final class SharedNotificationManager { var peerId: PeerId? if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let peerId = peerId { if let messageIds = payload["messages"] as? String { @@ -314,13 +314,13 @@ public final class SharedNotificationManager { if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let msgId = payload["msg_id"] { @@ -331,8 +331,8 @@ public final class SharedNotificationManager { } else if let randomId = payload["random_id"] { let randomIdValue = randomId as! NSString var peerId: PeerId? - if let encryptionIdString = payload["encryption_id"] as? String, let encryptionId = Int32(encryptionIdString) { - peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt32Value(encryptionId)) + if let encryptionIdString = payload["encryption_id"] as? String, let encryptionId = Int64(encryptionIdString) { + peerId = PeerId(namespace: Namespaces.Peer.SecretChat, id: PeerId.Id._internalFromInt64Value(encryptionId)) } notificationRequestId = .globallyUniqueId(randomIdValue.longLongValue, peerId) } else { @@ -344,13 +344,13 @@ public final class SharedNotificationManager { if let fromId = payload["from_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["chat_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } else if let fromId = payload["channel_id"] { let fromIdValue = fromId as! NSString - peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(fromIdValue.intValue))) + peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(fromIdValue as String) ?? 0)) } if let peerId = peerId { diff --git a/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift b/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift index 9c86d77e5a..89b16a1d2e 100644 --- a/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift +++ b/submodules/TemporaryCachedPeerDataManager/Sources/ChannelMemberCategoryListContext.swift @@ -315,7 +315,7 @@ private final class ChannelMemberSingleCategoryListContext: ChannelMemberCategor for i in 0 ..< min(strongSelf.listStateValue.list.count, Int(initialBatchSize)) { let peerId = strongSelf.listStateValue.list[i].peer.id - hash = (hash &* 20261) &+ UInt32(bitPattern: peerId.id._internalGetInt32Value()) + combineInt32Hash(&hash, with: peerId) } hash = hash % 0x7FFFFFFF strongSelf.headUpdateDisposable.set((strongSelf.loadSignal(offset: 0, count: initialBatchSize, hash: Int32(bitPattern: hash)) diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index fe14cff19f..a9301bb7f5 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -145,8 +145,8 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } } } - } else if pathComponents[0].hasPrefix(phonebookUsernamePathPrefix), let idValue = Int32(String(pathComponents[0][pathComponents[0].index(pathComponents[0].startIndex, offsetBy: phonebookUsernamePathPrefix.count)...])) { - return .peerId(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(idValue))) + } else if pathComponents[0].hasPrefix(phonebookUsernamePathPrefix), let idValue = Int64(String(pathComponents[0][pathComponents[0].index(pathComponents[0].startIndex, offsetBy: phonebookUsernamePathPrefix.count)...])) { + return .peerId(PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(idValue))) } else if pathComponents[0].hasPrefix("+") || pathComponents[0].hasPrefix("%20") { return .join(String(pathComponents[0].dropFirst())) } @@ -279,7 +279,7 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } else if pathComponents[0] == "addtheme" { return .theme(pathComponents[1]) } else if pathComponents.count == 3 && pathComponents[0] == "c" { - if let channelId = Int32(pathComponents[1]), let messageId = Int32(pathComponents[2]) { + if let channelId = Int64(pathComponents[1]), let messageId = Int32(pathComponents[2]) { var threadId: Int32? if let queryItems = components.queryItems { for queryItem in queryItems { @@ -293,7 +293,7 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } } } - return .privateMessage(messageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(channelId)), namespace: Namespaces.Message.Cloud, id: messageId), threadId: threadId) + return .privateMessage(messageId: MessageId(peerId: PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(channelId)), namespace: Namespaces.Message.Cloud, id: messageId), threadId: threadId) } else { return nil } @@ -406,7 +406,7 @@ private func resolveInternalUrl(context: AccountContext, url: ParsedInternalUrl) if let peer = peer { foundPeer = .single(peer) } else { - foundPeer = TelegramEngine(account: context.account).peers.findChannelById(channelId: messageId.peerId.id._internalGetInt32Value()) + foundPeer = TelegramEngine(account: context.account).peers.findChannelById(channelId: messageId.peerId.id._internalGetInt64Value()) } return foundPeer |> mapToSignal { foundPeer -> Signal in diff --git a/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h b/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h index 6abccb783c..fce079b310 100644 --- a/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h +++ b/submodules/WatchBridge/Impl/PublicHeaders/WatchBridgeImpl/TGBridgeServer.h @@ -15,7 +15,7 @@ - (SSignal *)watchAppInstalledSignal; - (SSignal *)runningRequestsSignal; -- (void)setAuthorized:(bool)authorized userId:(int32_t)userId; +- (void)setAuthorized:(bool)authorized userId:(int64_t)userId; - (void)setMicAccessAllowed:(bool)allowed; - (void)setStartupData:(NSDictionary *)data; - (void)pushContext; diff --git a/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m b/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m index 6bbf49c4de..7cca68f376 100644 --- a/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m +++ b/submodules/WatchBridge/Impl/Sources/TGBridgeServer.m @@ -135,7 +135,7 @@ #pragma mark - -- (void)setAuthorized:(bool)authorized userId:(int32_t)userId +- (void)setAuthorized:(bool)authorized userId:(int64_t)userId { _activeContext = [_activeContext updatedWithAuthorized:authorized peerId:userId]; } diff --git a/submodules/WatchBridge/Sources/WatchBridge.swift b/submodules/WatchBridge/Sources/WatchBridge.swift index 08a9ccc38c..f325107e8e 100644 --- a/submodules/WatchBridge/Sources/WatchBridge.swift +++ b/submodules/WatchBridge/Sources/WatchBridge.swift @@ -9,11 +9,11 @@ import PhoneNumberFormat func makePeerIdFromBridgeIdentifier(_ identifier: Int64) -> PeerId? { if identifier < 0 && identifier > Int32.min { - return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt32Value(Int32(clamping: -identifier))) + return PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(-identifier)) } else if identifier < Int64(Int32.min) * 2 && identifier > Int64(Int32.min) * 3 { - return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt32Value(Int32(clamping: Int64(Int32.min) &* 2 &- identifier))) + return PeerId(namespace: Namespaces.Peer.CloudChannel, id: PeerId.Id._internalFromInt64Value(Int64(Int32.min) &* 2 &- identifier)) } else if identifier > 0 && identifier < Int32.max { - return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt32Value(Int32(clamping: identifier))) + return PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(identifier)) } else { return nil } @@ -22,11 +22,11 @@ func makePeerIdFromBridgeIdentifier(_ identifier: Int64) -> PeerId? { func makeBridgeIdentifier(_ peerId: PeerId) -> Int64 { switch peerId.namespace { case Namespaces.Peer.CloudGroup: - return -Int64(peerId.id._internalGetInt32Value()) + return -Int64(peerId.id._internalGetInt64Value()) case Namespaces.Peer.CloudChannel: - return Int64(Int32.min) * 2 - Int64(peerId.id._internalGetInt32Value()) + return Int64(Int32.min) * 2 - Int64(peerId.id._internalGetInt64Value()) default: - return Int64(peerId.id._internalGetInt32Value()) + return Int64(peerId.id._internalGetInt64Value()) } } diff --git a/submodules/WatchBridge/Sources/WatchCommunicationManager.swift b/submodules/WatchBridge/Sources/WatchCommunicationManager.swift index 629b456a41..3e6a943a9c 100644 --- a/submodules/WatchBridge/Sources/WatchCommunicationManager.swift +++ b/submodules/WatchBridge/Sources/WatchCommunicationManager.swift @@ -89,7 +89,7 @@ public final class WatchCommunicationManager { } if let context = appContext { strongSelf.accountContext.set(.single(context.context)) - strongSelf.server.setAuthorized(true, userId: context.context.account.peerId.id._internalGetInt32Value()) + strongSelf.server.setAuthorized(true, userId: context.context.account.peerId.id._internalGetInt64Value()) strongSelf.server.setMicAccessAllowed(false) strongSelf.server.pushContext() strongSelf.server.setMicAccessAllowed(true)