Add td_api::userPrivacySettingRuleAllowCloseFriends.

This commit is contained in:
levlam 2023-05-03 19:42:36 +03:00
parent 83dfdcd9ee
commit d7f72e03b0
4 changed files with 16 additions and 3 deletions

View File

@ -4443,9 +4443,12 @@ jsonValueObject members:vector<jsonObjectMember> = JsonValue;
//@description A rule to allow all users to do something
userPrivacySettingRuleAllowAll = UserPrivacySettingRule;
//@description A rule to allow all of a user's contacts to do something
//@description A rule to allow all contacts of the user to do something
userPrivacySettingRuleAllowContacts = UserPrivacySettingRule;
//@description A rule to allow all close friends of the user to do something
userPrivacySettingRuleAllowCloseFriends = UserPrivacySettingRule;
//@description A rule to allow certain specified users to do something @user_ids The user identifiers, total number of users in all rules must not exceed 1000
userPrivacySettingRuleAllowUsers user_ids:vector<int53> = UserPrivacySettingRule;
@ -4455,7 +4458,7 @@ userPrivacySettingRuleAllowChatMembers chat_ids:vector<int53> = UserPrivacySetti
//@description A rule to restrict all users from doing something
userPrivacySettingRuleRestrictAll = UserPrivacySettingRule;
//@description A rule to restrict all contacts of a user from doing something
//@description A rule to restrict all contacts of the user from doing something
userPrivacySettingRuleRestrictContacts = UserPrivacySettingRule;
//@description A rule to restrict all specified users from doing something @user_ids The user identifiers, total number of users in all rules must not exceed 1000

View File

@ -197,6 +197,9 @@ PrivacyManager::UserPrivacySettingRule::UserPrivacySettingRule(const td_api::Use
case td_api::userPrivacySettingRuleAllowContacts::ID:
type_ = Type::AllowContacts;
break;
case td_api::userPrivacySettingRuleAllowCloseFriends::ID:
type_ = Type::AllowCloseFriends;
break;
case td_api::userPrivacySettingRuleAllowAll::ID:
type_ = Type::AllowAll;
break;
@ -234,7 +237,7 @@ PrivacyManager::UserPrivacySettingRule::UserPrivacySettingRule(const telegram_ap
type_ = Type::AllowContacts;
break;
case telegram_api::privacyValueAllowCloseFriends::ID:
type_ = Type::AllowContacts;
type_ = Type::AllowCloseFriends;
break;
case telegram_api::privacyValueAllowAll::ID:
type_ = Type::AllowAll;
@ -271,6 +274,8 @@ PrivacyManager::UserPrivacySettingRule::get_user_privacy_setting_rule_object() c
switch (type_) {
case Type::AllowContacts:
return make_tl_object<td_api::userPrivacySettingRuleAllowContacts>();
case Type::AllowCloseFriends:
return make_tl_object<td_api::userPrivacySettingRuleAllowCloseFriends>();
case Type::AllowAll:
return make_tl_object<td_api::userPrivacySettingRuleAllowAll>();
case Type::AllowUsers:
@ -294,6 +299,8 @@ tl_object_ptr<telegram_api::InputPrivacyRule> PrivacyManager::UserPrivacySetting
switch (type_) {
case Type::AllowContacts:
return make_tl_object<telegram_api::inputPrivacyValueAllowContacts>();
case Type::AllowCloseFriends:
return make_tl_object<telegram_api::inputPrivacyValueAllowCloseFriends>();
case Type::AllowAll:
return make_tl_object<telegram_api::inputPrivacyValueAllowAll>();
case Type::AllowUsers:

View File

@ -91,6 +91,7 @@ class PrivacyManager final : public NetQueryCallback {
private:
enum class Type : int32 {
AllowContacts,
AllowCloseFriends,
AllowAll,
AllowUsers,
AllowChatParticipants,

View File

@ -1463,6 +1463,8 @@ class CliClient final : public Actor {
vector<td_api::object_ptr<td_api::UserPrivacySettingRule>> rules;
if (allow == "c" || allow == "contacts") {
rules.push_back(td_api::make_object<td_api::userPrivacySettingRuleAllowContacts>());
} else if (allow == "f" || allow == "friends") {
rules.push_back(td_api::make_object<td_api::userPrivacySettingRuleAllowCloseFriends>());
} else if (allow == "users") {
rules.push_back(td_api::make_object<td_api::userPrivacySettingRuleAllowUsers>(as_user_ids(ids)));
} else if (allow == "chats") {