diff options
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/Support.cpp')
-rw-r--r-- | protocols/Telegram/tdlib/td/td/telegram/Support.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/Support.cpp b/protocols/Telegram/tdlib/td/td/telegram/Support.cpp index 31dea54d2a..191a10a635 100644 --- a/protocols/Telegram/tdlib/td/td/telegram/Support.cpp +++ b/protocols/Telegram/tdlib/td/td/telegram/Support.cpp @@ -1,5 +1,5 @@ // -// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022 +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -98,6 +98,31 @@ class EditUserInfoQuery final : public Td::ResultHandler { } }; +class GetSupportNameQuery final : public Td::ResultHandler { + Promise<string> promise_; + + public: + explicit GetSupportNameQuery(Promise<string> &&promise) : promise_(std::move(promise)) { + } + + void send() { + send_query(G()->net_query_creator().create(telegram_api::help_getSupportName())); + } + + void on_result(BufferSlice packet) final { + auto result_ptr = fetch_result<telegram_api::help_getSupportName>(packet); + if (result_ptr.is_error()) { + return on_error(result_ptr.move_as_error()); + } + + promise_.set_value(std::move(result_ptr.ok_ref()->name_)); + } + + void on_error(Status status) final { + promise_.set_error(std::move(status)); + } +}; + void get_user_info(Td *td, UserId user_id, Promise<td_api::object_ptr<td_api::userSupportInfo>> &&promise) { td->create_handler<GetUserInfoQuery>(std::move(promise))->send(user_id); } @@ -110,4 +135,8 @@ void set_user_info(Td *td, UserId user_id, td_api::object_ptr<td_api::formattedT td->create_handler<EditUserInfoQuery>(std::move(promise))->send(user_id, std::move(formatted_text)); } +void get_support_name(Td *td, Promise<string> &&promise) { + td->create_handler<GetSupportNameQuery>(std::move(promise))->send(); +} + } // namespace td |