Add user.restricts_new_chats.
This commit is contained in:
parent
c8e4622da4
commit
a3ac41e283
@ -804,11 +804,12 @@ usernames active_usernames:vector<string> disabled_usernames:vector<string> edit
|
|||||||
//@is_fake True, if many users reported this user as a fake account
|
//@is_fake True, if many users reported this user as a fake account
|
||||||
//@has_active_stories True, if the user has non-expired stories available to the current user
|
//@has_active_stories True, if the user has non-expired stories available to the current user
|
||||||
//@has_unread_active_stories True, if the user has unread non-expired stories available to the current user
|
//@has_unread_active_stories True, if the user has unread non-expired stories available to the current user
|
||||||
|
//@restricts_new_chats True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them
|
||||||
//@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method
|
//@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method
|
||||||
//@type Type of the user
|
//@type Type of the user
|
||||||
//@language_code IETF language tag of the user's language; only available to bots
|
//@language_code IETF language tag of the user's language; only available to bots
|
||||||
//@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots
|
//@added_to_attachment_menu True, if the user added the current bot to attachment menu; only available to bots
|
||||||
user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User;
|
user id:int53 first_name:string last_name:string usernames:usernames phone_number:string status:UserStatus profile_photo:profilePhoto accent_color_id:int32 background_custom_emoji_id:int64 profile_accent_color_id:int32 profile_background_custom_emoji_id:int64 emoji_status:emojiStatus is_contact:Bool is_mutual_contact:Bool is_close_friend:Bool is_verified:Bool is_premium:Bool is_support:Bool restriction_reason:string is_scam:Bool is_fake:Bool has_active_stories:Bool has_unread_active_stories:Bool restricts_new_chats:Bool have_access:Bool type:UserType language_code:string added_to_attachment_menu:Bool = User;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains information about a bot
|
//@description Contains information about a bot
|
||||||
|
@ -3306,6 +3306,7 @@ void ContactsManager::User::store(StorerT &storer) const {
|
|||||||
STORE_FLAG(has_background_custom_emoji_id);
|
STORE_FLAG(has_background_custom_emoji_id);
|
||||||
STORE_FLAG(has_profile_accent_color_id);
|
STORE_FLAG(has_profile_accent_color_id);
|
||||||
STORE_FLAG(has_profile_background_custom_emoji_id);
|
STORE_FLAG(has_profile_background_custom_emoji_id);
|
||||||
|
STORE_FLAG(contact_require_premium);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
}
|
}
|
||||||
store(first_name, storer);
|
store(first_name, storer);
|
||||||
@ -3431,6 +3432,7 @@ void ContactsManager::User::parse(ParserT &parser) {
|
|||||||
PARSE_FLAG(has_background_custom_emoji_id);
|
PARSE_FLAG(has_background_custom_emoji_id);
|
||||||
PARSE_FLAG(has_profile_accent_color_id);
|
PARSE_FLAG(has_profile_accent_color_id);
|
||||||
PARSE_FLAG(has_profile_background_custom_emoji_id);
|
PARSE_FLAG(has_profile_background_custom_emoji_id);
|
||||||
|
PARSE_FLAG(contact_require_premium);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
}
|
}
|
||||||
parse(first_name, parser);
|
parse(first_name, parser);
|
||||||
@ -9102,6 +9104,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
|||||||
bool stories_available = user->stories_max_id_ > 0;
|
bool stories_available = user->stories_max_id_ > 0;
|
||||||
bool stories_unavailable = user->stories_unavailable_;
|
bool stories_unavailable = user->stories_unavailable_;
|
||||||
bool stories_hidden = user->stories_hidden_;
|
bool stories_hidden = user->stories_hidden_;
|
||||||
|
bool contact_require_premium = user->contact_require_premium_;
|
||||||
|
|
||||||
LOG_IF(ERROR, !can_join_groups && !is_bot)
|
LOG_IF(ERROR, !can_join_groups && !is_bot)
|
||||||
<< "Receive not bot " << user_id << " which can't join groups from " << source;
|
<< "Receive not bot " << user_id << " which can't join groups from " << source;
|
||||||
@ -9140,7 +9143,8 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
|||||||
can_join_groups != u->can_join_groups || can_read_all_group_messages != u->can_read_all_group_messages ||
|
can_join_groups != u->can_join_groups || can_read_all_group_messages != u->can_read_all_group_messages ||
|
||||||
is_scam != u->is_scam || is_fake != u->is_fake || is_inline_bot != u->is_inline_bot ||
|
is_scam != u->is_scam || is_fake != u->is_fake || is_inline_bot != u->is_inline_bot ||
|
||||||
inline_query_placeholder != u->inline_query_placeholder || need_location_bot != u->need_location_bot ||
|
inline_query_placeholder != u->inline_query_placeholder || need_location_bot != u->need_location_bot ||
|
||||||
can_be_added_to_attach_menu != u->can_be_added_to_attach_menu) {
|
can_be_added_to_attach_menu != u->can_be_added_to_attach_menu ||
|
||||||
|
contact_require_premium != u->contact_require_premium) {
|
||||||
if (is_bot != u->is_bot) {
|
if (is_bot != u->is_bot) {
|
||||||
LOG_IF(ERROR, !is_deleted && !u->is_deleted && u->is_received)
|
LOG_IF(ERROR, !is_deleted && !u->is_deleted && u->is_received)
|
||||||
<< "User.is_bot has changed for " << user_id << "/" << u->usernames << " from " << source << " from "
|
<< "User.is_bot has changed for " << user_id << "/" << u->usernames << " from " << source << " from "
|
||||||
@ -9158,6 +9162,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
|||||||
u->inline_query_placeholder = std::move(inline_query_placeholder);
|
u->inline_query_placeholder = std::move(inline_query_placeholder);
|
||||||
u->need_location_bot = need_location_bot;
|
u->need_location_bot = need_location_bot;
|
||||||
u->can_be_added_to_attach_menu = can_be_added_to_attach_menu;
|
u->can_be_added_to_attach_menu = can_be_added_to_attach_menu;
|
||||||
|
u->contact_require_premium = contact_require_premium;
|
||||||
|
|
||||||
LOG(DEBUG) << "Info has changed for " << user_id;
|
LOG(DEBUG) << "Info has changed for " << user_id;
|
||||||
u->is_changed = true;
|
u->is_changed = true;
|
||||||
@ -17663,8 +17668,8 @@ td_api::object_ptr<td_api::updateUser> ContactsManager::get_update_unknown_user_
|
|||||||
return td_api::make_object<td_api::updateUser>(td_api::make_object<td_api::user>(
|
return td_api::make_object<td_api::updateUser>(td_api::make_object<td_api::user>(
|
||||||
user_id.get(), "", "", nullptr, "", td_api::make_object<td_api::userStatusEmpty>(), nullptr,
|
user_id.get(), "", "", nullptr, "", td_api::make_object<td_api::userStatusEmpty>(), nullptr,
|
||||||
td_->theme_manager_->get_accent_color_id_object(AccentColorId(user_id)), 0, -1, 0, nullptr, false, false, false,
|
td_->theme_manager_->get_accent_color_id_object(AccentColorId(user_id)), 0, -1, 0, nullptr, false, false, false,
|
||||||
false, false, false, "", false, false, false, false, have_access, td_api::make_object<td_api::userTypeUnknown>(),
|
false, false, false, "", false, false, false, false, false, have_access,
|
||||||
"", false));
|
td_api::make_object<td_api::userTypeUnknown>(), "", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
int64 ContactsManager::get_user_id_object(UserId user_id, const char *source) const {
|
int64 ContactsManager::get_user_id_object(UserId user_id, const char *source) const {
|
||||||
@ -17698,6 +17703,7 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
|
|||||||
auto emoji_status = u->last_sent_emoji_status.get_emoji_status_object();
|
auto emoji_status = u->last_sent_emoji_status.get_emoji_status_object();
|
||||||
auto have_access = user_id == get_my_id() || have_input_peer_user(u, user_id, AccessRights::Know);
|
auto have_access = user_id == get_my_id() || have_input_peer_user(u, user_id, AccessRights::Know);
|
||||||
auto accent_color_id = u->accent_color_id.is_valid() ? u->accent_color_id : AccentColorId(user_id);
|
auto accent_color_id = u->accent_color_id.is_valid() ? u->accent_color_id : AccentColorId(user_id);
|
||||||
|
auto restricts_new_chats = u->contact_require_premium && !u->is_mutual_contact;
|
||||||
return td_api::make_object<td_api::user>(
|
return td_api::make_object<td_api::user>(
|
||||||
user_id.get(), u->first_name, u->last_name, u->usernames.get_usernames_object(), u->phone_number,
|
user_id.get(), u->first_name, u->last_name, u->usernames.get_usernames_object(), u->phone_number,
|
||||||
get_user_status_object(user_id, u, G()->unix_time()),
|
get_user_status_object(user_id, u, G()->unix_time()),
|
||||||
@ -17708,8 +17714,8 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
|
|||||||
u->profile_background_custom_emoji_id.get(), std::move(emoji_status), u->is_contact, u->is_mutual_contact,
|
u->profile_background_custom_emoji_id.get(), std::move(emoji_status), u->is_contact, u->is_mutual_contact,
|
||||||
u->is_close_friend, u->is_verified, u->is_premium, u->is_support,
|
u->is_close_friend, u->is_verified, u->is_premium, u->is_support,
|
||||||
get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake,
|
get_restriction_reason_description(u->restriction_reasons), u->is_scam, u->is_fake,
|
||||||
u->max_active_story_id.is_valid(), get_user_has_unread_stories(u), have_access, std::move(type), u->language_code,
|
u->max_active_story_id.is_valid(), get_user_has_unread_stories(u), restricts_new_chats, have_access,
|
||||||
u->attach_menu_enabled);
|
std::move(type), u->language_code, u->attach_menu_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<int64> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids, const char *source) const {
|
vector<int64> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids, const char *source) const {
|
||||||
|
@ -761,6 +761,7 @@ class ContactsManager final : public Actor {
|
|||||||
bool can_be_added_to_attach_menu = false;
|
bool can_be_added_to_attach_menu = false;
|
||||||
bool attach_menu_enabled = false;
|
bool attach_menu_enabled = false;
|
||||||
bool stories_hidden = false;
|
bool stories_hidden = false;
|
||||||
|
bool contact_require_premium = false;
|
||||||
|
|
||||||
bool is_photo_inited = false;
|
bool is_photo_inited = false;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user