2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-05 00:55:12 +00:00

Implement new permanent invite link management.

This commit is contained in:
John Preston
2021-01-14 17:13:43 +04:00
parent 02ad5f2772
commit e5320b4b4e
29 changed files with 385 additions and 280 deletions

View File

@@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "main/main_session.h"
#include "api/api_chat_invite.h"
#include "api/api_invite_links.h"
#include "apiwrap.h"
namespace {
@@ -98,10 +99,7 @@ void ChannelData::setAccessHash(uint64 accessHash) {
}
void ChannelData::setInviteLink(const QString &newInviteLink) {
if (newInviteLink != _inviteLink) {
_inviteLink = newInviteLink;
session().changes().peerUpdated(this, UpdateFlag::InviteLink);
}
_inviteLink = newInviteLink;
}
bool ChannelData::canHaveInviteLink() const {
@@ -778,11 +776,11 @@ void ApplyChannelUpdate(
next->v - channel->slowmodeSeconds());
}
if (const auto invite = update.vexported_invite()) {
invite->match([&](const MTPDchatInviteExported &data) {
channel->setInviteLink(qs(data.vlink()));
});
channel->session().api().inviteLinks().setPermanent(
channel,
*invite);
} else {
channel->setInviteLink(QString());
channel->session().api().inviteLinks().clearPermanent(channel);
}
if (const auto location = update.vlocation()) {
channel->setLocation(*location);