From 651172ed859d0cda8621418f14bfeee5a8b6c327 Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 20 Apr 2019 20:49:21 +0300 Subject: [PATCH] Add is_dark parameter to getChatStatisticsUrl. GitOrigin-RevId: f2381e8df342efa288fa191df27a79a799f972e2 --- td/generate/scheme/td_api.tl | 4 ++-- td/generate/scheme/td_api.tlo | Bin 151160 -> 151192 bytes td/telegram/MessagesManager.cpp | 7 ++++--- td/telegram/MessagesManager.h | 2 +- td/telegram/Td.cpp | 3 ++- td/telegram/cli.cpp | 6 ++++-- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 7d05d68a3..069255a92 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -3613,8 +3613,8 @@ changeChatReportSpamState chat_id:int53 is_spam_chat:Bool = Ok; reportChat chat_id:int53 reason:ChatReportReason message_ids:vector = Ok; -//@description Returns URL with chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link -getChatStatisticsUrl chat_id:int53 parameters:string = HttpUrl; +//@description Returns URL with the chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned +getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl; //@description Returns storage usage statistics. Can be called before authorization @chat_limit Maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 diff --git a/td/generate/scheme/td_api.tlo b/td/generate/scheme/td_api.tlo index bc49c075b53aa10f49cb4f3779861fca99ce07f9..8414d58dc41db2528be9f3bbcdf6fd2c890551f9 100644 GIT binary patch delta 57 zcmV-90LK6LoC%nn34pW#h~xzS#BV~EjN}0zla%Hum(}C}AD3Vu0R;zXb6;d(a%+aEkjN}0zm&oz~DVJp=0w> &&promise) : promise_(std::move(promise)) { } - void send(DialogId dialog_id, const string ¶meters) { + void send(DialogId dialog_id, const string ¶meters, bool is_dark) { + // TODO use parameters and is_dark dialog_id_ = dialog_id; auto input_peer = td->messages_manager_->get_input_peer(dialog_id, AccessRights::Read); CHECK(input_peer != nullptr); @@ -6278,7 +6279,7 @@ void MessagesManager::on_get_peer_settings(DialogId dialog_id, on_dialog_updated(dialog_id, "can_report_spam"); } -void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string ¶meters, +void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string ¶meters, bool is_dark, Promise> &&promise) { Dialog *d = get_dialog_force(dialog_id); if (d == nullptr) { @@ -6292,7 +6293,7 @@ void MessagesManager::get_dialog_statistics_url(DialogId dialog_id, const string return promise.set_error(Status::Error(500, "There is no statistics for secret chats")); } - td_->create_handler(std::move(promise))->send(dialog_id, parameters); + td_->create_handler(std::move(promise))->send(dialog_id, parameters, is_dark); } void MessagesManager::load_secret_thumbnail(FileId thumbnail_file_id) { diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 5bba6261c..68e270b3c 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -638,7 +638,7 @@ class MessagesManager : public Actor { void report_dialog(DialogId dialog_id, const tl_object_ptr &reason, const vector &message_ids, Promise &&promise); - void get_dialog_statistics_url(DialogId dialog_id, const string ¶meters, + void get_dialog_statistics_url(DialogId dialog_id, const string ¶meters, bool is_dark, Promise> &&promise); void on_get_peer_settings(DialogId dialog_id, tl_object_ptr &&peer_settings); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 55707b99c..342d469d4 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -6293,7 +6293,8 @@ void Td::on_request(uint64 id, td_api::getChatStatisticsUrl &request) { CHECK_IS_USER(); CREATE_REQUEST_PROMISE(); CLEAN_INPUT_STRING(request.parameters_); - messages_manager_->get_dialog_statistics_url(DialogId(request.chat_id_), request.parameters_, std::move(promise)); + messages_manager_->get_dialog_statistics_url(DialogId(request.chat_id_), request.parameters_, request.is_dark_, + std::move(promise)); } void Td::on_request(uint64 id, td_api::setChatNotificationSettings &request) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 2b7ebddf9..ff662eda2 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -3548,9 +3548,11 @@ class CliClient final : public Actor { } else if (op == "gcsu") { string chat_id; string parameters; - std::tie(chat_id, parameters) = split(args); + string is_dark; + std::tie(chat_id, args) = split(args); + std::tie(parameters, is_dark) = split(args); - send_request(td_api::make_object(as_chat_id(args), parameters)); + send_request(td_api::make_object(as_chat_id(args), parameters, as_bool(is_dark))); } else if (op == "rsgs" || op == "rchs") { string supergroup_id; string user_id;