Add userFullInfo.as_restricted_voice_and_video_note_messages.

This commit is contained in:
levlam 2022-07-17 16:59:12 +03:00
parent 15e0786632
commit fcfe9c3996
3 changed files with 29 additions and 6 deletions

View File

@ -515,12 +515,13 @@ botInfo share_text:string description:string photo:photo animation:animation men
//@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
//@has_restricted_voice_and_video_note_messages True, if voice and video notes can't be sent or forwarded to the user
//@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; may be null for bots
//@premium_gift_options The list of available options for gifting Telegram Premium to the user
//@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
//@bot_info For bots, information about the bot; may be null
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:formattedText premium_gift_options:vector<premiumGiftOption> group_in_common_count:int32 bot_info:botInfo = UserFullInfo;
userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool has_private_forwards:Bool has_restricted_voice_and_video_note_messages:Bool need_phone_number_privacy_exception:Bool bio:formattedText premium_gift_options:vector<premiumGiftOption> group_in_common_count:int32 bot_info:botInfo = UserFullInfo;
//@description Represents a list of users @total_count Approximate total number of users found @user_ids A list of user identifiers
users total_count:int32 user_ids:vector<int53> = Users;

View File

@ -3828,6 +3828,7 @@ void ContactsManager::UserFull::store(StorerT &storer) const {
STORE_FLAG(has_description_photo);
STORE_FLAG(has_description_animation);
STORE_FLAG(has_premium_gift_options);
STORE_FLAG(voice_messages_forbidden);
END_STORE_FLAGS();
if (has_about) {
store(about, storer);
@ -3899,6 +3900,7 @@ void ContactsManager::UserFull::parse(ParserT &parser) {
PARSE_FLAG(has_description_photo);
PARSE_FLAG(has_description_animation);
PARSE_FLAG(has_premium_gift_options);
PARSE_FLAG(voice_messages_forbidden);
END_PARSE_FLAGS();
if (has_about) {
parse(about, parser);
@ -4948,6 +4950,14 @@ string ContactsManager::get_user_private_forward_name(UserId user_id) {
return string();
}
bool ContactsManager::get_user_voice_messages_forbidden(UserId user_id) {
auto user_full = get_user_full_force(user_id);
if (user_full != nullptr) {
return user_full->voice_messages_forbidden;
}
return false;
}
string ContactsManager::get_dialog_about(DialogId dialog_id) {
switch (dialog_id.get_type()) {
case DialogType::User: {
@ -10775,20 +10785,27 @@ void ContactsManager::on_get_user_full(tl_object_ptr<telegram_api::userFull> &&u
AdministratorRights broadcast_administrator_rights(user->bot_broadcast_admin_rights_, ChannelType::Broadcast);
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->private_forward_name != user->private_forward_name_ ||
user_full->group_administrator_rights != group_administrator_rights ||
user_full->broadcast_administrator_rights != broadcast_administrator_rights ||
user_full->premium_gift_options != premium_gift_options) {
user_full->premium_gift_options != premium_gift_options ||
user_full->voice_messages_forbidden != user->voice_messages_forbidden_) {
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->group_administrator_rights = group_administrator_rights;
user_full->broadcast_administrator_rights = broadcast_administrator_rights;
user_full->premium_gift_options = std::move(premium_gift_options);
user_full->voice_messages_forbidden = user->voice_messages_forbidden_;
user_full->is_changed = true;
}
if (user_full->private_forward_name != user->private_forward_name_) {
if (user_full->private_forward_name.empty() != user->private_forward_name_.empty()) {
user_full->is_changed = true;
}
user_full->private_forward_name = std::move(user->private_forward_name_);
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;
@ -12104,6 +12121,7 @@ void ContactsManager::drop_user_full(UserId user_id) {
user_full->group_administrator_rights = {};
user_full->broadcast_administrator_rights = {};
user_full->premium_gift_options.clear();
user_full->voice_messages_forbidden = false;
user_full->is_changed = true;
update_user_full(user_full, user_id, "drop_user_full");
@ -16739,8 +16757,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->private_forward_name.empty(), user_full->need_phone_number_privacy_exception, std::move(bio_object),
std::move(premium_gift_options), user_full->common_chat_count, std::move(bot_info));
!user_full->private_forward_name.empty(), user_full->voice_messages_forbidden,
user_full->need_phone_number_privacy_exception, std::move(bio_object), std::move(premium_gift_options),
user_full->common_chat_count, std::move(bot_info));
}
td_api::object_ptr<td_api::updateBasicGroup> ContactsManager::get_update_unknown_basic_group_object(ChatId chat_id) {

View File

@ -119,6 +119,7 @@ class ContactsManager final : public Actor {
bool get_channel_has_protected_content(ChannelId channel_id) const;
string get_user_private_forward_name(UserId user_id);
bool get_user_voice_messages_forbidden(UserId user_id);
string get_dialog_about(DialogId dialog_id);
@ -731,6 +732,7 @@ class ContactsManager final : public Actor {
bool has_private_calls = false;
bool can_pin_messages = true;
bool need_phone_number_privacy_exception = false;
bool voice_messages_forbidden = false;
bool is_common_chat_count_changed = true;
bool is_changed = true; // have new changes that need to be sent to the client and database
@ -1075,6 +1077,7 @@ class ContactsManager final : public Actor {
static constexpr int32 USER_FULL_FLAG_HAS_PRIVATE_FORWARD_NAME = 1 << 16;
static constexpr int32 USER_FULL_FLAG_HAS_GROUP_ADMINISTRATOR_RIGHTS = 1 << 17;
static constexpr int32 USER_FULL_FLAG_HAS_BROADCAST_ADMINISTRATOR_RIGHTS = 1 << 18;
static constexpr int32 USER_FULL_FLAG_HAS_VOICE_MESSAGES_FORBIDDEN = 1 << 20;
static constexpr int32 CHAT_FLAG_USER_IS_CREATOR = 1 << 0;
static constexpr int32 CHAT_FLAG_USER_HAS_LEFT = 1 << 2;