adapt_to_changes_in_tdlib #10
7 changed files with 17429 additions and 1990 deletions
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
@ -23,7 +23,7 @@ namespace td {
|
||||||
* Requests can be sent using the method ClientManager::send from any thread.
|
* Requests can be sent using the method ClientManager::send from any thread.
|
||||||
* New updates and responses to requests can be received using the method ClientManager::receive from any thread after
|
* New updates and responses to requests can be received using the method ClientManager::receive from any thread after
|
||||||
* the first request has been sent to the client instance. ClientManager::receive must not be called simultaneously from
|
* the first request has been sent to the client instance. ClientManager::receive must not be called simultaneously from
|
||||||
* two different threads. Also note that all updates and responses to requests should be applied in the same order as
|
* two different threads. Also, note that all updates and responses to requests should be applied in the same order as
|
||||||
* they were received, to ensure consistency.
|
* they were received, to ensure consistency.
|
||||||
* Some TDLib requests can be executed synchronously from any thread using the method ClientManager::execute.
|
* Some TDLib requests can be executed synchronously from any thread using the method ClientManager::execute.
|
||||||
*
|
*
|
||||||
|
@ -96,7 +96,7 @@ class ClientManager final {
|
||||||
ClientId client_id;
|
ClientId client_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request identifier, to which the response corresponds, or 0 for incoming updates from TDLib.
|
* Request identifier to which the response corresponds, or 0 for incoming updates from TDLib.
|
||||||
*/
|
*/
|
||||||
RequestId request_id;
|
RequestId request_id;
|
||||||
|
|
||||||
|
@ -126,10 +126,10 @@ class ClientManager final {
|
||||||
/**
|
/**
|
||||||
* A type of callback function that will be called when a message is added to the internal TDLib log.
|
* A type of callback function that will be called when a message is added to the internal TDLib log.
|
||||||
*
|
*
|
||||||
* \param verbosity_level Log verbosity level with which the message was added (-1 - 1024).
|
* \param verbosity_level Log verbosity level with which the message was added from -1 up to 1024.
|
||||||
* If 0, then TDLib will crash as soon as the callback returns.
|
* If 0, then TDLib will crash as soon as the callback returns.
|
||||||
* None of the TDLib methods can be called from the callback.
|
* None of the TDLib methods can be called from the callback.
|
||||||
* \param message Null-terminated string with the message added to the log.
|
* \param message Null-terminated UTF-8-encoded string with the message added to the log.
|
||||||
*/
|
*/
|
||||||
using LogMessageCallbackPtr = void (*)(int verbosity_level, const char *message);
|
using LogMessageCallbackPtr = void (*)(int verbosity_level, const char *message);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class ClientManager final {
|
||||||
* The TDLib instance is created for the lifetime of the Client object.
|
* The TDLib instance is created for the lifetime of the Client object.
|
||||||
* Requests to TDLib can be sent using the Client::send method from any thread.
|
* Requests to TDLib can be sent using the Client::send method from any thread.
|
||||||
* New updates and responses to requests can be received using the Client::receive method from any thread,
|
* New updates and responses to requests can be received using the Client::receive method from any thread,
|
||||||
* this function must not be called simultaneously from two different threads. Also note that all updates and
|
* this function must not be called simultaneously from two different threads. Also, note that all updates and
|
||||||
* responses to requests should be applied in the same order as they were received, to ensure consistency.
|
* responses to requests should be applied in the same order as they were received, to ensure consistency.
|
||||||
* Given this information, it's advisable to call this function from a dedicated thread.
|
* Given this information, it's advisable to call this function from a dedicated thread.
|
||||||
* Some service TDLib requests can be executed synchronously from any thread using the Client::execute method.
|
* Some service TDLib requests can be executed synchronously from any thread using the Client::execute method.
|
||||||
|
@ -199,7 +199,7 @@ class ClientManager final {
|
||||||
* if (response.id == 0) {
|
* if (response.id == 0) {
|
||||||
* // process response.object as an incoming update of type td_api::Update
|
* // process response.object as an incoming update of type td_api::Update
|
||||||
* } else {
|
* } else {
|
||||||
* // process response.object as an answer to a sent request with id response.id
|
* // process response.object as an answer to a sent request with identifier response.id
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* \endcode
|
* \endcode
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
* Requests can be sent using td_send and the received client identifier.
|
* Requests can be sent using td_send and the received client identifier.
|
||||||
* New updates and responses to requests can be received through td_receive from any thread after the first request
|
* New updates and responses to requests can be received through td_receive from any thread after the first request
|
||||||
* has been sent to the client instance. This function must not be called simultaneously from two different threads.
|
* has been sent to the client instance. This function must not be called simultaneously from two different threads.
|
||||||
* Also note that all updates and responses to requests must be applied in the order they were received for consistency.
|
* Also, note that all updates and responses to requests must be applied in the order they were received for consistency.
|
||||||
* Some TDLib requests can be executed synchronously from any thread using td_execute.
|
* Some TDLib requests can be executed synchronously from any thread using td_execute.
|
||||||
* TDLib client instances are destroyed automatically after they are closed.
|
* TDLib client instances are destroyed automatically after they are closed.
|
||||||
* All TDLib client instances must be closed before application termination to ensure data consistency.
|
* All TDLib client instances must be closed before application termination to ensure data consistency.
|
||||||
|
@ -88,10 +88,10 @@ TDJSON_EXPORT const char *td_execute(const char *request);
|
||||||
/**
|
/**
|
||||||
* A type of callback function that will be called when a message is added to the internal TDLib log.
|
* A type of callback function that will be called when a message is added to the internal TDLib log.
|
||||||
*
|
*
|
||||||
* \param verbosity_level Log verbosity level with which the message was added (-1 - 1024).
|
* \param verbosity_level Log verbosity level with which the message was added from -1 up to 1024.
|
||||||
* If 0, then TDLib will crash as soon as the callback returns.
|
* If 0, then TDLib will crash as soon as the callback returns.
|
||||||
* None of the TDLib methods can be called from the callback.
|
* None of the TDLib methods can be called from the callback.
|
||||||
* \param message Null-terminated string with the logged message.
|
* \param message Null-terminated UTF-8-encoded string with the message added to the log.
|
||||||
*/
|
*/
|
||||||
typedef void (*td_log_message_callback_ptr)(int verbosity_level, const char *message);
|
typedef void (*td_log_message_callback_ptr)(int verbosity_level, const char *message);
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ TDJSON_EXPORT void td_set_log_message_callback(int max_verbosity_level, td_log_m
|
||||||
* A TDLib client instance can be created through td_json_client_create.
|
* A TDLib client instance can be created through td_json_client_create.
|
||||||
* Requests then can be sent using td_json_client_send from any thread.
|
* Requests then can be sent using td_json_client_send from any thread.
|
||||||
* New updates and request responses can be received through td_json_client_receive from any thread. This function
|
* New updates and request responses can be received through td_json_client_receive from any thread. This function
|
||||||
* must not be called simultaneously from two different threads. Also note that all updates and request responses
|
* must not be called simultaneously from two different threads. Also, note that all updates and request responses
|
||||||
* must be applied in the order they were received to ensure consistency.
|
* must be applied in the order they were received to ensure consistency.
|
||||||
* Given this information, it's advisable to call this function from a dedicated thread.
|
* Given this information, it's advisable to call this function from a dedicated thread.
|
||||||
* Some service TDLib requests can be executed synchronously from any thread by using td_json_client_execute.
|
* Some service TDLib requests can be executed synchronously from any thread by using td_json_client_execute.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
||||||
//
|
//
|
||||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
// 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)
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
@ -97,8 +97,8 @@ class unique_ptr {
|
||||||
using element_type = T;
|
using element_type = T;
|
||||||
|
|
||||||
unique_ptr() noexcept = default;
|
unique_ptr() noexcept = default;
|
||||||
unique_ptr(const unique_ptr &other) = delete;
|
unique_ptr(const unique_ptr &) = delete;
|
||||||
unique_ptr &operator=(const unique_ptr &other) = delete;
|
unique_ptr &operator=(const unique_ptr &) = delete;
|
||||||
unique_ptr(unique_ptr &&other) noexcept : ptr_(other.release()) {
|
unique_ptr(unique_ptr &&other) noexcept : ptr_(other.release()) {
|
||||||
}
|
}
|
||||||
unique_ptr &operator=(unique_ptr &&other) noexcept {
|
unique_ptr &operator=(unique_ptr &&other) noexcept {
|
||||||
|
@ -187,11 +187,11 @@ using tl_object_ptr = tl::unique_ptr<Type>;
|
||||||
* A function to create a dynamically allocated TL-object. Can be treated as an analogue of std::make_unique.
|
* A function to create a dynamically allocated TL-object. Can be treated as an analogue of std::make_unique.
|
||||||
* Usage example:
|
* Usage example:
|
||||||
* \code
|
* \code
|
||||||
* auto get_authorization_state_request = td::make_tl_object<td::td_api::getAuthorizationState>();
|
* auto get_me_request = td::make_tl_object<td::td_api::getMe>();
|
||||||
* auto message_text = td::make_tl_object<td::td_api::formattedText>("Hello, world!!!",
|
* auto message_text = td::make_tl_object<td::td_api::formattedText>("Hello, world!!!",
|
||||||
* td::td_api::array<td::tl_object_ptr<td::td_api::textEntity>>());
|
* td::td_api::array<td::tl_object_ptr<td::td_api::textEntity>>());
|
||||||
* auto send_message_request = td::make_tl_object<td::td_api::sendMessage>(chat_id, 0, 0, nullptr, nullptr,
|
* auto send_message_request = td::make_tl_object<td::td_api::sendMessage>(chat_id, 0, nullptr, nullptr, nullptr,
|
||||||
* td::make_tl_object<td::td_api::inputMessageText>(std::move(message_text), false, true));
|
* td::make_tl_object<td::td_api::inputMessageText>(std::move(message_text), nullptr, true));
|
||||||
* \endcode
|
* \endcode
|
||||||
*
|
*
|
||||||
* \tparam Type Type of the TL-object to construct.
|
* \tparam Type Type of the TL-object to construct.
|
||||||
|
|
Loading…
Reference in a new issue