mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Update API scheme, track stars-per-message.
This commit is contained in:
@@ -532,14 +532,22 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
||||
| Flag::BotInlineGeo
|
||||
| Flag::Premium
|
||||
| Flag::Support
|
||||
| Flag::SomeRequirePremiumToWrite
|
||||
| Flag::RequirePremiumToWriteKnown
|
||||
| Flag::HasRequirePremiumToWrite
|
||||
| Flag::HasStarsPerMessage
|
||||
| Flag::MessageMoneyRestrictionsKnown
|
||||
| (!minimal
|
||||
? Flag::Contact
|
||||
| Flag::MutualContact
|
||||
| Flag::DiscardMinPhoto
|
||||
| Flag::StoriesHidden
|
||||
: Flag());
|
||||
const auto hasRequirePremiumToWrite
|
||||
= data.is_contact_require_premium();
|
||||
const auto hasStarsPerMessage
|
||||
= data.vsend_paid_messages_stars().has_value();
|
||||
if (!hasStarsPerMessage) {
|
||||
result->setStarsPerMessage(0);
|
||||
}
|
||||
const auto storiesState = minimal
|
||||
? std::optional<Data::Stories::PeerSourceState>()
|
||||
: data.is_stories_unavailable()
|
||||
@@ -554,14 +562,25 @@ not_null<UserData*> Session::processUser(const MTPUser &data) {
|
||||
| (data.is_bot_inline_geo() ? Flag::BotInlineGeo : Flag())
|
||||
| (data.is_premium() ? Flag::Premium : Flag())
|
||||
| (data.is_support() ? Flag::Support : Flag())
|
||||
| (data.is_contact_require_premium()
|
||||
? (Flag::SomeRequirePremiumToWrite
|
||||
| (result->someRequirePremiumToWrite()
|
||||
? (result->requirePremiumToWriteKnown()
|
||||
? Flag::RequirePremiumToWriteKnown
|
||||
| (hasRequirePremiumToWrite
|
||||
? (Flag::HasRequirePremiumToWrite
|
||||
| (result->hasRequirePremiumToWrite()
|
||||
? (result->messageMoneyRestrictionsKnown()
|
||||
? Flag::MessageMoneyRestrictionsKnown
|
||||
: Flag())
|
||||
: Flag()))
|
||||
: Flag())
|
||||
| (hasStarsPerMessage
|
||||
? (Flag::HasStarsPerMessage
|
||||
| (result->hasStarsPerMessage()
|
||||
? (result->messageMoneyRestrictionsKnown()
|
||||
? Flag::MessageMoneyRestrictionsKnown
|
||||
: Flag())
|
||||
: Flag()))
|
||||
: Flag())
|
||||
| ((!hasRequirePremiumToWrite && !hasStarsPerMessage)
|
||||
? Flag::MessageMoneyRestrictionsKnown
|
||||
: Flag())
|
||||
| (!minimal
|
||||
? (data.is_contact() ? Flag::Contact : Flag())
|
||||
| (data.is_mutual_contact() ? Flag::MutualContact : Flag())
|
||||
@@ -999,6 +1018,8 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
||||
}
|
||||
|
||||
channel->setPhoto(data.vphoto());
|
||||
channel->setStarsPerMessage(
|
||||
data.vsend_paid_messages_stars().value_or_empty());
|
||||
|
||||
if (wasInChannel != channel->amIn()) {
|
||||
flags |= UpdateFlag::ChannelAmIn;
|
||||
@@ -4631,7 +4652,8 @@ void Session::serviceNotification(
|
||||
MTPPeerColor(), // color
|
||||
MTPPeerColor(), // profile_color
|
||||
MTPint(), // bot_active_users
|
||||
MTPlong())); // bot_verification_icon
|
||||
MTPlong(), // bot_verification_icon
|
||||
MTPlong())); // send_paid_messages_stars
|
||||
}
|
||||
const auto history = this->history(PeerData::kServiceNotificationsId);
|
||||
const auto insert = [=] {
|
||||
|
Reference in New Issue
Block a user