Rebase: Support channel emoji status.

This commit is contained in:
David Guillen Fandos 2024-02-03 11:45:24 +01:00
parent f19e58645e
commit d3300e9ba3
3 changed files with 23 additions and 11 deletions

2
td

@ -1 +1 @@
Subproject commit 27c3eaeb4964bd5f18d8488e354abde1a4383e49 Subproject commit 9184b3e62de59663a59d3500528aee7e5f0d83fa

View File

@ -844,12 +844,6 @@ class Client::JsonChat final : public td::Jsonable {
object("active_usernames", td::json_array(user_info->active_usernames, object("active_usernames", td::json_array(user_info->active_usernames,
[](td::Slice username) { return td::JsonString(username); })); [](td::Slice username) { return td::JsonString(username); }));
} }
if (user_info->emoji_status_custom_emoji_id != 0) {
object("emoji_status_custom_emoji_id", td::to_string(user_info->emoji_status_custom_emoji_id));
if (user_info->emoji_status_expiration_date != 0) {
object("emoji_status_expiration_date", user_info->emoji_status_expiration_date);
}
}
if (!user_info->bio.empty()) { if (!user_info->bio.empty()) {
object("bio", user_info->bio); object("bio", user_info->bio);
} }
@ -1016,6 +1010,12 @@ class Client::JsonChat final : public td::Jsonable {
if (chat_info->message_auto_delete_time != 0) { if (chat_info->message_auto_delete_time != 0) {
object("message_auto_delete_time", chat_info->message_auto_delete_time); object("message_auto_delete_time", chat_info->message_auto_delete_time);
} }
if (chat_info->emoji_status_custom_emoji_id != 0) {
object("emoji_status_custom_emoji_id", td::to_string(chat_info->emoji_status_custom_emoji_id));
if (chat_info->emoji_status_expiration_date != 0) {
object("emoji_status_expiration_date", chat_info->emoji_status_expiration_date);
}
}
if (chat_info->available_reactions != nullptr) { if (chat_info->available_reactions != nullptr) {
object("available_reactions", object("available_reactions",
td::json_array(chat_info->available_reactions->reactions_, td::json_array(chat_info->available_reactions->reactions_,
@ -6678,6 +6678,10 @@ void Client::on_update(object_ptr<td_api::Object> result) {
chat_info->photo_info = std::move(chat->photo_); chat_info->photo_info = std::move(chat->photo_);
chat_info->permissions = std::move(chat->permissions_); chat_info->permissions = std::move(chat->permissions_);
chat_info->message_auto_delete_time = chat->message_auto_delete_time_; chat_info->message_auto_delete_time = chat->message_auto_delete_time_;
chat_info->emoji_status_custom_emoji_id =
chat->emoji_status_ != nullptr ? chat->emoji_status_->custom_emoji_id_ : 0;
chat_info->emoji_status_expiration_date =
chat->emoji_status_ != nullptr ? chat->emoji_status_->expiration_date_ : 0;
if (chat->available_reactions_->get_id() == td_api::chatAvailableReactionsSome::ID) { if (chat->available_reactions_->get_id() == td_api::chatAvailableReactionsSome::ID) {
chat_info->available_reactions = move_object_as<td_api::chatAvailableReactionsSome>(chat->available_reactions_); chat_info->available_reactions = move_object_as<td_api::chatAvailableReactionsSome>(chat->available_reactions_);
} }
@ -6716,6 +6720,16 @@ void Client::on_update(object_ptr<td_api::Object> result) {
chat_info->message_auto_delete_time = update->message_auto_delete_time_; chat_info->message_auto_delete_time = update->message_auto_delete_time_;
break; break;
} }
case td_api::updateChatEmojiStatus::ID: {
auto update = move_object_as<td_api::updateChatEmojiStatus>(result);
auto chat_info = add_chat(update->chat_id_);
CHECK(chat_info->type != ChatInfo::Type::Unknown);
chat_info->emoji_status_custom_emoji_id =
update->emoji_status_ != nullptr ? update->emoji_status_->custom_emoji_id_ : 0;
chat_info->emoji_status_expiration_date =
update->emoji_status_ != nullptr ? update->emoji_status_->expiration_date_ : 0;
break;
}
case td_api::updateChatAvailableReactions::ID: { case td_api::updateChatAvailableReactions::ID: {
auto update = move_object_as<td_api::updateChatAvailableReactions>(result); auto update = move_object_as<td_api::updateChatAvailableReactions>(result);
auto chat_info = add_chat(update->chat_id_); auto chat_info = add_chat(update->chat_id_);
@ -12852,8 +12866,6 @@ void Client::add_user(UserInfo *user_info, object_ptr<td_api::user> &&user) {
user_info->editable_username = std::move(user->usernames_->editable_username_); user_info->editable_username = std::move(user->usernames_->editable_username_);
} }
user_info->language_code = std::move(user->language_code_); user_info->language_code = std::move(user->language_code_);
user_info->emoji_status_custom_emoji_id = user->emoji_status_ != nullptr ? user->emoji_status_->custom_emoji_id_ : 0;
user_info->emoji_status_expiration_date = user->emoji_status_ != nullptr ? user->emoji_status_->expiration_date_ : 0;
// start custom properties // start custom properties
user_info->is_verified = user->is_verified_; user_info->is_verified = user->is_verified_;

View File

@ -871,8 +871,6 @@ class Client final : public WebhookActor::Callback {
td::vector<td::string> active_usernames; td::vector<td::string> active_usernames;
td::string editable_username; td::string editable_username;
td::string language_code; td::string language_code;
int64 emoji_status_custom_emoji_id;
int32 emoji_status_expiration_date;
object_ptr<td_api::chatPhoto> photo; object_ptr<td_api::chatPhoto> photo;
td::string bio; td::string bio;
@ -948,6 +946,8 @@ class Client final : public WebhookActor::Callback {
Type type = Type::Unknown; Type type = Type::Unknown;
td::string title; td::string title;
int32 message_auto_delete_time = 0; int32 message_auto_delete_time = 0;
int64 emoji_status_custom_emoji_id = 0;
int32 emoji_status_expiration_date = 0;
int32 accent_color_id = -1; int32 accent_color_id = -1;
int32 profile_accent_color_id = -1; int32 profile_accent_color_id = -1;
int64 background_custom_emoji_id = 0; int64 background_custom_emoji_id = 0;