Add td_api::getReadDatePrivacySettings.

This commit is contained in:
levlam 2024-01-09 17:11:22 +03:00
parent e85694e6ff
commit 252ca3135c
6 changed files with 34 additions and 0 deletions

View File

@ -5393,6 +5393,11 @@ userPrivacySettingAllowFindingByPhoneNumber = UserPrivacySetting;
userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = UserPrivacySetting;
//@description Contains privacy settings for message read date
//@show_read_date True, if message read date is shown to other users in private chats. If disabled and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date
readDatePrivacySettings show_read_date:Bool = ReadDatePrivacySettings;
//@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; 30-366 days
accountTtl days:int32 = AccountTtl;
@ -9502,6 +9507,9 @@ setUserPrivacySettingRules setting:UserPrivacySetting rules:userPrivacySettingRu
//@description Returns the current privacy settings @setting The privacy setting
getUserPrivacySettingRules setting:UserPrivacySetting = UserPrivacySettingRules;
//@description Returns privacy settings for message read date
getReadDatePrivacySettings = ReadDatePrivacySettings;
//@description Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization. Can be called synchronously for options "version" and "commit_hash"
//@name The name of the option

View File

@ -132,6 +132,12 @@ td_api::object_ptr<td_api::archiveChatListSettings> GlobalPrivacySettings::get_a
keep_archived_unmuted_, keep_archived_folders_);
}
td_api::object_ptr<td_api::readDatePrivacySettings> GlobalPrivacySettings::get_read_date_privacy_settings_object()
const {
CHECK(set_type_ == SetType::None);
return td_api::make_object<td_api::readDatePrivacySettings>(!hide_read_marks_);
}
void GlobalPrivacySettings::get_global_privacy_settings(Td *td, Promise<GlobalPrivacySettings> &&promise) {
td->create_handler<GetGlobalPrivacySettingsQuery>(std::move(promise))->send();
}

View File

@ -36,6 +36,8 @@ class GlobalPrivacySettings {
td_api::object_ptr<td_api::archiveChatListSettings> get_archive_chat_list_settings_object() const;
td_api::object_ptr<td_api::readDatePrivacySettings> get_read_date_privacy_settings_object() const;
static void get_global_privacy_settings(Td *td, Promise<GlobalPrivacySettings> &&promise);
static void set_global_privacy_settings(Td *td, GlobalPrivacySettings settings, Promise<Unit> &&promise);

View File

@ -6486,6 +6486,20 @@ void Td::on_request(uint64 id, td_api::setArchiveChatListSettings &request) {
std::move(promise));
}
void Td::on_request(uint64 id, const td_api::getReadDatePrivacySettings &request) {
CHECK_IS_USER();
CREATE_REQUEST_PROMISE();
auto query_promise =
PromiseCreator::lambda([promise = std::move(promise)](Result<GlobalPrivacySettings> result) mutable {
if (result.is_error()) {
promise.set_error(result.move_as_error());
} else {
promise.set_value(result.ok().get_read_date_privacy_settings_object());
}
});
GlobalPrivacySettings::get_global_privacy_settings(this, std::move(query_promise));
}
void Td::on_request(uint64 id, td_api::setChatTitle &request) {
CLEAN_INPUT_STRING(request.title_);
CREATE_OK_REQUEST_PROMISE();

View File

@ -1051,6 +1051,8 @@ class Td final : public Actor {
void on_request(uint64 id, td_api::setArchiveChatListSettings &request);
void on_request(uint64 id, const td_api::getReadDatePrivacySettings &request);
void on_request(uint64 id, td_api::setChatTitle &request);
void on_request(uint64 id, const td_api::setChatPhoto &request);

View File

@ -5435,6 +5435,8 @@ class CliClient final : public Actor {
auto settings = td_api::make_object<td_api::archiveChatListSettings>(
archive_and_mute_new_chats_from_unknown_users, keep_unmuted_chats_archived, keep_chats_from_folders_archived);
send_request(td_api::make_object<td_api::setArchiveChatListSettings>(std::move(settings)));
} else if (op == "grdps") {
send_request(td_api::make_object<td_api::getReadDatePrivacySettings>());
} else if (op == "sct") {
ChatId chat_id;
string title;