2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Update API scheme to layer 115.

This commit is contained in:
John Preston
2020-07-01 18:19:25 +04:00
parent 9370e87c54
commit 638d4d63c5
17 changed files with 414 additions and 224 deletions

View File

@@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "history/history.h"
#include "main/main_session.h"
#include "api/api_chat_invite.h"
#include "apiwrap.h"
namespace {
@@ -632,6 +633,40 @@ void ChannelData::growSlowmodeLastMessage(TimeId when) {
session().changes().peerUpdated(this, UpdateFlag::Slowmode);
}
void ChannelData::setInvitePeek(const QString &hash, TimeId expires) {
if (!_invitePeek) {
_invitePeek = std::make_unique<InvitePeek>();
}
_invitePeek->hash = hash;
_invitePeek->expires = expires;
}
void ChannelData::clearInvitePeek() {
_invitePeek = nullptr;
}
TimeId ChannelData::invitePeekExpires() const {
return _invitePeek ? _invitePeek->expires : 0;
}
QString ChannelData::invitePeekHash() const {
return _invitePeek ? _invitePeek->hash : QString();
}
void ChannelData::privateErrorReceived() {
if (const auto expires = invitePeekExpires()) {
const auto hash = invitePeekHash();
for (const auto window : session().windows()) {
clearInvitePeek();
Api::CheckChatInvite(window, hash, this);
return;
}
_invitePeek->expires = base::unixtime::now();
} else {
markForbidden();
}
}
namespace Data {
void ApplyMigration(