diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 5874a45ea..e5412b01c 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -564,7 +564,7 @@ supergroupMembersFilterBots = SupergroupMembersFilter; //@description Contains a chat invite link //@invite_link Chat invite link -//@title Title of the chat invite link +//@name Name of the chat invite link //@creator_user_id User identifier of an administrator created the link //@date Point in time (Unix timestamp) when the link was created //@edit_date Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown @@ -572,10 +572,10 @@ supergroupMembersFilterBots = SupergroupMembersFilter; //@member_limit The maximum number of members, which can join the chat using the link simultaneously; 0 if not limited. Always 0 if the link requires approval //@member_count Number of chat members, which joined the chat using the link //@pending_join_request_count Number of pending join requests, created using this link -//@requires_approval True, if users joining the chat by the link need to be approved by chat administrators. If true, total number of joining members will be unlimited -//@is_primary True, if the link is primary. Primary invite link can't have title, expire date or usage limit. There is exactly one primary invite link for each administrator with can_invite_users right at a given time +//@creates_join_request True, if the link only creates join request. If true, total number of joining members will be unlimited +//@is_primary True, if the link is primary. Primary invite link can't have name, expire date or usage limit. There is exactly one primary invite link for each administrator with can_invite_users right at a given time //@is_revoked True, if the link was revoked -chatInviteLink invite_link:string title:string creator_user_id:int53 date:int32 edit_date:int32 expire_date:int32 member_limit:int32 member_count:int32 pending_join_request_count:int32 requires_approval:Bool is_primary:Bool is_revoked:Bool = ChatInviteLink; +chatInviteLink invite_link:string name:string creator_user_id:int53 date:int32 edit_date:int32 expire_date:int32 member_limit:int32 member_count:int32 pending_join_request_count:int32 creates_join_request:Bool is_primary:Bool is_revoked:Bool = ChatInviteLink; //@description Contains a list of chat invite links @total_count Approximate total count of chat invite links found @invite_links List of invite links chatInviteLinks total_count:int32 invite_links:vector = ChatInviteLinks; @@ -604,9 +604,9 @@ chatInviteLinkMembers total_count:int32 members:vector = C //@param_description Chat description //@member_count Number of members in the chat //@member_user_ids User identifiers of some chat members that may be known to the current user -//@requires_approval True, if the user will need to be approved by chat administrators +//@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 requires_approval:Bool is_public:Bool = ChatInviteLinkInfo; +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; //@description Describes a user waiting administrator approval to join a chat @user_id User identifier @request_date Point in time (Unix timestamp) when the user sent the chat join request @bio A short bio of the user chatJoinRequest user_id:int53 request_date:int32 bio:string = ChatJoinRequest; @@ -4933,20 +4933,20 @@ replacePrimaryChatInviteLink chat_id:int53 = ChatInviteLink; //@description Creates a new invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat //@chat_id Chat identifier -//@title Invite link title; 0-32 characters +//@name Invite link name; 0-32 characters //@expire_date Point in time (Unix timestamp) when the link will expire; pass 0 if never //@member_limit The maximum number of chat members that can join the chat by the link simultaneously; 0-99999; pass 0 if not limited -//@requires_approval True, if users joining the chat by the link need to be approved by chat administrators. If true, member_limit must not be specified -createChatInviteLink chat_id:int53 title:string expire_date:int32 member_limit:int32 requires_approval:Bool = ChatInviteLink; +//@creates_join_request True, if the link only creates join request. If true, member_limit must not be specified +createChatInviteLink chat_id:int53 name:string expire_date:int32 member_limit:int32 creates_join_request:Bool = ChatInviteLink; //@description Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links //@chat_id Chat identifier //@invite_link Invite link to be edited -//@title Invite link title; 0-32 characters +//@name Invite link name; 0-32 characters //@expire_date Point in time (Unix timestamp) when the link will expire; pass 0 if never //@member_limit The maximum number of chat members that can join the chat by the link simultaneously; 0-99999; pass 0 if not limited -//@requires_approval True, if users joining the chat by the link need to be approved by chat administrators. If true, member_limit must not be specified -editChatInviteLink chat_id:int53 invite_link:string title:string expire_date:int32 member_limit:int32 requires_approval:Bool = ChatInviteLink; +//@creates_join_request True, if the link only creates join request. If true, member_limit must not be specified +editChatInviteLink chat_id:int53 invite_link:string name:string expire_date:int32 member_limit:int32 creates_join_request:Bool = ChatInviteLink; //@description Returns information about an invite link. Requires administrator privileges and can_invite_users right in the chat to get own links and owner privileges to get other links //@chat_id Chat identifier diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index a7433639f..db1b00eb8 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -1610,7 +1610,7 @@ class ExportChatInviteQuery final : public Td::ResultHandler { : promise_(std::move(promise)) { } - void send(DialogId dialog_id, const string &title, int32 expire_date, int32 usage_limit, bool requires_approval, + void send(DialogId dialog_id, const string &title, int32 expire_date, int32 usage_limit, bool creates_join_request, bool is_permanent) { dialog_id_ = dialog_id; auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Write); @@ -1625,7 +1625,7 @@ class ExportChatInviteQuery final : public Td::ResultHandler { if (usage_limit > 0) { flags |= telegram_api::messages_exportChatInvite::USAGE_LIMIT_MASK; } - if (requires_approval) { + if (creates_join_request) { flags |= telegram_api::messages_exportChatInvite::REQUEST_NEEDED_MASK; } if (is_permanent) { @@ -1677,7 +1677,7 @@ class EditChatInviteLinkQuery final : public Td::ResultHandler { } void send(DialogId dialog_id, const string &invite_link, const string &title, int32 expire_date, int32 usage_limit, - bool requires_approval) { + bool creates_join_request) { dialog_id_ = dialog_id; auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Write); if (input_peer == nullptr) { @@ -1690,7 +1690,7 @@ class EditChatInviteLinkQuery final : public Td::ResultHandler { telegram_api::messages_editExportedChatInvite::TITLE_MASK; send_query(G()->net_query_creator().create( telegram_api::messages_editExportedChatInvite(flags, false /*ignored*/, std::move(input_peer), invite_link, - expire_date, usage_limit, requires_approval, title))); + expire_date, usage_limit, creates_join_request, title))); } void on_result(uint64 id, BufferSlice packet) final { @@ -7440,40 +7440,40 @@ Status ContactsManager::can_manage_dialog_invite_links(DialogId dialog_id, bool } void ContactsManager::export_dialog_invite_link(DialogId dialog_id, string title, int32 expire_date, int32 usage_limit, - bool requires_approval, bool is_permanent, + bool creates_join_request, bool is_permanent, Promise> &&promise) { get_me(PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, title = std::move(title), expire_date, - usage_limit, requires_approval, is_permanent, + usage_limit, creates_join_request, is_permanent, promise = std::move(promise)](Result &&result) mutable { if (result.is_error()) { promise.set_error(result.move_as_error()); } else { send_closure(actor_id, &ContactsManager::export_dialog_invite_link_impl, dialog_id, std::move(title), expire_date, - usage_limit, requires_approval, is_permanent, std::move(promise)); + usage_limit, creates_join_request, is_permanent, std::move(promise)); } })); } void ContactsManager::export_dialog_invite_link_impl(DialogId dialog_id, string title, int32 expire_date, - int32 usage_limit, bool requires_approval, bool is_permanent, + int32 usage_limit, bool creates_join_request, bool is_permanent, Promise> &&promise) { TRY_STATUS_PROMISE(promise, G()->close_status()); TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id)); - if (requires_approval && usage_limit > 0) { + if (creates_join_request && usage_limit > 0) { return promise.set_error( Status::Error(400, "Member limit can't be specified for links requiring administrator approval")); } auto new_title = clean_name(std::move(title), MAX_INVITE_LINK_TITLE_LENGTH); td_->create_handler(std::move(promise)) - ->send(dialog_id, new_title, expire_date, usage_limit, requires_approval, is_permanent); + ->send(dialog_id, new_title, expire_date, usage_limit, creates_join_request, is_permanent); } void ContactsManager::edit_dialog_invite_link(DialogId dialog_id, const string &invite_link, string title, - int32 expire_date, int32 usage_limit, bool requires_approval, + int32 expire_date, int32 usage_limit, bool creates_join_request, Promise> &&promise) { TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id)); - if (requires_approval && usage_limit > 0) { + if (creates_join_request && usage_limit > 0) { return promise.set_error( Status::Error(400, "Member limit can't be specified for links requiring administrator approval")); } @@ -7484,7 +7484,7 @@ void ContactsManager::edit_dialog_invite_link(DialogId dialog_id, const string & auto new_title = clean_name(std::move(title), MAX_INVITE_LINK_TITLE_LENGTH); td_->create_handler(std::move(promise)) - ->send(dialog_id, invite_link, new_title, expire_date, requires_approval, usage_limit); + ->send(dialog_id, invite_link, new_title, expire_date, creates_join_request, usage_limit); } void ContactsManager::get_dialog_invite_link(DialogId dialog_id, const string &invite_link, @@ -12774,7 +12774,7 @@ void ContactsManager::on_get_dialog_invite_link_info(const string &invite_link, invite_link_info->description = std::move(chat_invite->about_); invite_link_info->participant_count = chat_invite->participants_count_; invite_link_info->participant_user_ids = std::move(participant_user_ids); - invite_link_info->requires_approval = std::move(chat_invite->request_needed_); + invite_link_info->creates_join_request = std::move(chat_invite->request_needed_); invite_link_info->is_chat = (chat_invite->flags_ & CHAT_INVITE_FLAG_IS_CHANNEL) == 0; invite_link_info->is_channel = (chat_invite->flags_ & CHAT_INVITE_FLAG_IS_CHANNEL) != 0; @@ -16215,7 +16215,7 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ string description; int32 participant_count = 0; vector member_user_ids; - bool requires_approval = false; + bool creates_join_request = false; bool is_public = false; bool is_member = false; td_api::object_ptr chat_type; @@ -16268,7 +16268,7 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ description = invite_link_info->description; participant_count = invite_link_info->participant_count; member_user_ids = get_user_ids_object(invite_link_info->participant_user_ids, "get_chat_invite_link_info_object"); - requires_approval = invite_link_info->requires_approval; + creates_join_request = invite_link_info->creates_join_request; is_public = invite_link_info->is_public; if (invite_link_info->is_chat) { @@ -16292,7 +16292,7 @@ tl_object_ptr ContactsManager::get_chat_invite_link_ return make_tl_object(dialog_id.get(), 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), - requires_approval, is_public); + creates_join_request, is_public); } UserId ContactsManager::get_support_user(Promise &&promise) { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index abff47b0e..574f905dd 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -387,11 +387,11 @@ class ContactsManager final : public Actor { void transfer_dialog_ownership(DialogId dialog_id, UserId user_id, const string &password, Promise &&promise); void export_dialog_invite_link(DialogId dialog_id, string title, int32 expire_date, int32 usage_limit, - bool requires_approval, bool is_permanent, + bool creates_join_request, bool is_permanent, Promise> &&promise); void edit_dialog_invite_link(DialogId dialog_id, const string &link, string title, int32 expire_date, - int32 usage_limit, bool requires_approval, + int32 usage_limit, bool creates_join_request, Promise> &&promise); void get_dialog_invite_link(DialogId dialog_id, const string &invite_link, @@ -943,7 +943,7 @@ class ContactsManager final : public Actor { string description; int32 participant_count = 0; vector participant_user_ids; - bool requires_approval = false; + bool creates_join_request = false; bool is_chat = false; bool is_channel = false; bool is_public = false; @@ -1406,7 +1406,7 @@ class ContactsManager final : public Actor { static bool is_channel_public(const Channel *c); void export_dialog_invite_link_impl(DialogId dialog_id, string title, int32 expire_date, int32 usage_limit, - bool requires_approval, bool is_permanent, + bool creates_join_request, bool is_permanent, Promise> &&promise); void remove_dialog_access_by_invite_link(DialogId dialog_id); diff --git a/td/telegram/DialogInviteLink.cpp b/td/telegram/DialogInviteLink.cpp index 6ab4ba74c..ef72dfea9 100644 --- a/td/telegram/DialogInviteLink.cpp +++ b/td/telegram/DialogInviteLink.cpp @@ -27,7 +27,7 @@ DialogInviteLink::DialogInviteLink(tl_object_ptrusage_; edit_date_ = exported_invite->start_date_; request_count_ = exported_invite->requested_; - requires_approval_ = exported_invite->request_needed_; + creates_join_request_ = exported_invite->request_needed_; is_revoked_ = exported_invite->revoked_; is_permanent_ = exported_invite->permanent_; @@ -62,16 +62,16 @@ DialogInviteLink::DialogInviteLink(tl_object_ptr 0 || usage_limit_ > 0 || edit_date_ > 0 || - request_count_ > 0 || requires_approval_)) { + request_count_ > 0 || creates_join_request_)) { LOG(ERROR) << "Receive wrong permanent " << *this; title_.clear(); expire_date_ = 0; usage_limit_ = 0; edit_date_ = 0; request_count_ = 0; - requires_approval_ = false; + creates_join_request_ = false; } - if (requires_approval_ && usage_limit_ > 0) { + if (creates_join_request_ && usage_limit_ > 0) { LOG(ERROR) << "Receive wrong permanent " << *this; usage_limit_ = 0; } @@ -90,7 +90,7 @@ td_api::object_ptr DialogInviteLink::get_chat_invite_lin return td_api::make_object( invite_link_, title_, contacts_manager->get_user_id_object(creator_user_id_, "get_chat_invite_link_object"), - date_, edit_date_, expire_date_, usage_limit_, usage_count_, request_count_, requires_approval_, is_permanent_, + date_, edit_date_, expire_date_, usage_limit_, usage_count_, request_count_, creates_join_request_, is_permanent_, is_revoked_); } @@ -99,7 +99,7 @@ bool operator==(const DialogInviteLink &lhs, const DialogInviteLink &rhs) { lhs.creator_user_id_ == rhs.creator_user_id_ && lhs.date_ == rhs.date_ && lhs.edit_date_ == rhs.edit_date_ && lhs.expire_date_ == rhs.expire_date_ && lhs.usage_limit_ == rhs.usage_limit_ && lhs.usage_count_ == rhs.usage_count_ && lhs.request_count_ == rhs.request_count_ && - lhs.requires_approval_ == rhs.requires_approval_ && lhs.is_permanent_ == rhs.is_permanent_ && + lhs.creates_join_request_ == rhs.creates_join_request_ && lhs.is_permanent_ == rhs.is_permanent_ && lhs.is_revoked_ == rhs.is_revoked_; } @@ -109,7 +109,7 @@ bool operator!=(const DialogInviteLink &lhs, const DialogInviteLink &rhs) { StringBuilder &operator<<(StringBuilder &string_builder, const DialogInviteLink &invite_link) { return string_builder << "ChatInviteLink[" << invite_link.invite_link_ << '(' << invite_link.title_ << ')' - << (invite_link.requires_approval_ ? " requiring approval" : "") << " by " + << (invite_link.creates_join_request_ ? " creating join request" : "") << " by " << invite_link.creator_user_id_ << " created at " << invite_link.date_ << " edited at " << invite_link.edit_date_ << " expiring at " << invite_link.expire_date_ << " used by " << invite_link.usage_count_ << " with usage limit " << invite_link.usage_limit_ << " and " diff --git a/td/telegram/DialogInviteLink.h b/td/telegram/DialogInviteLink.h index 5d020f421..86f12ca04 100644 --- a/td/telegram/DialogInviteLink.h +++ b/td/telegram/DialogInviteLink.h @@ -29,7 +29,7 @@ class DialogInviteLink { int32 usage_limit_ = 0; int32 usage_count_ = 0; int32 request_count_ = 0; - bool requires_approval_ = false; + bool creates_join_request_ = false; bool is_revoked_ = false; bool is_permanent_ = false; @@ -79,7 +79,7 @@ class DialogInviteLink { STORE_FLAG(has_usage_count); STORE_FLAG(has_edit_date); STORE_FLAG(has_request_count); - STORE_FLAG(requires_approval_); + STORE_FLAG(creates_join_request_); STORE_FLAG(has_title); END_STORE_FLAGS(); store(invite_link_, storer); @@ -122,7 +122,7 @@ class DialogInviteLink { PARSE_FLAG(has_usage_count); PARSE_FLAG(has_edit_date); PARSE_FLAG(has_request_count); - PARSE_FLAG(requires_approval_); + PARSE_FLAG(creates_join_request_); PARSE_FLAG(has_title); END_PARSE_FLAGS(); parse(invite_link_, parser); @@ -146,7 +146,7 @@ class DialogInviteLink { if (has_title) { parse(title_, parser); } - if (requires_approval_) { + if (creates_join_request_) { usage_limit_ = 0; } } diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 61d1e958d..2509d2e6d 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -6350,20 +6350,20 @@ void Td::on_request(uint64 id, const td_api::replacePrimaryChatInviteLink &reque } void Td::on_request(uint64 id, td_api::createChatInviteLink &request) { - CLEAN_INPUT_STRING(request.title_); + CLEAN_INPUT_STRING(request.name_); CREATE_REQUEST_PROMISE(); - contacts_manager_->export_dialog_invite_link(DialogId(request.chat_id_), std::move(request.title_), - request.expire_date_, request.member_limit_, request.requires_approval_, - false, std::move(promise)); + contacts_manager_->export_dialog_invite_link(DialogId(request.chat_id_), std::move(request.name_), + request.expire_date_, request.member_limit_, + request.creates_join_request_, false, std::move(promise)); } void Td::on_request(uint64 id, td_api::editChatInviteLink &request) { - CLEAN_INPUT_STRING(request.title_); + CLEAN_INPUT_STRING(request.name_); CLEAN_INPUT_STRING(request.invite_link_); CREATE_REQUEST_PROMISE(); - contacts_manager_->edit_dialog_invite_link(DialogId(request.chat_id_), request.invite_link_, - std::move(request.title_), request.expire_date_, request.member_limit_, - request.requires_approval_, std::move(promise)); + contacts_manager_->edit_dialog_invite_link(DialogId(request.chat_id_), request.invite_link_, std::move(request.name_), + request.expire_date_, request.member_limit_, request.creates_join_request_, + std::move(promise)); } void Td::on_request(uint64 id, td_api::getChatInviteLink &request) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index bc69d2917..bdfbced33 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2954,23 +2954,23 @@ class CliClient final : public Actor { send_request(td_api::make_object(as_chat_id(chat_id))); } else if (op == "ccilt") { string chat_id; - string title; + string name; int32 expire_date; int32 member_limit; - bool requires_approval; - get_args(args, chat_id, title, expire_date, member_limit, requires_approval); - send_request(td_api::make_object(as_chat_id(chat_id), title, expire_date, - member_limit, requires_approval)); + bool creates_join_request; + get_args(args, chat_id, name, expire_date, member_limit, creates_join_request); + send_request(td_api::make_object(as_chat_id(chat_id), name, expire_date, + member_limit, creates_join_request)); } else if (op == "ecil") { string chat_id; string invite_link; - string title; + string name; int32 expire_date; int32 member_limit; - bool requires_approval; - get_args(args, chat_id, invite_link, title, expire_date, member_limit, requires_approval); - send_request(td_api::make_object(as_chat_id(chat_id), invite_link, title, expire_date, - member_limit, requires_approval)); + bool creates_join_request; + get_args(args, chat_id, invite_link, name, expire_date, member_limit, creates_join_request); + send_request(td_api::make_object(as_chat_id(chat_id), invite_link, name, expire_date, + member_limit, creates_join_request)); } else if (op == "rcil") { string chat_id; string invite_link;