2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Update API scheme to layer 133.

This commit is contained in:
John Preston
2021-08-25 11:15:05 +03:00
parent ce7a3c354c
commit a6c98f4bb4
61 changed files with 618 additions and 615 deletions

View File

@@ -59,7 +59,7 @@ bool MegagroupInfo::updateBotCommands(
ChannelData::ChannelData(not_null<Data::Session*> owner, PeerId id)
: PeerData(owner, id)
, inputChannel(
MTP_inputChannel(MTP_int(peerToChannel(id).bare), MTP_long(0)))
MTP_inputChannel(MTP_long(peerToChannel(id).bare), MTP_long(0)))
, _ptsWaiter(&owner->session().updates()) {
_flags.changes(
) | rpl::start_with_next([=](const Flags::Change &change) {
@@ -101,8 +101,8 @@ void ChannelData::setName(const QString &newName, const QString &newUsername) {
void ChannelData::setAccessHash(uint64 accessHash) {
access = accessHash;
input = MTP_inputPeerChannel(MTP_int(peerToChannel(id).bare), MTP_long(accessHash)); // #TODO ids
inputChannel = MTP_inputChannel(MTP_int(peerToChannel(id).bare), MTP_long(accessHash));
input = MTP_inputPeerChannel(MTP_long(peerToChannel(id).bare), MTP_long(accessHash));
inputChannel = MTP_inputChannel(MTP_long(peerToChannel(id).bare), MTP_long(accessHash));
}
void ChannelData::setInviteLink(const QString &newInviteLink) {
@@ -352,7 +352,7 @@ void ChannelData::markForbidden() {
MTP_flags(isMegagroup()
? MTPDchannelForbidden::Flag::f_megagroup
: MTPDchannelForbidden::Flag::f_broadcast),
MTP_int(peerToChannel(id).bare),
MTP_long(peerToChannel(id).bare),
MTP_long(access),
MTP_string(name),
MTPint()));
@@ -593,17 +593,6 @@ void ChannelData::setDefaultRestrictions(ChatRestrictions rights) {
session().changes().peerUpdated(this, UpdateFlag::Rights);
}
auto ChannelData::applyUpdateVersion(int version) -> UpdateStatus {
if (_version > version) {
return UpdateStatus::TooOld;
} else if (_version + 1 < version) {
session().api().requestPeer(this);
return UpdateStatus::Skipped;
}
setVersion(version);
return UpdateStatus::Good;
}
ChatData *ChannelData::getMigrateFromChat() const {
if (const auto info = mgInfo.get()) {
return info->getMigrateFromChat();
@@ -755,10 +744,6 @@ void ApplyMigration(
void ApplyChannelUpdate(
not_null<ChannelData*> channel,
const MTPDupdateChatDefaultBannedRights &update) {
if (channel->applyUpdateVersion(update.vversion().v)
!= ChannelData::UpdateStatus::Good) {
return;
}
channel->setDefaultRestrictions(Data::ChatBannedRightsFlags(
update.vdefault_banned_rights()));
}