Add Chat.birthdate.

This commit is contained in:
levlam 2024-03-22 15:26:22 +03:00
parent f684e4c503
commit f706d88055
2 changed files with 23 additions and 0 deletions

View File

@ -724,6 +724,23 @@ class Client::JsonReactionCount final : public td::Jsonable {
const td_api::messageReaction *message_reaction_; const td_api::messageReaction *message_reaction_;
}; };
class Client::JsonBirthdate final : public td::Jsonable {
public:
explicit JsonBirthdate(const td_api::birthdate *birthdate) : birthdate_(birthdate) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
object("day", birthdate_->day_);
object("month", birthdate_->month_);
if (birthdate_->year_ != 0) {
object("year", birthdate_->year_);
}
}
private:
const td_api::birthdate *birthdate_;
};
class Client::JsonBusinessIntro final : public td::Jsonable { class Client::JsonBusinessIntro final : public td::Jsonable {
public: public:
JsonBusinessIntro(const td_api::businessIntro *intro, const Client *client) : intro_(intro), client_(client) { JsonBusinessIntro(const td_api::businessIntro *intro, const Client *client) : intro_(intro), client_(client) {
@ -948,6 +965,9 @@ class Client::JsonChat final : public td::Jsonable {
object("business_opening_hours", JsonBusinessOpeningHours(business_info->opening_hours_.get())); object("business_opening_hours", JsonBusinessOpeningHours(business_info->opening_hours_.get()));
} }
} }
if (user_info->birthdate != nullptr) {
object("birthdate", JsonBirthdate(user_info->birthdate.get()));
}
} }
photo = user_info->photo.get(); photo = user_info->photo.get();
break; break;
@ -6521,6 +6541,7 @@ void Client::on_update(object_ptr<td_api::Object> result) {
user_info->photo = user_info->photo =
full_info->photo_ == nullptr ? std::move(full_info->public_photo_) : std::move(full_info->photo_); full_info->photo_ == nullptr ? std::move(full_info->public_photo_) : std::move(full_info->photo_);
user_info->bio = full_info->bio_ != nullptr ? std::move(full_info->bio_->text_) : td::string(); user_info->bio = full_info->bio_ != nullptr ? std::move(full_info->bio_->text_) : td::string();
user_info->birthdate = std::move(full_info->birthdate_);
user_info->business_info = std::move(full_info->business_info_); user_info->business_info = std::move(full_info->business_info_);
user_info->has_private_forwards = full_info->has_private_forwards_; user_info->has_private_forwards = full_info->has_private_forwards_;
user_info->has_restricted_voice_and_video_messages = full_info->has_restricted_voice_and_video_note_messages_; user_info->has_restricted_voice_and_video_messages = full_info->has_restricted_voice_and_video_note_messages_;

View File

@ -93,6 +93,7 @@ class Client final : public WebhookActor::Callback {
class JsonUsers; class JsonUsers;
class JsonReactionType; class JsonReactionType;
class JsonReactionCount; class JsonReactionCount;
class JsonBirthdate;
class JsonBusinessIntro; class JsonBusinessIntro;
class JsonBusinessLocation; class JsonBusinessLocation;
class JsonBusinessOpeningHoursInterval; class JsonBusinessOpeningHoursInterval;
@ -802,6 +803,7 @@ class Client final : public WebhookActor::Callback {
object_ptr<td_api::chatPhoto> photo; object_ptr<td_api::chatPhoto> photo;
td::string bio; td::string bio;
object_ptr<td_api::birthdate> birthdate;
object_ptr<td_api::businessInfo> business_info; object_ptr<td_api::businessInfo> business_info;
bool have_access = false; bool have_access = false;