Support UserFull.read_dates_private.

This commit is contained in:
levlam 2024-01-09 14:56:32 +03:00
parent d6eca27e58
commit b2f8a8e5d6
3 changed files with 22 additions and 0 deletions

View File

@ -3583,6 +3583,7 @@ void ContactsManager::UserFull::store(StorerT &storer) const {
STORE_FLAG(has_pinned_stories);
STORE_FLAG(is_blocked_for_stories);
STORE_FLAG(wallpaper_overridden);
STORE_FLAG(read_dates_private);
END_STORE_FLAGS();
if (has_about) {
store(about, storer);
@ -3668,6 +3669,7 @@ void ContactsManager::UserFull::parse(ParserT &parser) {
PARSE_FLAG(has_pinned_stories);
PARSE_FLAG(is_blocked_for_stories);
PARSE_FLAG(wallpaper_overridden);
PARSE_FLAG(read_dates_private);
END_PARSE_FLAGS();
if (has_about) {
parse(about, parser);
@ -5154,6 +5156,14 @@ bool ContactsManager::get_user_voice_messages_forbidden(UserId user_id) const {
return false;
}
bool ContactsManager::get_user_read_dates_private(UserId user_id) {
auto user_full = get_user_full_force(user_id, "get_user_read_dates_private");
if (user_full != nullptr) {
return user_full->read_dates_private;
}
return false;
}
string ContactsManager::get_dialog_about(DialogId dialog_id) {
switch (dialog_id.get_type()) {
case DialogType::User: {
@ -11543,6 +11553,10 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
user_full->private_forward_name = std::move(user->private_forward_name_);
user_full->need_save_to_database = true;
}
if (user_full->read_dates_private != user->read_dates_private_) {
user_full->read_dates_private = std::move(user->read_dates_private_);
user_full->need_save_to_database = true;
}
if (user_full->about != user->about_) {
user_full->about = std::move(user->about_);
user_full->is_changed = true;
@ -13254,6 +13268,7 @@ void ContactsManager::drop_user_full(UserId user_id) {
user_full->premium_gift_options.clear();
user_full->voice_messages_forbidden = false;
user_full->has_pinned_stories = false;
user_full->read_dates_private = false;
user_full->is_changed = true;
update_user_full(user_full, user_id, "drop_user_full");

View File

@ -162,8 +162,11 @@ class ContactsManager final : public Actor {
bool get_channel_stories_hidden(ChannelId channel_id) const;
string get_user_private_forward_name(UserId user_id);
bool get_user_voice_messages_forbidden(UserId user_id) const;
bool get_user_read_dates_private(UserId user_id);
string get_dialog_about(DialogId dialog_id);
string get_dialog_search_text(DialogId dialog_id) const;
@ -832,6 +835,7 @@ class ContactsManager final : public Actor {
bool wallpaper_overridden = false;
bool voice_messages_forbidden = false;
bool has_pinned_stories = false;
bool read_dates_private = false;
bool is_common_chat_count_changed = true;
bool is_being_updated = false;

View File

@ -17210,6 +17210,9 @@ void MessagesManager::get_message_read_date(MessageFullId message_full_id,
if (d->last_read_outbox_message_id < m->message_id) {
return promise.set_value(td_api::make_object<td_api::messageReadDateUnread>());
}
if (td_->contacts_manager_->get_user_read_dates_private(dialog_id.get_user_id())) {
return promise.set_value(td_api::make_object<td_api::messageReadDateUserPrivacyRestricted>());
}
td_->create_handler<GetOutboxReadDateQuery>(std::move(promise))
->send(message_full_id.get_dialog_id(), message_full_id.get_message_id());