API update: added support account flag

This commit is contained in:
Ilya Laktyushin 2019-02-15 21:19:32 +04:00
parent 98b233aa2d
commit 90fd9374a3
4 changed files with 37 additions and 26 deletions

View File

@ -1066,7 +1066,7 @@ private func finalStateWithUpdatesAndServerTime(postbox: Postbox, network: Netwo
} }
return previous.withUpdatedPinnedMessageId(id == 0 ? nil : MessageId(peerId: userPeerId, namespace: Namespaces.Message.Cloud, id: id)) return previous.withUpdatedPinnedMessageId(id == 0 ? nil : MessageId(peerId: userPeerId, namespace: Namespaces.Message.Cloud, id: id))
}) })
case let .updateChatPinnedMessage(groupId, id): case let .updateChatPinnedMessage(groupId, id, version):
let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: groupId) let groupPeerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: groupId)
updatedState.updateCachedPeerData(groupPeerId, { current in updatedState.updateCachedPeerData(groupPeerId, { current in
let previous: CachedGroupData let previous: CachedGroupData

View File

@ -223,9 +223,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) } dict[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) }
dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) } dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) }
dict[1279515160] = { return Api.Update.parse_updateUserPinnedMessage($0) } dict[1279515160] = { return Api.Update.parse_updateUserPinnedMessage($0) }
dict[579418918] = { return Api.Update.parse_updateChatPinnedMessage($0) }
dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) } dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) }
dict[1421875280] = { return Api.Update.parse_updateChatDefaultBannedRights($0) } dict[1421875280] = { return Api.Update.parse_updateChatDefaultBannedRights($0) }
dict[-519195831] = { return Api.Update.parse_updateChatPinnedMessage($0) }
dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) } dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) }
dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) } dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) }
dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) } dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) }

View File

