Add userFullInfo.has_private_forwards.

This commit is contained in:
levlam 2021-11-20 22:48:44 +03:00
parent e4df8d9458
commit 8f2a09f2cb
3 changed files with 21 additions and 5 deletions

View File

@ -428,13 +428,14 @@ user id:int53 first_name:string last_name:string username:string phone_number:st
//@can_be_called True, if the user can be called
//@supports_video_calls True, if a video call can be created with the user
//@has_private_calls True, if the user can't be called due to their privacy settings
//@has_private_forwards True, if the user can't be linked in forwarded messages due to their privacy settings
//@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
//@bio A short user bio
//@share_text For bots, the text that is shown on the bot's profile page and is sent together with the link when users share the bot
//@param_description For bots, the text shown in the chat with the bot if the chat is empty
//@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user
//@commands For bots, list of the bot commands
userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool need_phone_number_privacy_exception:Bool bio:string share_text:string description:string group_in_common_count:int32 commands:vector<botCommand> = UserFullInfo;
userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool need_phone_number_privacy_exception:Bool bio:string share_text:string description:string group_in_common_count:int32 commands:vector<botCommand> = UserFullInfo;
//@description Represents a list of users @total_count Approximate total count of users found @user_ids A list of user identifiers
users total_count:int32 user_ids:vector<int53> = Users;

View File

@ -3594,6 +3594,7 @@ void ContactsManager::UserFull::store(StorerT &storer) const {
bool has_photo = !photo.is_empty();
bool has_description = !description.empty();
bool has_commands = !commands.empty();
bool has_private_forward_name = !private_forward_name.empty();
BEGIN_STORE_FLAGS();
STORE_FLAG(has_about);
STORE_FLAG(is_blocked);
@ -3605,6 +3606,7 @@ void ContactsManager::UserFull::store(StorerT &storer) const {
STORE_FLAG(supports_video_calls);
STORE_FLAG(has_description);
STORE_FLAG(has_commands);
STORE_FLAG(has_private_forward_name);
END_STORE_FLAGS();
if (has_about) {
store(about, storer);
@ -3620,6 +3622,9 @@ void ContactsManager::UserFull::store(StorerT &storer) const {
if (has_commands) {
store(commands, storer);
}
if (has_private_forward_name) {
store(private_forward_name, storer);
}
}
template <class ParserT>
@ -3629,6 +3634,7 @@ void ContactsManager::UserFull::parse(ParserT &parser) {
bool has_photo;
bool has_description;
bool has_commands;
bool has_private_forward_name;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_about);
PARSE_FLAG(is_blocked);
@ -3640,6 +3646,7 @@ void ContactsManager::UserFull::parse(ParserT &parser) {
PARSE_FLAG(supports_video_calls);
PARSE_FLAG(has_description);
PARSE_FLAG(has_commands);
PARSE_FLAG(has_private_forward_name);
END_PARSE_FLAGS();
if (has_about) {
parse(about, parser);
@ -3655,6 +3662,9 @@ void ContactsManager::UserFull::parse(ParserT &parser) {
if (has_commands) {
parse(commands, parser);
}
if (has_private_forward_name) {
parse(private_forward_name, parser);
}
}
template <class StorerT>
@ -10071,10 +10081,12 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
bool supports_video_calls = user->video_calls_available_ && !user->phone_calls_private_;
bool has_private_calls = user->phone_calls_private_;
if (user_full->can_be_called != can_be_called || user_full->supports_video_calls != supports_video_calls ||
user_full->has_private_calls != has_private_calls) {
user_full->has_private_calls != has_private_calls ||
user_full->private_forward_name != user->private_forward_name_) {
user_full->can_be_called = can_be_called;
user_full->supports_video_calls = supports_video_calls;
user_full->has_private_calls = has_private_calls;
user_full->private_forward_name = std::move(user->private_forward_name_);
user_full->is_changed = true;
}
@ -11303,6 +11315,7 @@ void ContactsManager::drop_user_full(UserId user_id) {
user_full->description = string();
user_full->commands.clear();
user_full->common_chat_count = 0;
user_full->private_forward_name.clear();
user_full->is_changed = true;
update_user_full(user_full, user_id, "drop_user_full");
@ -15680,9 +15693,9 @@ tl_object_ptr<td_api::userFullInfo> ContactsManager::get_user_full_info_object(U
return make_tl_object<td_api::userFullInfo>(
get_chat_photo_object(td_->file_manager_.get(), user_full->photo), user_full->is_blocked,
user_full->can_be_called, user_full->supports_video_calls, user_full->has_private_calls,
user_full->need_phone_number_privacy_exception, is_bot ? string() : user_full->about,
is_bot ? user_full->about : string(), is_bot ? user_full->description : string(), user_full->common_chat_count,
std::move(commands));
!user_full->private_forward_name.empty(), user_full->need_phone_number_privacy_exception,
is_bot ? string() : user_full->about, is_bot ? user_full->about : string(),
is_bot ? user_full->description : string(), user_full->common_chat_count, std::move(commands));
}
td_api::object_ptr<td_api::updateBasicGroup> ContactsManager::get_update_unknown_basic_group_object(ChatId chat_id) {

View File

@ -666,6 +666,7 @@ class ContactsManager final : public Actor {
string about;
string description;
string private_forward_name;
vector<BotCommand> commands;
@ -1006,6 +1007,7 @@ class ContactsManager final : public Actor {
static constexpr int32 USER_FULL_FLAG_HAS_FOLDER_ID = 1 << 11;
static constexpr int32 USER_FULL_FLAG_HAS_SCHEDULED_MESSAGES = 1 << 12;
static constexpr int32 USER_FULL_FLAG_HAS_MESSAGE_TTL = 1 << 14;
static constexpr int32 USER_FULL_FLAG_HAS_PRIVATE_FORWARD_NAME = 1 << 16;
static constexpr int32 CHAT_FLAG_USER_IS_CREATOR = 1 << 0;
static constexpr int32 CHAT_FLAG_USER_WAS_KICKED = 1 << 1;