Add support for is_scam mark for users and channels.
GitOrigin-RevId: f34b2ed15d3cb01f3a3da51673e8aa0ac98ad874
This commit is contained in:
parent
853c0986d9
commit
666e668163
@ -300,8 +300,9 @@ botInfo description:string commands:vector<botCommand> = BotInfo;
|
||||
//@is_verified True, if the user is verified @is_support True, if the user is Telegram support account
|
||||
//@restriction_reason If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}".
|
||||
//-{type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user)
|
||||
//@is_scam True, if many users reported this user as a scam
|
||||
//@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. It can't be passed to any method except GetUser @type Type of the user @language_code IETF language tag of the user's language; only available to bots
|
||||
user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto outgoing_link:LinkState incoming_link:LinkState is_verified:Bool is_support:Bool restriction_reason:string have_access:Bool type:UserType language_code:string = User;
|
||||
user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto outgoing_link:LinkState incoming_link:LinkState is_verified:Bool is_support:Bool restriction_reason:string is_scam:Bool have_access:Bool type:UserType language_code:string = User;
|
||||
|
||||
//@description Contains full information about a user (except the full list of profile photos) @is_blocked True, if the user is blacklisted by the current user @can_be_called True, if the user can be called @has_private_calls True, if the user can't be called due to their privacy settings
|
||||
//@bio A short user bio @share_text For bots, the text that is included with the link when users share the bot @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 If the user is a bot, information about the bot; may be null
|
||||
@ -439,7 +440,8 @@ basicGroupFullInfo description:string creator_user_id:int32 members:vector<chatM
|
||||
//@is_verified True, if the supergroup or channel is verified
|
||||
//@restriction_reason If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is "{type}: {description}".
|
||||
//-{type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user)
|
||||
supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 sign_messages:Bool is_channel:Bool is_verified:Bool restriction_reason:string = Supergroup;
|
||||
//@is_scam True, if many users reported this supergroup as a scam
|
||||
supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 sign_messages:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup;
|
||||
|
||||
//@description Contains full information about a supergroup or channel
|
||||
//@param_description Supergroup or channel description
|
||||
|
Binary file not shown.
@ -92,7 +92,7 @@ storage.fileMp4#b3cea0e4 = storage.FileType;
|
||||
storage.fileWebp#1081464c = storage.FileType;
|
||||
|
||||
userEmpty#200250ba id:int = User;
|
||||
user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
|
||||
user#2e13f4c3 flags:# self:flags.10?true contact:flags.11?true mutual_contact:flags.12?true deleted:flags.13?true bot:flags.14?true bot_chat_history:flags.15?true bot_nochats:flags.16?true verified:flags.17?true restricted:flags.18?true min:flags.20?true bot_inline_geo:flags.21?true support:flags.23?true scam:flags.24?true id:int access_hash:flags.0?long first_name:flags.1?string last_name:flags.2?string username:flags.3?string phone:flags.4?string photo:flags.5?UserProfilePhoto status:flags.6?UserStatus bot_info_version:flags.14?int restriction_reason:flags.18?string bot_inline_placeholder:flags.19?string lang_code:flags.22?string = User;
|
||||
|
||||
userProfilePhotoEmpty#4f11bae1 = UserProfilePhoto;
|
||||
userProfilePhoto#ecd75d8c photo_id:long photo_small:FileLocation photo_big:FileLocation dc_id:int = UserProfilePhoto;
|
||||
@ -107,7 +107,7 @@ userStatusLastMonth#77ebc742 = UserStatus;
|
||||
chatEmpty#9ba2d800 id:int = Chat;
|
||||
chat#3bda1bde flags:# creator:flags.0?true kicked:flags.1?true left:flags.2?true deactivated:flags.5?true id:int title:string photo:ChatPhoto participants_count:int date:int version:int migrated_to:flags.6?InputChannel admin_rights:flags.14?ChatAdminRights default_banned_rights:flags.18?ChatBannedRights = Chat;
|
||||
chatForbidden#7328bdb id:int title:string = Chat;
|
||||
channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
|
||||
channel#4df30834 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true id:int access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int version:int restriction_reason:flags.9?string admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int = Chat;
|
||||
channelForbidden#289da732 flags:# broadcast:flags.5?true megagroup:flags.8?true id:int access_hash:long title:string until_date:flags.16?int = Chat;
|
||||
|
||||
chatFull#22a235da flags:# can_set_username:flags.7?true id:int about:string participants:ChatParticipants chat_photo:flags.2?Photo notify_settings:PeerNotifySettings exported_invite:ExportedChatInvite bot_info:flags.3?Vector<BotInfo> pinned_msg_id:flags.6?int = ChatFull;
|
||||
|
Binary file not shown.
@ -2427,6 +2427,7 @@ void ContactsManager::User::store(StorerT &storer) const {
|
||||
STORE_FLAG(have_access_hash);
|
||||
STORE_FLAG(is_support);
|
||||
STORE_FLAG(is_min_access_hash);
|
||||
STORE_FLAG(is_scam);
|
||||
END_STORE_FLAGS();
|
||||
store(first_name, storer);
|
||||
if (has_last_name) {
|
||||
@ -2485,6 +2486,7 @@ void ContactsManager::User::parse(ParserT &parser) {
|
||||
PARSE_FLAG(have_access_hash);
|
||||
PARSE_FLAG(is_support);
|
||||
PARSE_FLAG(is_min_access_hash);
|
||||
PARSE_FLAG(is_scam);
|
||||
END_PARSE_FLAGS();
|
||||
parse(first_name, parser);
|
||||
if (has_last_name) {
|
||||
@ -2648,6 +2650,7 @@ void ContactsManager::Channel::store(StorerT &storer) const {
|
||||
STORE_FLAG(use_new_rights);
|
||||
STORE_FLAG(has_participant_count);
|
||||
STORE_FLAG(have_default_permissions);
|
||||
STORE_FLAG(is_scam);
|
||||
END_STORE_FLAGS();
|
||||
|
||||
store(status, storer);
|
||||
@ -2702,6 +2705,7 @@ void ContactsManager::Channel::parse(ParserT &parser) {
|
||||
PARSE_FLAG(use_new_rights);
|
||||
PARSE_FLAG(has_participant_count);
|
||||
PARSE_FLAG(have_default_permissions);
|
||||
PARSE_FLAG(is_scam);
|
||||
END_PARSE_FLAGS();
|
||||
|
||||
if (use_new_rights) {
|
||||
@ -5157,6 +5161,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
||||
bool can_join_groups = (flags & USER_FLAG_IS_PRIVATE_BOT) == 0;
|
||||
bool can_read_all_group_messages = (flags & USER_FLAG_IS_BOT_WITH_PRIVACY_DISABLED) != 0;
|
||||
string restriction_reason = std::move(user->restriction_reason_);
|
||||
bool is_scam = (flags & USER_FLAG_IS_SCAM) != 0;
|
||||
bool is_inline_bot = (flags & USER_FLAG_IS_INLINE_BOT) != 0;
|
||||
string inline_query_placeholder = user->bot_inline_placeholder_;
|
||||
bool need_location_bot = (flags & USER_FLAG_NEED_LOCATION_BOT) != 0;
|
||||
@ -5190,7 +5195,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
||||
int32 bot_info_version = has_bot_info_version ? user->bot_info_version_ : -1;
|
||||
if (is_verified != u->is_verified || is_support != u->is_support || is_bot != u->is_bot ||
|
||||
can_join_groups != u->can_join_groups || can_read_all_group_messages != u->can_read_all_group_messages ||
|
||||
restriction_reason != u->restriction_reason || is_inline_bot != u->is_inline_bot ||
|
||||
restriction_reason != u->restriction_reason || is_scam != u->is_scam || is_inline_bot != u->is_inline_bot ||
|
||||
inline_query_placeholder != u->inline_query_placeholder || need_location_bot != u->need_location_bot) {
|
||||
LOG_IF(ERROR, is_bot != u->is_bot && !is_deleted && !u->is_deleted && u->is_received)
|
||||
<< "User.is_bot has changed for " << user_id << "/" << u->username << " from " << source << " from "
|
||||
@ -5201,6 +5206,7 @@ void ContactsManager::on_get_user(tl_object_ptr<telegram_api::User> &&user_ptr,
|
||||
u->can_join_groups = can_join_groups;
|
||||
u->can_read_all_group_messages = can_read_all_group_messages;
|
||||
u->restriction_reason = std::move(restriction_reason);
|
||||
u->is_scam = is_scam;
|
||||
u->is_inline_bot = is_inline_bot;
|
||||
u->inline_query_placeholder = std::move(inline_query_placeholder);
|
||||
u->need_location_bot = need_location_bot;
|
||||
@ -5483,7 +5489,7 @@ ContactsManager::User *ContactsManager::get_user_force(UserId user_id) {
|
||||
auto user = telegram_api::make_object<telegram_api::user>(
|
||||
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, 777000, 1, "Telegram", "Updates", string(), "42777",
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, 777000, 1, "Telegram", "Updates", string(), "42777",
|
||||
std::move(profile_photo), nullptr, 0, string(), string(), string());
|
||||
on_get_user(std::move(user), "get_user_force");
|
||||
u = get_user(user_id);
|
||||
@ -10109,6 +10115,7 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
|
||||
bool is_megagroup = (channel.flags_ & CHANNEL_FLAG_IS_MEGAGROUP) != 0;
|
||||
bool is_verified = (channel.flags_ & CHANNEL_FLAG_IS_VERIFIED) != 0;
|
||||
string restriction_reason = std::move(channel.restriction_reason_);
|
||||
bool is_scam = (channel.flags_ & CHANNEL_FLAG_IS_SCAM) != 0;
|
||||
int32 participant_count =
|
||||
(channel.flags_ & CHANNEL_FLAG_HAS_PARTICIPANT_COUNT) != 0 ? channel.participants_count_ : 0;
|
||||
|
||||
@ -10196,11 +10203,12 @@ void ContactsManager::on_chat_update(telegram_api::channel &channel, const char
|
||||
}
|
||||
|
||||
if (c->sign_messages != sign_messages || c->is_megagroup != is_megagroup || c->is_verified != is_verified ||
|
||||
c->restriction_reason != restriction_reason) {
|
||||
c->restriction_reason != restriction_reason || c->is_scam != is_scam) {
|
||||
c->sign_messages = sign_messages;
|
||||
c->is_megagroup = is_megagroup;
|
||||
c->is_verified = is_verified;
|
||||
c->restriction_reason = std::move(restriction_reason);
|
||||
c->is_scam = is_scam;
|
||||
|
||||
c->need_send_update = true;
|
||||
invalidate_channel_full(channel_id, false);
|
||||
@ -10250,6 +10258,7 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
|
||||
bool is_megagroup = (channel.flags_ & CHANNEL_FLAG_IS_MEGAGROUP) != 0;
|
||||
bool is_verified = false;
|
||||
string restriction_reason;
|
||||
bool is_scam = false;
|
||||
|
||||
{
|
||||
bool is_broadcast = (channel.flags_ & CHANNEL_FLAG_IS_BROADCAST) != 0;
|
||||
@ -10268,11 +10277,12 @@ void ContactsManager::on_chat_update(telegram_api::channelForbidden &channel, co
|
||||
}
|
||||
|
||||
if (c->sign_messages != sign_messages || c->is_megagroup != is_megagroup || c->is_verified != is_verified ||
|
||||
c->restriction_reason != restriction_reason) {
|
||||
c->restriction_reason != restriction_reason || c->is_scam != is_scam) {
|
||||
c->sign_messages = sign_messages;
|
||||
c->is_megagroup = is_megagroup;
|
||||
c->is_verified = is_verified;
|
||||
c->restriction_reason = std::move(restriction_reason);
|
||||
c->is_scam = is_scam;
|
||||
|
||||
c->need_send_update = true;
|
||||
invalidate_channel_full(channel_id, false);
|
||||
@ -10357,7 +10367,7 @@ int32 ContactsManager::get_user_id_object(UserId user_id, const char *source) co
|
||||
user_id.get(), "", "", "", "", td_api::make_object<td_api::userStatusEmpty>(),
|
||||
get_profile_photo_object(td_->file_manager_.get(), nullptr),
|
||||
get_link_state_object(LinkState::Unknown), get_link_state_object(LinkState::Unknown), false, false,
|
||||
"", false, td_api::make_object<td_api::userTypeUnknown>(), "")));
|
||||
"", false, false, td_api::make_object<td_api::userTypeUnknown>(), "")));
|
||||
}
|
||||
return user_id.get();
|
||||
}
|
||||
@ -10383,8 +10393,8 @@ tl_object_ptr<td_api::user> ContactsManager::get_user_object(UserId user_id, con
|
||||
return make_tl_object<td_api::user>(
|
||||
user_id.get(), u->first_name, u->last_name, u->username, u->phone_number, get_user_status_object(user_id, u),
|
||||
get_profile_photo_object(td_->file_manager_.get(), &u->photo), get_link_state_object(u->outbound),
|
||||
get_link_state_object(u->inbound), u->is_verified, u->is_support, u->restriction_reason, u->is_received,
|
||||
std::move(type), u->language_code);
|
||||
get_link_state_object(u->inbound), u->is_verified, u->is_support, u->restriction_reason, u->is_scam,
|
||||
u->is_received, std::move(type), u->language_code);
|
||||
}
|
||||
|
||||
vector<int32> ContactsManager::get_user_ids_object(const vector<UserId> &user_ids) const {
|
||||
@ -10466,7 +10476,7 @@ int32 ContactsManager::get_supergroup_id_object(ChannelId channel_id, const char
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateSupergroup>(td_api::make_object<td_api::supergroup>(
|
||||
channel_id.get(), string(), 0, DialogParticipantStatus::Banned(0).get_chat_member_status_object(),
|
||||
0, false, true, false, "")));
|
||||
0, false, true, false, "", false)));
|
||||
}
|
||||
return channel_id.get();
|
||||
}
|
||||
@ -10483,7 +10493,7 @@ tl_object_ptr<td_api::supergroup> ContactsManager::get_supergroup_object(Channel
|
||||
return make_tl_object<td_api::supergroup>(channel_id.get(), channel->username, channel->date,
|
||||
get_channel_status(channel).get_chat_member_status_object(),
|
||||
channel->participant_count, channel->sign_messages, !channel->is_megagroup,
|
||||
channel->is_verified, channel->restriction_reason);
|
||||
channel->is_verified, channel->restriction_reason, channel->is_scam);
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::supergroupFullInfo> ContactsManager::get_supergroup_full_info_object(ChannelId channel_id) const {
|
||||
|
@ -503,6 +503,7 @@ class ContactsManager : public Actor {
|
||||
bool can_read_all_group_messages = true;
|
||||
bool is_inline_bot = false;
|
||||
bool need_location_bot = false;
|
||||
bool is_scam = false;
|
||||
|
||||
bool is_photo_inited = false;
|
||||
bool is_repaired = false;
|
||||
@ -630,6 +631,7 @@ class ContactsManager : public Actor {
|
||||
|
||||
bool is_megagroup = false;
|
||||
bool is_verified = false;
|
||||
bool is_scam = false;
|
||||
|
||||
bool is_title_changed = true;
|
||||
bool is_username_changed = true;
|
||||
@ -752,6 +754,7 @@ class ContactsManager : public Actor {
|
||||
static constexpr int32 USER_FLAG_NEED_LOCATION_BOT = 1 << 21;
|
||||
static constexpr int32 USER_FLAG_HAS_LANGUAGE_CODE = 1 << 22;
|
||||
static constexpr int32 USER_FLAG_IS_SUPPORT = 1 << 23;
|
||||
static constexpr int32 USER_FLAG_IS_SCAM = 1 << 24;
|
||||
|
||||
static constexpr int32 USER_FULL_FLAG_IS_BLOCKED = 1 << 0;
|
||||
static constexpr int32 USER_FULL_FLAG_HAS_ABOUT = 1 << 1;
|
||||
@ -785,6 +788,7 @@ class ContactsManager : public Actor {
|
||||
static constexpr int32 CHANNEL_FLAG_HAS_BANNED_RIGHTS = 1 << 15;
|
||||
static constexpr int32 CHANNEL_FLAG_HAS_UNBAN_DATE = 1 << 16;
|
||||
static constexpr int32 CHANNEL_FLAG_HAS_PARTICIPANT_COUNT = 1 << 17;
|
||||
static constexpr int32 CHANNEL_FLAG_IS_SCAM = 1 << 19;
|
||||
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_PARTICIPANT_COUNT = 1 << 0;
|
||||
static constexpr int32 CHANNEL_FULL_FLAG_HAS_ADMINISTRATOR_COUNT = 1 << 1;
|
||||
|
@ -3245,8 +3245,8 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
||||
auto user = telegram_api::make_object<telegram_api::user>(
|
||||
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, sender_user_id.get(), sender_access_hash, sender_name, string(), string(),
|
||||
string(), std::move(sender_photo), nullptr, 0, string(), string(), string());
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, sender_user_id.get(), sender_access_hash, sender_name,
|
||||
string(), string(), string(), std::move(sender_photo), nullptr, 0, string(), string(), string());
|
||||
td_->contacts_manager_->on_get_user(std::move(user), "process_push_notification_payload");
|
||||
}
|
||||
|
||||
@ -3564,7 +3564,7 @@ void NotificationManager::add_message_push_notification(DialogId dialog_id, Mess
|
||||
int32 flags = telegram_api::user::FIRST_NAME_MASK | telegram_api::user::MIN_MASK;
|
||||
auto user = telegram_api::make_object<telegram_api::user>(
|
||||
flags, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/, false /*ignored*/,
|
||||
false /*ignored*/, false /*ignored*/, sender_user_id.get(), 0, sender_name, string(), string(), string(),
|
||||
nullptr, nullptr, 0, string(), string(), string());
|
||||
td_->contacts_manager_->on_get_user(std::move(user), "add_message_push_notification");
|
||||
|
Loading…
Reference in New Issue
Block a user