Add chat.business_location field.

This commit is contained in:
levlam 2024-03-18 14:26:39 +03:00
parent a872d60362
commit f1c1447185
2 changed files with 25 additions and 0 deletions

View File

@ -627,6 +627,22 @@ class Client::JsonReactionCount final : public td::Jsonable {
const td_api::messageReaction *message_reaction_;
};
class Client::JsonBusinessLocation final : public td::Jsonable {
public:
JsonBusinessLocation(const td_api::businessLocation *business_location) : business_location_(business_location) {
}
void store(td::JsonValueScope *scope) const {
auto object = scope->enter_object();
if (business_location_->location_ != nullptr) {
object("location", JsonLocation(business_location_->location_.get()));
}
object("address", business_location_->address_);
}
private:
const td_api::businessLocation *business_location_;
};
class Client::JsonChatPermissions final : public td::Jsonable {
public:
explicit JsonChatPermissions(const td_api::chatPermissions *chat_permissions) : chat_permissions_(chat_permissions) {
@ -769,6 +785,9 @@ class Client::JsonChat final : public td::Jsonable {
if (user_info->has_restricted_voice_and_video_messages) {
object("has_restricted_voice_and_video_messages", td::JsonTrue());
}
if (user_info->business_location != nullptr) {
object("business_location", JsonBusinessLocation(user_info->business_location.get()));
}
}
photo = user_info->photo.get();
break;
@ -6340,6 +6359,10 @@ void Client::on_update(object_ptr<td_api::Object> result) {
user_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->business_location =
full_info->business_info_ != nullptr && full_info->business_info_->location_ != nullptr
? std::move(full_info->business_info_->location_)
: nullptr;
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_;
break;

View File

@ -93,6 +93,7 @@ class Client final : public WebhookActor::Callback {
class JsonUsers;
class JsonReactionType;
class JsonReactionCount;
class JsonBusinessLocation;
class JsonChatPermissions;
class JsonChatPhotoInfo;
class JsonChatLocation;
@ -793,6 +794,7 @@ class Client final : public WebhookActor::Callback {
object_ptr<td_api::chatPhoto> photo;
td::string bio;
object_ptr<td_api::businessLocation> business_location;
bool have_access = false;
bool can_join_groups = false;