aboutsummaryrefslogtreecommitdiffhomepage
path: root/td/telegram/StarGift.cpp
diff options
context:
space:
mode:
authorlevlam <levlam@telegram.org>2025-12-04 18:09:06 +0300
committerlevlam <levlam@telegram.org>2025-12-04 18:09:06 +0300
commit99234441d68e2ab48adc08f13664534e389ca276 (patch)
treeacb221630fc195ff7e530cf3d0724cfcab1b5ba5 /td/telegram/StarGift.cpp
parentc2d7e3d057842869fd414dba79b9a8c4624570a7 (diff)
Add gift.background.
Diffstat (limited to 'td/telegram/StarGift.cpp')
-rw-r--r--td/telegram/StarGift.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/td/telegram/StarGift.cpp b/td/telegram/StarGift.cpp
index 38e49445a..70c293035 100644
--- a/td/telegram/StarGift.cpp
+++ b/td/telegram/StarGift.cpp
@@ -181,6 +181,9 @@ StarGift::StarGift(Td *td, telegram_api::object_ptr<telegram_api::StarGift> &&st
auction_slug_ = std::move(star_gift->auction_slug_);
gifts_per_round_ = max(0, star_gift->gifts_per_round_);
locked_until_date_ = max(0, star_gift->locked_until_date_);
+ if (star_gift->background_ != nullptr) {
+ background_ = make_unique_value<StarGiftBackground>(star_gift->background_);
+ }
}
td_api::object_ptr<td_api::giftPurchaseLimits> StarGift::get_gift_purchase_limits_object(int32 total, int32 remains) {
@@ -197,12 +200,17 @@ td_api::object_ptr<td_api::gift> StarGift::get_gift_object(const Td *td) const {
if (is_auction_) {
gift_auction = td_api::make_object<td_api::giftAuction>(auction_slug_, gifts_per_round_);
}
- return td_api::make_object<td_api::gift>(
- id_, td->dialog_manager_->get_chat_id_object(released_by_dialog_id_, "gift"),
- td->stickers_manager_->get_sticker_object(sticker_file_id_), star_count_, default_sell_star_count_,
- upgrade_star_count_, has_colors_, is_for_birthday_, is_premium_, std::move(gift_auction), locked_until_date_,
- get_gift_purchase_limits_object(per_user_total_, per_user_remains_),
- get_gift_purchase_limits_object(availability_total_, availability_remains_), first_sale_date_, last_sale_date_);
+ td_api::object_ptr<td_api::giftBackground> background;
+ if (background_ != nullptr) {
+ background = background_->get_gift_background_object();
+ }
+ return td_api::make_object<td_api::gift>(id_, td->dialog_manager_->get_chat_id_object(released_by_dialog_id_, "gift"),
+ td->stickers_manager_->get_sticker_object(sticker_file_id_), star_count_,
+ default_sell_star_count_, upgrade_star_count_, has_colors_, is_for_birthday_,
+ is_premium_, std::move(gift_auction), locked_until_date_,
+ get_gift_purchase_limits_object(per_user_total_, per_user_remains_),
+ get_gift_purchase_limits_object(availability_total_, availability_remains_),
+ std::move(background), first_sale_date_, last_sale_date_);
}
td_api::object_ptr<td_api::upgradedGift> StarGift::get_upgraded_gift_object(Td *td) const {
@@ -273,7 +281,7 @@ bool operator==(const StarGift &lhs, const StarGift &rhs) {
lhs.resale_star_count_ == rhs.resale_star_count_ && lhs.resale_ton_count_ == rhs.resale_ton_count_ &&
lhs.regular_gift_id_ == rhs.regular_gift_id_ && lhs.value_currency_ == rhs.value_currency_ &&
lhs.value_amount_ == rhs.value_amount_ && lhs.theme_dialog_id_ == rhs.theme_dialog_id_ &&
- lhs.peer_color_ == rhs.peer_color_;
+ lhs.peer_color_ == rhs.peer_color_ && lhs.background_ == rhs.background_;
}
StringBuilder &operator<<(StringBuilder &string_builder, const StarGift &star_gift) {