Add td_api::setInactiveSessionsTtl.
This commit is contained in:
parent
b940d2e208
commit
6c9b5ebf55
@ -322,7 +322,7 @@ game id:int64 short_name:string title:string text:formattedText description:stri
|
||||
//@description Describes a poll @id Unique poll identifier @question Poll question; 1-300 characters @options List of poll answer options
|
||||
//@total_voter_count Total number of voters, participating in the poll @recent_voter_user_ids User identifiers of recent voters, if the poll is non-anonymous
|
||||
//@is_anonymous True, if the poll is anonymous @type Type of the poll
|
||||
//@open_period Amount of time the poll will be active after creation, in seconds @close_date Point in time (Unix timestamp) when the poll will be automatically closed @is_closed True, if the poll is closed
|
||||
//@open_period Amount of time the poll will be active after creation, in seconds @close_date Point in time (Unix timestamp) when the poll will automatically be closed @is_closed True, if the poll is closed
|
||||
poll id:int64 question:string options:vector<pollOption> total_voter_count:int32 recent_voter_user_ids:vector<int53> is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll;
|
||||
|
||||
|
||||
@ -2012,7 +2012,7 @@ inputMessageInvoice invoice:invoice title:string description:string photo_url:st
|
||||
//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot @question Poll question; 1-255 characters (up to 300 characters for bots) @options List of poll answer options, 2-10 strings 1-100 characters each
|
||||
//@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels @type Type of the poll
|
||||
//@open_period Amount of time the poll will be active after creation, in seconds; for bots only
|
||||
//@close_date Point in time (Unix timestamp) when the poll will be automatically closed; for bots only
|
||||
//@close_date Point in time (Unix timestamp) when the poll will automatically be closed; for bots only
|
||||
//@is_closed True, if the poll needs to be sent already closed; for bots only
|
||||
inputMessagePoll question:string options:vector<string> is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent;
|
||||
|
||||
@ -3110,8 +3110,8 @@ accountTtl days:int32 = AccountTtl;
|
||||
//@country A two-letter country code for the country from which the session was created, based on the IP address @region Region code from which the session was created, based on the IP address
|
||||
session id:int64 is_current:Bool is_password_pending:Bool can_accept_secret_chats:Bool api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session;
|
||||
|
||||
//@description Contains a list of sessions @sessions List of sessions @inactive_sessions_ttl_days Number of days of inactivity before sessions will be automatically terminated; 1-366 days
|
||||
sessions sessions:vector<session> inactive_sessions_ttl_days:int32 = Sessions;
|
||||
//@description Contains a list of sessions @sessions List of sessions @inactive_session_ttl_days Number of days of inactivity before sessions will automatically be terminated; 1-366 days
|
||||
sessions sessions:vector<session> inactive_session_ttl_days:int32 = Sessions;
|
||||
|
||||
|
||||
//@description Contains information about one website the current user is logged in with Telegram
|
||||
@ -3973,7 +3973,7 @@ logStreamDefault = LogStream;
|
||||
|
||||
//@description The log is written to a file
|
||||
//@path Path to the file to where the internal TDLib log will be written
|
||||
//@max_file_size The maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated, in bytes
|
||||
//@max_file_size The maximum size of the file to where the internal TDLib log is written before the file will automatically be rotated, in bytes
|
||||
//@redirect_stderr Pass true to additionally redirect stderr to the log file. Ignored on Windows
|
||||
logStreamFile path:string max_file_size:int53 redirect_stderr:Bool = LogStream;
|
||||
|
||||
@ -4880,7 +4880,7 @@ setPinnedChats chat_list:ChatList chat_ids:vector<int53> = Ok;
|
||||
//@file_id Identifier of the file to download
|
||||
//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first
|
||||
//@offset The starting position from which the file needs to be downloaded
|
||||
//@limit Number of bytes which need to be downloaded starting from the "offset" position before the download will be automatically canceled; use 0 to download without a limit
|
||||
//@limit Number of bytes which need to be downloaded starting from the "offset" position before the download will automatically be canceled; use 0 to download without a limit
|
||||
//@synchronous If false, this request returns file state just after the download has been started. If true, this request returns file state only after
|
||||
//-the download has succeeded, has failed, has been canceled or a new downloadFile request with different offset/limit parameters was sent
|
||||
downloadFile file_id:int32 priority:int32 offset:int32 limit:int32 synchronous:Bool = File;
|
||||
@ -5363,6 +5363,9 @@ terminateAllOtherSessions = Ok;
|
||||
//@description Toggles whether a session can accept incoming secret chats @session_id Session identifier @can_accept_secret_chats True, if incoming secret chats can be accepted by the session
|
||||
toggleSessionCanAcceptSecretChats session_id:int64 can_accept_secret_chats:Bool = Ok;
|
||||
|
||||
//@description Changes the period of inactivity after which sessions will automatically be terminated @inactive_session_ttl_days New number of days of inactivity before sessions will be automatically terminated; 1-366 days
|
||||
setInactiveSessionsTtl inactive_session_ttl_days:int32 = Ok;
|
||||
|
||||
|
||||
//@description Returns all website where the current user used Telegram to log in
|
||||
getConnectedWebsites = ConnectedWebsites;
|
||||
|
@ -248,7 +248,34 @@ class ChangeAuthorizationSettingsQuery final : public Td::ResultHandler {
|
||||
}
|
||||
|
||||
bool result = result_ptr.move_as_ok();
|
||||
LOG_IF(WARNING, !result) << "Failed to change authorization settings";
|
||||
LOG_IF(WARNING, !result) << "Failed to change session settings";
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class SetAuthorizationTtlQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit SetAuthorizationTtlQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(int32 authorization_ttl_days) {
|
||||
send_query(G()->net_query_creator().create(telegram_api::account_setAuthorizationTTL(authorization_ttl_days)));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::account_setAuthorizationTTL>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
bool result = result_ptr.move_as_ok();
|
||||
LOG_IF(WARNING, !result) << "Failed to set inactive session TTL";
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
@ -397,6 +424,10 @@ void toggle_session_can_accept_secret_chats(Td *td, int64 session_id, bool can_a
|
||||
td->create_handler<ChangeAuthorizationSettingsQuery>(std::move(promise))->send(session_id, !can_accept_secret_chats);
|
||||
}
|
||||
|
||||
void set_inactive_session_ttl_days(Td *td, int32 authorization_ttl_days, Promise<Unit> &&promise) {
|
||||
td->create_handler<SetAuthorizationTtlQuery>(std::move(promise))->send(authorization_ttl_days);
|
||||
}
|
||||
|
||||
void get_connected_websites(Td *td, Promise<td_api::object_ptr<td_api::connectedWebsites>> &&promise) {
|
||||
td->create_handler<GetWebAuthorizationsQuery>(std::move(promise))->send();
|
||||
}
|
||||
|
@ -31,6 +31,8 @@ void terminate_all_other_sessions(Td *td, Promise<Unit> &&promise);
|
||||
void toggle_session_can_accept_secret_chats(Td *td, int64 session_id, bool can_accept_secret_chats,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void set_inactive_session_ttl_days(Td *td, int32 authorization_ttl_days, Promise<Unit> &&promise);
|
||||
|
||||
void get_connected_websites(Td *td, Promise<td_api::object_ptr<td_api::connectedWebsites>> &&promise);
|
||||
|
||||
void disconnect_website(Td *td, int64 website_id, Promise<Unit> &&promise);
|
||||
|
@ -4796,6 +4796,12 @@ void Td::on_request(uint64 id, const td_api::toggleSessionCanAcceptSecretChats &
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::setInactiveSessionsTtl &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
set_inactive_session_ttl_days(this, request.inactive_session_ttl_days_, std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getConnectedWebsites &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
|
@ -482,6 +482,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, const td_api::toggleSessionCanAcceptSecretChats &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::setInactiveSessionsTtl &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::getConnectedWebsites &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::disconnectWebsite &request);
|
||||
|
@ -2242,17 +2242,19 @@ class CliClient final : public Actor {
|
||||
td_api::make_object<td_api::setAccountTtl>(td_api::make_object<td_api::accountTtl>(to_integer<int32>(args))));
|
||||
} else if (op == "gattl") {
|
||||
send_request(td_api::make_object<td_api::getAccountTtl>());
|
||||
} else if (op == "GetActiveSessions") {
|
||||
} else if (op == "GetActiveSessions" || op == "devices" || op == "sessions") {
|
||||
send_request(td_api::make_object<td_api::getActiveSessions>());
|
||||
} else if (op == "TerminateSession") {
|
||||
send_request(td_api::make_object<td_api::terminateSession>(to_integer<int64>(args)));
|
||||
} else if (op == "TerminateAllOtherSessions") {
|
||||
send_request(td_api::make_object<td_api::terminateAllOtherSessions>());
|
||||
} else if (op == "sscasc") {
|
||||
} else if (op == "tscasc") {
|
||||
int64 session_id;
|
||||
bool can_accept_secret_chats;
|
||||
get_args(args, session_id, can_accept_secret_chats);
|
||||
send_request(td_api::make_object<td_api::toggleSessionCanAcceptSecretChats>(session_id, can_accept_secret_chats));
|
||||
} else if (op == "sist") {
|
||||
send_request(td_api::make_object<td_api::setInactiveSessionsTtl>(to_integer<int32>(args)));
|
||||
} else if (op == "gcw") {
|
||||
send_request(td_api::make_object<td_api::getConnectedWebsites>());
|
||||
} else if (op == "dw") {
|
||||
|
Loading…
Reference in New Issue
Block a user