@ -3802,9 +3802,9 @@ extension Api {
case updateDialogUnreadMark(flags: Int32, peer: Api.DialogPeer) case updateDialogUnreadMark(flags: Int32, peer: Api.DialogPeer)
case updateLangPackTooLong(langCode: String) case updateLangPackTooLong(langCode: String)
case updateUserPinnedMessage(userId: Int32, id: Int32) case updateUserPinnedMessage(userId: Int32, id: Int32)
case updateChatPinnedMessage(chatId: Int32, id: Int32)
case updateMessagePoll(flags: Int32, pollId: Int64, poll: Api.Poll?, results: Api.PollResults) case updateMessagePoll(flags: Int32, pollId: Int64, poll: Api.Poll?, results: Api.PollResults)
case updateChatDefaultBannedRights(peer: Api.Peer, defaultBannedRights: Api.ChatBannedRights, version: Int32) case updateChatDefaultBannedRights(peer: Api.Peer, defaultBannedRights: Api.ChatBannedRights, version: Int32)
case updateChatPinnedMessage(chatId: Int32, id: Int32, version: Int32)
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
@ -4351,13 +4351,6 @@ extension Api {
serializeInt32(userId, buffer: buffer, boxed: false) serializeInt32(userId, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false) serializeInt32(id, buffer: buffer, boxed: false)
break break
case .updateChatPinnedMessage(let chatId, let id):
if boxed {
buffer.appendInt32(579418918)
}
serializeInt32(chatId, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false)
break
case .updateMessagePoll(let flags, let pollId, let poll, let results): case .updateMessagePoll(let flags, let pollId, let poll, let results):
if boxed { if boxed {
buffer.appendInt32(-1398708869) buffer.appendInt32(-1398708869)
@ -4375,6 +4368,14 @@ extension Api {
defaultBannedRights.serialize(buffer, true) defaultBannedRights.serialize(buffer, true)
serializeInt32(version, buffer: buffer, boxed: false) serializeInt32(version, buffer: buffer, boxed: false)
break break
case .updateChatPinnedMessage(let chatId, let id, let version):
if boxed {
buffer.appendInt32(-519195831)
}
serializeInt32(chatId, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false)
serializeInt32(version, buffer: buffer, boxed: false)
break
} }
} }
@ -4512,12 +4513,12 @@ extension Api {
return ("updateLangPackTooLong", [("langCode", langCode)]) return ("updateLangPackTooLong", [("langCode", langCode)])
case .updateUserPinnedMessage(let userId, let id): case .updateUserPinnedMessage(let userId, let id):
return ("updateUserPinnedMessage", [("userId", userId), ("id", id)]) return ("updateUserPinnedMessage", [("userId", userId), ("id", id)])
case .updateChatPinnedMessage(let chatId, let id):
return ("updateChatPinnedMessage", [("chatId", chatId), ("id", id)])
case .updateMessagePoll(let flags, let pollId, let poll, let results): case .updateMessagePoll(let flags, let pollId, let poll, let results):
return ("updateMessagePoll", [("flags", flags), ("pollId", pollId), ("poll", poll), ("results", results)]) return ("updateMessagePoll", [("flags", flags), ("pollId", pollId), ("poll", poll), ("results", results)])
case .updateChatDefaultBannedRights(let peer, let defaultBannedRights, let version): case .updateChatDefaultBannedRights(let peer, let defaultBannedRights, let version):
return ("updateChatDefaultBannedRights", [("peer", peer), ("defaultBannedRights", defaultBannedRights), ("version", version)]) return ("updateChatDefaultBannedRights", [("peer", peer), ("defaultBannedRights", defaultBannedRights), ("version", version)])
case .updateChatPinnedMessage(let chatId, let id, let version):
return ("updateChatPinnedMessage", [("chatId", chatId), ("id", id), ("version", version)])
} }
} }
@ -5614,20 +5615,6 @@ extension Api {
return nil return nil
} }
} }
static func parse_updateChatPinnedMessage(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.Update.updateChatPinnedMessage(chatId: _1!, id: _2!)
}
else {
return nil
}
}
static func parse_updateMessagePoll(_ reader: BufferReader) -> Update? { static func parse_updateMessagePoll(_ reader: BufferReader) -> Update? {
var _1: Int32? var _1: Int32?
_1 = reader.readInt32() _1 = reader.readInt32()
@ -5673,6 +5660,23 @@ extension Api {
return nil return nil
} }
} }
static func parse_updateChatPinnedMessage(_ reader: BufferReader) -> Update? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.Update.updateChatPinnedMessage(chatId: _1!, id: _2!, version: _3!)
}
else {
return nil
}
}
} }
enum PopularContact: TypeConstructorDescription { enum PopularContact: TypeConstructorDescription {

View File

@ -17,6 +17,7 @@ public struct UserInfoFlags: OptionSet {
} }
public static let isVerified = UserInfoFlags(rawValue: (1 << 0)) public static let isVerified = UserInfoFlags(rawValue: (1 << 0))
public static let isSupport = UserInfoFlags(rawValue: (1 << 1))
} }
public struct BotUserInfoFlags: OptionSet { public struct BotUserInfoFlags: OptionSet {
@ -272,6 +273,9 @@ extension TelegramUser {
if (flags & (1 << 17)) != 0 { if (flags & (1 << 17)) != 0 {
userFlags.insert(.isVerified) userFlags.insert(.isVerified)
} }
if (flags & (1 << 23)) != 0 {
userFlags.insert(.isSupport)
}
var botInfo: BotUserInfo? var botInfo: BotUserInfo?
if (flags & (1 << 14)) != 0 { if (flags & (1 << 14)) != 0 {
@ -308,6 +312,9 @@ extension TelegramUser {
if (flags & (1 << 17)) != 0 { if (flags & (1 << 17)) != 0 {
userFlags.insert(.isVerified) userFlags.insert(.isVerified)
} }
if (flags & (1 << 23)) != 0 {
userFlags.insert(.isSupport)
}
var botInfo: BotUserInfo? var botInfo: BotUserInfo?
if (flags & (1 << 14)) != 0 { if (flags & (1 << 14)) != 0 {