From f4a8338232164a4dda223a0c390289661f0dd4b3 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 1 Sep 2023 18:04:06 +0300 Subject: [PATCH] Add more information in td_api::chatInviteLinkInfo. --- td/generate/scheme/td_api.tl | 5 ++++- td/telegram/ContactsManager.cpp | 16 ++++++++++++++-- td/telegram/ContactsManager.h | 3 +++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 11f44d270..5f20e6e13 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -913,7 +913,10 @@ chatInviteLinkMembers total_count:int32 members:vector = C //@member_user_ids User identifiers of some chat members that may be known to the current user //@creates_join_request True, if the link only creates join request //@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup -chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:ChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool = ChatInviteLinkInfo; +//@is_verified True, if the chat is verified +//@is_scam True, if many users reported this chat as a scam +//@is_fake True, if many users reported this chat as a fake account +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:ChatType title:string photo:chatPhotoInfo description:string member_count:int32 member_user_ids:vector creates_join_request:Bool is_public:Bool is_verified:Bool is_scam:Bool is_fake:Bool = ChatInviteLinkInfo; //@description Describes a user that sent a join request and waits for administrator approval @user_id User identifier @date Point in time (Unix timestamp) when the user sent the join request @bio A short bio of the user chatJoinRequest user_id:int53 date:int32 bio:string = ChatJoinRequest; diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 54913872e..b1e18e8cf 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -15535,6 +15535,9 @@ void ContactsManager::on_get_dialog_invite_link_info(const string &invite_link, invite_link_info->is_public = is_public; invite_link_info->is_megagroup = is_megagroup; + invite_link_info->is_verified = chat_invite->verified_; + invite_link_info->is_scam = chat_invite->scam_; + invite_link_info->is_fake = chat_invite->fake_; break; } default: @@ -19537,6 +19540,9 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ bool is_public = false; bool is_member = false; td_api::object_ptr chat_type; + bool is_verified = false; + bool is_scam = false; + bool is_fake = false; if (dialog_id.is_valid()) { switch (dialog_id.get_type()) { @@ -19568,6 +19574,9 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ is_megagroup = c->is_megagroup; participant_count = c->participant_count; is_member = c->status.is_member(); + is_verified = c->is_verified; + is_scam = c->is_scam; + is_fake = c->is_fake; } else { LOG(ERROR) << "Have no information about " << channel_id; } @@ -19588,6 +19597,9 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ member_user_ids = get_user_ids_object(invite_link_info->participant_user_ids, "get_chat_invite_link_info_object"); creates_join_request = invite_link_info->creates_join_request; is_public = invite_link_info->is_public; + is_verified = invite_link_info->is_verified; + is_scam = invite_link_info->is_scam; + is_fake = invite_link_info->is_fake; if (invite_link_info->is_chat) { chat_type = td_api::make_object(0); @@ -19607,10 +19619,10 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ } } - return make_tl_object( + return td_api::make_object( td_->messages_manager_->get_chat_id_object(dialog_id, "chatInviteLinkInfo"), accessible_for, std::move(chat_type), title, get_chat_photo_info_object(td_->file_manager_.get(), photo), description, participant_count, - std::move(member_user_ids), creates_join_request, is_public); + std::move(member_user_ids), creates_join_request, is_public, is_verified, is_scam, is_fake); } void ContactsManager::get_support_user(Promise> &&promise) { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 762a5c611..37b9c24bb 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1140,6 +1140,9 @@ class ContactsManager final : public Actor { bool is_channel = false; bool is_public = false; bool is_megagroup = false; + bool is_verified = false; + bool is_scam = false; + bool is_fake = false; }; struct PendingGetPhotoRequest {