Add offset_date support in getChatInviteLinks.

This commit is contained in:
levlam 2021-01-20 17:30:26 +03:00
parent 1b7c6a9c31
commit 7a45faff24
6 changed files with 24 additions and 16 deletions

View File

@ -4387,10 +4387,14 @@ createChatInviteLink chat_id:int53 expire_date:int32 member_limit:int32 = ChatIn
//@member_limit Maximum number of chat members that can join the chat by the link simultaneously; 0-100000; pass 0 if not limited
editChatInviteLink chat_id:int53 invite_link:string expire_date:int32 member_limit:int32 = ChatInviteLink;
//@description Returns exported invite links for a chat. Requires administrator privileges and can_invite_users right in the chat @chat_id Chat identifier @administrator_user_id If not 0, only invite links created by the specified administrator will be returned
//@description Returns exported invite links for a chat. Requires administrator privileges and can_invite_users right in the chat
//@chat_id Chat identifier
//@administrator_user_id If not 0, only invite links created by the specified administrator will be returned
//@is_revoked Pass true if revoked links needs to be returned instead of active or expired
//@offset_invite_link Invite link starting after which to return invite links; use empty string to get results from the beginning @limit Maximum number of invite links to return
getChatInviteLinks chat_id:int53 administrator_user_id:int32 is_revoked:Bool offset_invite_link:string limit:int32 = ChatInviteLinks;
//@offset_date Creation date of an invite link starting after which to return invite links; use 0 to get results from the beginning
//@offset_invite_link Invite link starting after which to return invite links; use empty string to get results from the beginning
//@limit Maximum number of invite links to return
getChatInviteLinks chat_id:int53 administrator_user_id:int32 is_revoked:Bool offset_date:int32 offset_invite_link:string limit:int32 = ChatInviteLinks;
//@description Returns chat members joined a chat by an invite link. Requires administrator privileges and can_invite_users right in the chat @chat_id Chat identifier @invite_link Invite link for which to return chat members
//@offset_member A chat member from which to return next chat members; use null to get results from the beginning @limit Maximum number of chat members to return

Binary file not shown.

View File

@ -1680,8 +1680,8 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
: promise_(std::move(promise)) {
}
void send(DialogId dialog_id, UserId administrator_user_id, bool is_revoked, const string &offset_invite_link,
int32 limit) {
void send(DialogId dialog_id, UserId administrator_user_id, bool is_revoked, int32 offset_date,
const string &offset_invite_link, int32 limit) {
dialog_id_ = dialog_id;
auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read);
if (input_peer == nullptr) {
@ -1694,14 +1694,16 @@ class GetExportedChatInvitesQuery : public Td::ResultHandler {
if (input_user != nullptr) {
flags |= telegram_api::messages_getExportedChatInvites::ADMIN_ID_MASK;
}
if (!offset_invite_link.empty()) {
if (!offset_invite_link.empty() || offset_date != 0) {
flags |= telegram_api::messages_getExportedChatInvites::OFFSET_DATE_MASK;
flags |= telegram_api::messages_getExportedChatInvites::OFFSET_LINK_MASK;
}
if (is_revoked) {
flags |= telegram_api::messages_getExportedChatInvites::REVOKED_MASK;
}
send_query(G()->net_query_creator().create(telegram_api::messages_getExportedChatInvites(
flags, false /*ignored*/, std::move(input_peer), std::move(input_user), 0, offset_invite_link, limit)));
send_query(G()->net_query_creator().create(
telegram_api::messages_getExportedChatInvites(flags, false /*ignored*/, std::move(input_peer),
std::move(input_user), offset_date, offset_invite_link, limit)));
}
void on_result(uint64 id, BufferSlice packet) override {
@ -7217,7 +7219,7 @@ void ContactsManager::edit_dialog_invite_link(DialogId dialog_id, const string &
}
void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked,
const string &offset_invite_link, int32 limit,
int32 offset_date, const string &offset_invite_link, int32 limit,
Promise<td_api::object_ptr<td_api::chatInviteLinks>> &&promise) {
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id));
@ -7230,7 +7232,7 @@ void ContactsManager::get_dialog_invite_links(DialogId dialog_id, UserId adminis
}
td_->create_handler<GetExportedChatInvitesQuery>(std::move(promise))
->send(dialog_id, administrator_user_id, is_revoked, offset_invite_link, limit);
->send(dialog_id, administrator_user_id, is_revoked, offset_date, offset_invite_link, limit);
}
void ContactsManager::get_dialog_invite_link_users(

View File

@ -398,7 +398,7 @@ class ContactsManager : public Actor {
void edit_dialog_invite_link(DialogId dialog_id, const string &link, int32 expire_date, int32 usage_limit,
bool is_revoked, Promise<td_api::object_ptr<td_api::chatInviteLink>> &&promise);
void get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked,
void get_dialog_invite_links(DialogId dialog_id, UserId administrator_user_id, bool is_revoked, int32 offset_date,
const string &offset_invite_link, int32 limit,
Promise<td_api::object_ptr<td_api::chatInviteLinks>> &&promise);

View File

@ -6326,8 +6326,8 @@ void Td::on_request(uint64 id, td_api::getChatInviteLinks &request) {
CREATE_REQUEST_PROMISE();
CLEAN_INPUT_STRING(request.offset_invite_link_);
contacts_manager_->get_dialog_invite_links(DialogId(request.chat_id_), UserId(request.administrator_user_id_),
request.is_revoked_, request.offset_invite_link_, request.limit_,
std::move(promise));
request.is_revoked_, request.offset_date_, request.offset_invite_link_,
request.limit_, std::move(promise));
}
void Td::on_request(uint64 id, td_api::getChatInviteLinkMembers &request) {

View File

@ -2713,11 +2713,13 @@ class CliClient final : public Actor {
} else if (op == "gcil" || op == "gcilr") {
string chat_id;
string administrator_user_id;
int32 offset_date;
string offset_invite_link;
string limit;
get_args(args, chat_id, administrator_user_id, offset_invite_link, limit);
send_request(td_api::make_object<td_api::getChatInviteLinks>(
as_chat_id(chat_id), as_user_id(administrator_user_id), op == "gcilr", offset_invite_link, as_limit(limit)));
get_args(args, chat_id, administrator_user_id, offset_date, offset_invite_link, limit);
send_request(td_api::make_object<td_api::getChatInviteLinks>(as_chat_id(chat_id),
as_user_id(administrator_user_id), op == "gcilr",
offset_date, offset_invite_link, as_limit(limit)));
} else if (op == "gcilm") {
string chat_id;
string invite_link;