2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Update API scheme to layer 148, start forums.

This commit is contained in:
John Preston
2022-09-20 13:35:47 +04:00
parent 87b228b256
commit c88140e256
25 changed files with 349 additions and 40 deletions

View File

@@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h"
#include "data/data_session.h"
#include "data/data_folder.h"
#include "data/data_forum.h"
#include "data/data_location.h"
#include "data/data_histories.h"
#include "data/data_group_call.h"
@@ -34,6 +35,10 @@ using UpdateFlag = Data::PeerUpdate::Flag;
} // namespace
MegagroupInfo::MegagroupInfo() = default;
MegagroupInfo::~MegagroupInfo() = default;
ChatData *MegagroupInfo::getMigrateFromChat() const {
return _migratedFrom;
}
@@ -55,6 +60,20 @@ Data::ChatBotCommands::Changed MegagroupInfo::setBotCommands(
return _botCommands.update(list);
}
void MegagroupInfo::setIsForum(bool is) {
if (is == (_forum != nullptr)) {
return;
} else if (is) {
_forum = std::make_unique<Data::Forum>();
} else {
_forum = nullptr;
}
}
Data::Forum *MegagroupInfo::forum() const {
return _forum.get();
}
ChannelData::ChannelData(not_null<Data::Session*> owner, PeerId id)
: PeerData(owner, id)
, inputChannel(
@@ -78,6 +97,10 @@ ChannelData::ChannelData(not_null<Data::Session*> owner, PeerId id)
mgInfo = nullptr;
}
}
if (change.diff & Flag::Forum) {
Assert(mgInfo != nullptr);
mgInfo->setIsForum(change.value & Flag::Forum);
}
if (change.diff & Flag::CallNotEmpty) {
if (const auto history = this->owner().historyLoaded(this)) {
history->updateChatListEntry();