Update TDLib to 1.8.36.

This commit is contained in:
levlam 2024-08-27 17:42:44 +03:00
parent 6e5d607b90
commit 240eb7b4a9
2 changed files with 55 additions and 33 deletions

2
td

@ -1 +1 @@
Subproject commit 8d08b34e22a08e58db8341839c4e18ee06c516c5 Subproject commit 87d881071fe514936bb17029e96761141287d2be

View File

@ -2421,8 +2421,7 @@ class Client::JsonChatShared final : public td::Jsonable {
class Client::JsonGiveaway final : public td::Jsonable { class Client::JsonGiveaway final : public td::Jsonable {
public: public:
JsonGiveaway(const td_api::messagePremiumGiveaway *giveaway, const Client *client) JsonGiveaway(const td_api::messageGiveaway *giveaway, const Client *client) : giveaway_(giveaway), client_(client) {
: giveaway_(giveaway), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object(); auto object = scope->enter_object();
@ -2447,19 +2446,29 @@ class Client::JsonGiveaway final : public td::Jsonable {
if (!giveaway_->parameters_->prize_description_.empty()) { if (!giveaway_->parameters_->prize_description_.empty()) {
object("prize_description", giveaway_->parameters_->prize_description_); object("prize_description", giveaway_->parameters_->prize_description_);
} }
if (giveaway_->month_count_ > 0) { switch (giveaway_->prize_->get_id()) {
object("premium_subscription_month_count", giveaway_->month_count_); case td_api::giveawayPrizePremium::ID: {
auto month_count = static_cast<const td_api::giveawayPrizePremium *>(giveaway_->prize_.get())->month_count_;
if (month_count > 0) {
object("premium_subscription_month_count", month_count);
}
break;
}
case td_api::giveawayPrizeStars::ID:
break;
default:
UNREACHABLE();
} }
} }
private: private:
const td_api::messagePremiumGiveaway *giveaway_; const td_api::messageGiveaway *giveaway_;
const Client *client_; const Client *client_;
}; };
class Client::JsonGiveawayWinners final : public td::Jsonable { class Client::JsonGiveawayWinners final : public td::Jsonable {
public: public:
JsonGiveawayWinners(const td_api::messagePremiumGiveawayWinners *giveaway_winners, const Client *client) JsonGiveawayWinners(const td_api::messageGiveawayWinners *giveaway_winners, const Client *client)
: giveaway_winners_(giveaway_winners), client_(client) { : giveaway_winners_(giveaway_winners), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
@ -2476,8 +2485,19 @@ class Client::JsonGiveawayWinners final : public td::Jsonable {
if (giveaway_winners_->was_refunded_) { if (giveaway_winners_->was_refunded_) {
object("was_refunded", td::JsonTrue()); object("was_refunded", td::JsonTrue());
} }
if (giveaway_winners_->month_count_ > 0) { switch (giveaway_winners_->prize_->get_id()) {
object("premium_subscription_month_count", giveaway_winners_->month_count_); case td_api::giveawayPrizePremium::ID: {
auto month_count =
static_cast<const td_api::giveawayPrizePremium *>(giveaway_winners_->prize_.get())->month_count_;
if (month_count > 0) {
object("premium_subscription_month_count", month_count);
}
break;
}
case td_api::giveawayPrizeStars::ID:
break;
default:
UNREACHABLE();
} }
if (!giveaway_winners_->prize_description_.empty()) { if (!giveaway_winners_->prize_description_.empty()) {
object("prize_description", giveaway_winners_->prize_description_); object("prize_description", giveaway_winners_->prize_description_);
@ -2490,14 +2510,13 @@ class Client::JsonGiveawayWinners final : public td::Jsonable {
} }
private: private:
const td_api::messagePremiumGiveawayWinners *giveaway_winners_; const td_api::messageGiveawayWinners *giveaway_winners_;
const Client *client_; const Client *client_;
}; };
class Client::JsonGiveawayCompleted final : public td::Jsonable { class Client::JsonGiveawayCompleted final : public td::Jsonable {
public: public:
JsonGiveawayCompleted(const td_api::messagePremiumGiveawayCompleted *giveaway_completed, int64 chat_id, JsonGiveawayCompleted(const td_api::messageGiveawayCompleted *giveaway_completed, int64 chat_id, const Client *client)
const Client *client)
: giveaway_completed_(giveaway_completed), chat_id_(chat_id), client_(client) { : giveaway_completed_(giveaway_completed), chat_id_(chat_id), client_(client) {
} }
void store(td::JsonValueScope *scope) const { void store(td::JsonValueScope *scope) const {
@ -2514,7 +2533,7 @@ class Client::JsonGiveawayCompleted final : public td::Jsonable {
} }
private: private:
const td_api::messagePremiumGiveawayCompleted *giveaway_completed_; const td_api::messageGiveawayCompleted *giveaway_completed_;
int64 chat_id_; int64 chat_id_;
const Client *client_; const Client *client_;
}; };
@ -2767,13 +2786,13 @@ class Client::JsonExternalReplyInfo final : public td::Jsonable {
} }
case td_api::messageUnsupported::ID: case td_api::messageUnsupported::ID:
break; break;
case td_api::messagePremiumGiveaway::ID: { case td_api::messageGiveaway::ID: {
auto content = static_cast<const td_api::messagePremiumGiveaway *>(reply_->content_.get()); auto content = static_cast<const td_api::messageGiveaway *>(reply_->content_.get());
object("giveaway", JsonGiveaway(content, client_)); object("giveaway", JsonGiveaway(content, client_));
break; break;
} }
case td_api::messagePremiumGiveawayWinners::ID: { case td_api::messageGiveawayWinners::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayWinners *>(reply_->content_.get()); auto content = static_cast<const td_api::messageGiveawayWinners *>(reply_->content_.get());
object("giveaway_winners", JsonGiveawayWinners(content, client_)); object("giveaway_winners", JsonGiveawayWinners(content, client_));
break; break;
} }
@ -3271,21 +3290,21 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
} }
case td_api::messagePremiumGiftCode::ID: case td_api::messagePremiumGiftCode::ID:
break; break;
case td_api::messagePremiumGiveawayCreated::ID: case td_api::messageGiveawayCreated::ID:
object("giveaway_created", JsonEmptyObject()); object("giveaway_created", JsonEmptyObject());
break; break;
case td_api::messagePremiumGiveaway::ID: { case td_api::messageGiveaway::ID: {
auto content = static_cast<const td_api::messagePremiumGiveaway *>(message_->content.get()); auto content = static_cast<const td_api::messageGiveaway *>(message_->content.get());
object("giveaway", JsonGiveaway(content, client_)); object("giveaway", JsonGiveaway(content, client_));
break; break;
} }
case td_api::messagePremiumGiveawayWinners::ID: { case td_api::messageGiveawayWinners::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayWinners *>(message_->content.get()); auto content = static_cast<const td_api::messageGiveawayWinners *>(message_->content.get());
object("giveaway_winners", JsonGiveawayWinners(content, client_)); object("giveaway_winners", JsonGiveawayWinners(content, client_));
break; break;
} }
case td_api::messagePremiumGiveawayCompleted::ID: { case td_api::messageGiveawayCompleted::ID: {
auto content = static_cast<const td_api::messagePremiumGiveawayCompleted *>(message_->content.get()); auto content = static_cast<const td_api::messageGiveawayCompleted *>(message_->content.get());
object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_)); object("giveaway_completed", JsonGiveawayCompleted(content, message_->chat_id, client_));
break; break;
} }
@ -3301,6 +3320,8 @@ void Client::JsonMessage::store(td::JsonValueScope *scope) const {
} }
case td_api::messageGiftedStars::ID: case td_api::messageGiftedStars::ID:
break; break;
case td_api::messageGiveawayPrizeStars::ID:
break;
default: default:
UNREACHABLE(); UNREACHABLE();
} }
@ -4142,7 +4163,7 @@ class Client::JsonStarTransactionPartner final : public td::Jsonable {
case td_api::starTransactionPartnerGooglePlay::ID: case td_api::starTransactionPartnerGooglePlay::ID:
case td_api::starTransactionPartnerUser::ID: case td_api::starTransactionPartnerUser::ID:
case td_api::starTransactionPartnerBusiness::ID: case td_api::starTransactionPartnerBusiness::ID:
case td_api::starTransactionPartnerChannel::ID: case td_api::starTransactionPartnerChat::ID:
LOG(ERROR) << "Receive " << to_string(*source_); LOG(ERROR) << "Receive " << to_string(*source_);
object("type", "other"); object("type", "other");
break; break;
@ -10362,7 +10383,7 @@ td::Status Client::process_send_paid_media_query(PromisedQueryPtr &query) {
TRY_RESULT(caption, get_caption(query.get())); TRY_RESULT(caption, get_caption(query.get()));
auto show_caption_above_media = to_bool(query->arg("show_caption_above_media")); auto show_caption_above_media = to_bool(query->arg("show_caption_above_media"));
do_send_message(make_object<td_api::inputMessagePaidMedia>(star_count, std::move(paid_media), std::move(caption), do_send_message(make_object<td_api::inputMessagePaidMedia>(star_count, std::move(paid_media), std::move(caption),
show_caption_above_media), show_caption_above_media, td::string()),
std::move(query)); std::move(query));
return td::Status::OK(); return td::Status::OK();
} }
@ -13758,10 +13779,10 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
case td_api::messageForumTopicEdited::ID: case td_api::messageForumTopicEdited::ID:
case td_api::messageForumTopicIsClosedToggled::ID: case td_api::messageForumTopicIsClosedToggled::ID:
case td_api::messageForumTopicIsHiddenToggled::ID: case td_api::messageForumTopicIsHiddenToggled::ID:
case td_api::messagePremiumGiveawayCreated::ID: case td_api::messageGiveawayCreated::ID:
case td_api::messagePremiumGiveaway::ID: case td_api::messageGiveaway::ID:
case td_api::messagePremiumGiveawayWinners::ID: case td_api::messageGiveawayWinners::ID:
case td_api::messagePremiumGiveawayCompleted::ID: case td_api::messageGiveawayCompleted::ID:
case td_api::messagePaymentRefunded::ID: case td_api::messagePaymentRefunded::ID:
// don't skip // don't skip
break; break;
@ -13873,6 +13894,8 @@ bool Client::need_skip_update_message(int64 chat_id, const object_ptr<td_api::me
return true; return true;
case td_api::messageGiftedStars::ID: case td_api::messageGiftedStars::ID:
return true; return true;
case td_api::messageGiveawayPrizeStars::ID:
return true;
default: default:
break; break;
} }
@ -13923,9 +13946,8 @@ td::int64 Client::get_same_chat_reply_to_message_id(const object_ptr<td_api::mes
case td_api::messageChatSetBackground::ID: case td_api::messageChatSetBackground::ID:
return static_cast<const td_api::messageChatSetBackground *>(message->content_.get()) return static_cast<const td_api::messageChatSetBackground *>(message->content_.get())
->old_background_message_id_; ->old_background_message_id_;
case td_api::messagePremiumGiveawayCompleted::ID: case td_api::messageGiveawayCompleted::ID:
return static_cast<const td_api::messagePremiumGiveawayCompleted *>(message->content_.get()) return static_cast<const td_api::messageGiveawayCompleted *>(message->content_.get())->giveaway_message_id_;
->giveaway_message_id_;
case td_api::messagePaymentSuccessful::ID: case td_api::messagePaymentSuccessful::ID:
UNREACHABLE(); UNREACHABLE();
return static_cast<int64>(0); return static_cast<int64>(0);