2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Track stars-per-message for users and channels.

This commit is contained in:
John Preston
2025-02-13 14:12:19 +04:00
parent f2aa3afbbb
commit 45c7829cd8
10 changed files with 239 additions and 102 deletions

View File

@@ -532,6 +532,17 @@ bool UserData::readDatesPrivate() const {
return (flags() & UserDataFlag::ReadDatesPrivate);
}
int UserData::starsPerMessage() const {
return _starsPerMessage;
}
void UserData::setStarsPerMessage(int stars) {
if (_starsPerMessage != stars) {
_starsPerMessage = stars;
session().changes().peerUpdated(this, UpdateFlag::StarsPerMessage);
}
}
bool UserData::canAddContact() const {
return canShareThisContact() && !isContact();
}
@@ -722,6 +733,8 @@ void ApplyUserUpdate(not_null<UserData*> user, const MTPDuserFull &update) {
user->setTranslationDisabled(update.is_translations_disabled());
user->setPrivateForwardName(
update.vprivate_forward_name().value_or_empty());
user->setStarsPerMessage(
update.vsend_paid_messages_stars().value_or_empty());
if (const auto info = user->botInfo.get()) {
const auto group = update.vbot_group_admin_rights()