Initial 64-bit id support

This commit is contained in:
Ali 2021-06-28 20:02:50 +04:00
parent d7f64543d5
commit a23971c0ef
129 changed files with 1486 additions and 1314 deletions

View File

@ -16,4 +16,4 @@ build --strategy=Genrule=standalone
build --spawn_strategy=standalone
build --strategy=SwiftCompile=standalone
build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1
build --define RULES_SWIFT_BUILD_DUMMY_WORKER=1

View File

@ -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];
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<PeerId, Peer>()
let interaction = ChatListNodeInteraction(activateSearch: {}, peerSelected: { _, _ in }, disabledPeerSelected: { _ in }, togglePeerSelected: { _ in }, additionalCategorySelected: { _ in

View File

@ -151,7 +151,7 @@ private final class ItemNode: ASDisplayNode {
}
enum ChatListSearchFilterEntryId: Hashable {
case filter(Int32)
case filter(Int64)
}
enum ChatListSearchFilterEntry: Equatable {

View File

@ -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<PeerId, Peer>()
peers[peer1.id] = peer1

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -66,7 +66,7 @@ typedef enum {
@interface TGUser : NSObject <PSCoding>
@property (nonatomic) int uid;
@property (nonatomic) int64_t uid;
@property (nonatomic, strong) NSString *phoneNumber;
@property (nonatomic) int64_t phoneNumberHash;
@property (nonatomic, strong) NSString *firstName;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>()

View File

@ -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<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>()

View File

@ -221,14 +221,14 @@ private final class TextSizeSelectionControllerNode: ASDisplayNode, UIScrollView
let peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>()
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<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>()

View File

@ -790,11 +790,11 @@ final class ThemeAccentColorControllerNode: ASDisplayNode, UIScrollViewDelegate
let peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>()
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<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>()

View File

@ -367,14 +367,14 @@ final class ThemePreviewControllerNode: ASDisplayNode, UIScrollViewDelegate {
let peers = SimpleDictionary<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>()
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<PeerId, Peer>()
var messages = SimpleDictionary<MessageId, Message>()

View File

@ -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<PeerId, Peer>()

View File

@ -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<PeerId, Peer>()
let messages = SimpleDictionary<MessageId, Message>()

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -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<Api.messages.Chats>) {
public static func getChats(id: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
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<Api.messages.ChatFull>) {
public static func getFullChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ChatFull>) {
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<Api.Updates>) {
public static func editChatTitle(chatId: Int64, title: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
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<Api.Updates>) {
public static func editChatPhoto(chatId: Int64, photo: Api.InputChatPhoto) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
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<Api.Updates>) {
public static func addChatUser(chatId: Int64, userId: Api.InputUser, fwdLimit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
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<Api.Updates>) {
public static func deleteChatUser(flags: Int32, chatId: Int64, userId: Api.InputUser) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
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<Api.Bool>) {
public static func editChatAdmin(chatId: Int64, userId: Api.InputUser, isAdmin: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
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<Api.Updates>) {
public static func migrateChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
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<Api.messages.Chats>) {
public static func getCommonChats(userId: Api.InputUser, maxId: Int64, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
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<Api.messages.Chats>) {
public static func getAllChats(exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
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<Api.Bool>) {
public static func deleteChat(chatId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
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<Api.auth.Authorization>) {
public static func importAuthorization(id: Int64, bytes: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
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<Api.auth.Authorization>) {
public static func recoverPassword(flags: Int32, code: String, newSettings: Api.account.PasswordInputSettings?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.Authorization>) {
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<Api.auth.LoginToken>) {
public static func exportLoginToken(apiId: Int32, apiHash: String, exceptIds: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.auth.LoginToken>) {
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<Api.Bool>) {
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<Api.DataJSON>) {
@ -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<Api.Bool>) {
public static func registerDevice(flags: Int32, tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
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<Api.Bool>) {
public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int64]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
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<Api.account.AuthorizationForm>) {
public static func getAuthorizationForm(botId: Int64, scope: String, publicKey: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.account.AuthorizationForm>) {
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<Api.Bool>) {
public static func acceptAuthorization(botId: Int64, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
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<Api.account.ResetPasswordResult>) {
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<Api.Bool>) {
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<Api.LangPackDifference>) {

View File

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

View File

@ -241,7 +241,7 @@ private final class CallRatingAlertContentNode: AlertContentNode {
}
func rateCallAndSendLogs(account: Account, callId: CallId, starsCount: Int, comment: String, userInitiated: Bool, includeLogs: Bool) -> Signal<Void, NoError> {
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 {

View File

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

View File

@ -377,8 +377,7 @@ public func twoStepAuthData(_ network: Network) -> Signal<TwoStepAuthData, MTRpc
return network.request(Api.functions.account.getPassword())
|> 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

View File

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

View File

@ -18,7 +18,7 @@ public func addGroupMember(account: Account, peerId: PeerId, memberId: PeerId) -
return account.postbox.transaction { transaction -> Signal<Void, AddGroupMemberError> 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":

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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: [])
}
}

View File

@ -374,7 +374,7 @@ public enum PasswordRecoveryError {
}
public func performPasswordRecovery(accountManager: AccountManager, account: UnauthorizedAccount, code: String, syncContacts: Bool) -> Signal<Void, PasswordRecoveryError> {
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ public func returnGroup(account: Account, peerId: PeerId) -> Signal<Void, NoErro
|> take(1)
|> mapToSignal { peer -> Signal<Void, NoError> 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<Void, NoError> in
account.stateManager.addUpdates(updates)
@ -26,7 +26,7 @@ public func leftGroup(account: Account, peerId: PeerId) -> Signal<Void, NoError>
|> take(1)
|> mapToSignal { peer -> Signal<Void, NoError> 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<Void, NoError> in
account.stateManager.addUpdates(updates)

View File

@ -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<Api.messages.Chats?, NoError> in
return .single(nil)

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@ public func removeGroupAdmin(account: Account, peerId: PeerId, adminId: PeerId)
return account.postbox.transaction { transaction -> Signal<Void, RemoveGroupAdminError> 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<Void, RemoveGroupAdminError> 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<Void, AddGroupAdminError> 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<Api.Bool, AddGroupAdminError> 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
}

View File

@ -214,7 +214,7 @@ public func updatePeerPhotoInternal(postbox: Postbox, network: Network, stateMan
let request: Signal<Api.Updates, MTRpcError>
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<Api.Updates, MTRpcError>
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 {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ public func removePeerMember(account: Account, peerId: PeerId, memberId: PeerId)
return account.postbox.transaction { transaction -> Signal<Void, NoError> 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()
}

View File

@ -10,7 +10,7 @@ public func reportPeer(account: Account, peerId: PeerId) -> Signal<Void, NoError
return account.postbox.transaction { transaction -> Signal<Void, NoError> 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<Api.Bool?, NoError> in
return .single(nil)

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ private func peerIdsFromUpdateGroups(_ groups: [UpdateGroup]) -> Set<PeerId> {
}
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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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())
}
}

View File

@ -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<Void, NoError>
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
}

View File

@ -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<Api.Bool, NoError> in
return .single(.boolFalse)
}

View File

@ -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<Api.messages.SentEncryptedMessage, MTRpcError>
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<Void, NoError> 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<Api.Bool?, NoError> in
return .single(nil)

View File

@ -83,7 +83,7 @@ func managedSynchronizePinnedChatsOperations(postbox: Postbox, network: Network,
let signal = withTakenOperation(postbox: postbox, peerId: entry.peerId, tagLocalIndex: entry.tagLocalIndex, { transaction, entry -> Signal<Void, NoError> 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()
}

View File

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

View File

@ -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()
}

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More