diff --git a/CHANGELOG.md b/CHANGELOG.md index 619d26a70..34836afa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -Changes in 1.7.0: +Changes in 1.7.0 (28 Nov 2020): * Added a new simplified JSON interface in which updates and responses to requests from all TDLib instances are received in the same thread: @@ -287,8 +287,11 @@ Changes in 1.7.0: * Added the field `progressive_sizes` to the class `photo` to allow partial progressive JPEG photo download. * Added the field `redirect_stderr` to the class `logStreamFile` to allow explicit control over stderr redirection to the log file. +* Added the read-only option "can_archive_and_mute_new_chats_from_unknown_users", which can be used to check, whether + the option "archive_and_mute_new_chats_from_unknown_users" can be changed. * Added the writable option "archive_and_mute_new_chats_from_unknown_users", which can be used to automatically archive - and mute new chats from non-contacts. The option can be set only if the change was suggested by the server. + and mute new chats from non-contacts. The option can be set only if the option + "can_archive_and_mute_new_chats_from_unknown_users" is true. * Added the writable option "message_unload_delay", which can be used to change the minimum delay before messages are unloaded from the memory. * Added the writable option "disable_persistent_network_statistics", which can be used to disable persistent diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fdb81377..7109bccbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) -project(TDLib VERSION 1.6.10 LANGUAGES CXX C) +project(TDLib VERSION 1.7.0 LANGUAGES CXX C) if (NOT DEFINED CMAKE_MODULE_PATH) set(CMAKE_MODULE_PATH "") diff --git a/README.md b/README.md index f525f7ed7..641d24ca6 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ target_link_libraries(YourTarget PRIVATE Td::TdStatic) Or you could install `TDLib` and then reference it in your CMakeLists.txt like this: ``` -find_package(Td 1.6.10 REQUIRED) +find_package(Td 1.7.0 REQUIRED) target_link_libraries(YourTarget PRIVATE Td::TdStatic) ``` See [example/cpp/CMakeLists.txt](https://github.com/tdlib/td/tree/master/example/cpp/CMakeLists.txt). diff --git a/build.html b/build.html index 0ba31c13a..cfd2b192e 100644 --- a/build.html +++ b/build.html @@ -715,7 +715,7 @@ function onOptionsChanged() { commands.push('git clone https://github.com/tdlib/td.git'); commands.push('cd td'); - // commands.push('git checkout v1.6.0'); + commands.push('git checkout v1.7.0'); if (use_vcpkg) { commands.push('git clone https://github.com/Microsoft/vcpkg.git'); diff --git a/example/README.md b/example/README.md index d5957afd0..b00d12b55 100644 --- a/example/README.md +++ b/example/README.md @@ -169,7 +169,7 @@ See [project.scarlet](https://github.com/aaugmentum/project.scarlet), [tdlib](ht TDLib can be used from the Rust programming language through the [JSON](https://github.com/tdlib/td#using-json) interface. -See [tdlib-rs](https://github.com/agnipau/tdlib-rs], which contains automatically generated classes for all TDLib API methods and objects. +See [tdlib-rs](https://github.com/agnipau/tdlib-rs), which contains automatically generated classes for all TDLib API methods and objects. See [rtdlib](https://github.com/fewensa/rtdlib), [tdlib-rs](https://github.com/d653/tdlib-rs), [tdlib-futures](https://github.com/yuri91/tdlib-futures), [tdlib-sys](https://github.com/nuxeh/tdlib-sys), [rust-tdlib](https://github.com/lattenwald/rust-tdlib), or diff --git a/example/cpp/CMakeLists.txt b/example/cpp/CMakeLists.txt index cacf5a99a..2d1e0cde0 100644 --- a/example/cpp/CMakeLists.txt +++ b/example/cpp/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR) project(TdExample VERSION 1.0 LANGUAGES CXX) -find_package(Td 1.6.10 REQUIRED) +find_package(Td 1.7.0 REQUIRED) add_executable(tdjson_example tdjson_example.cpp) target_link_libraries(tdjson_example PRIVATE Td::TdJson) diff --git a/example/uwp/extension.vsixmanifest b/example/uwp/extension.vsixmanifest index fc35ea9c8..62a2374f5 100644 --- a/example/uwp/extension.vsixmanifest +++ b/example/uwp/extension.vsixmanifest @@ -1,6 +1,6 @@ - + TDLib for Universal Windows Platform TDLib is a library for building Telegram clients https://core.telegram.org/tdlib diff --git a/example/web/tdweb/package.json b/example/web/tdweb/package.json index 2de3a049c..2894319c5 100644 --- a/example/web/tdweb/package.json +++ b/example/web/tdweb/package.json @@ -1,7 +1,7 @@ { "name": "tdweb", - "version": "1.6.9", - "description": "Javascript interface for TDLib (telegram library)", + "version": "1.7.0", + "description": "JavaScript interface for TDLib (Telegram library)", "main": "dist/tdweb.js", "repository": { "type": "git", diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index da27eeb02..f94da7fc6 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -649,7 +649,7 @@ messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; //@description The message was originally a post in a channel //@chat_id Identifier of the chat from which the message was originally forwarded -//@message_id Message identifier of the original message; 0 if unknown +//@message_id Message identifier of the original message //@author_signature Original post author signature messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 6bf45802f..5b331bcaf 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -1483,6 +1483,7 @@ void ConfigManager::process_app_config(tl_object_ptr &c string animation_search_provider; string animation_search_emojis; vector suggested_actions; + bool can_archive_and_mute_new_chats_from_unknown_users = false; if (config->get_id() == telegram_api::jsonObject::ID) { for (auto &key_value : static_cast(config.get())->value_) { Slice key = key_value->key_; @@ -1630,6 +1631,15 @@ void ConfigManager::process_app_config(tl_object_ptr &c } continue; } + if (key == "autoarchive_setting_available") { + if (value->get_id() == telegram_api::jsonBool::ID) { + can_archive_and_mute_new_chats_from_unknown_users = + std::move(static_cast(value)->value_); + } else { + LOG(ERROR) << "Receive unexpected autoarchive_setting_available " << to_string(*value); + } + continue; + } new_values.push_back(std::move(key_value)); } @@ -1677,6 +1687,12 @@ void ConfigManager::process_app_config(tl_object_ptr &c } else { shared_config.set_option_string("animation_search_emojis", animation_search_emojis); } + if (!can_archive_and_mute_new_chats_from_unknown_users) { + shared_config.set_option_empty("can_archive_and_mute_new_chats_from_unknown_users"); + } else { + shared_config.set_option_boolean("can_archive_and_mute_new_chats_from_unknown_users", + can_archive_and_mute_new_chats_from_unknown_users); + } shared_config.set_option_empty("default_ton_blockchain_config"); shared_config.set_option_empty("default_ton_blockchain_name"); diff --git a/td/telegram/DialogAction.cpp b/td/telegram/DialogAction.cpp index cdc0512f1..03131bf23 100644 --- a/td/telegram/DialogAction.cpp +++ b/td/telegram/DialogAction.cpp @@ -165,12 +165,12 @@ tl_object_ptr DialogAction::get_input_send_mess return make_tl_object(); case Type::ChoosingContact: return make_tl_object(); + case Type::StartPlayingGame: + return make_tl_object(); case Type::RecordingVideoNote: return make_tl_object(); case Type::UploadingVideoNote: return make_tl_object(progress_); - case Type::StartPlayingGame: - return make_tl_object(); default: UNREACHABLE(); return nullptr; @@ -199,12 +199,12 @@ tl_object_ptr DialogAction::get_secret_input_send return make_tl_object(); case Type::ChoosingContact: return make_tl_object(); + case Type::StartPlayingGame: + return make_tl_object(); case Type::RecordingVideoNote: return make_tl_object(); case Type::UploadingVideoNote: return make_tl_object(); - case Type::StartPlayingGame: - return make_tl_object(); default: UNREACHABLE(); return nullptr; diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index c6a61d3ed..452688fad 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -1880,9 +1880,9 @@ void StickersManager::reload_installed_sticker_sets(bool is_masks, bool force) { } auto &next_load_time = next_installed_sticker_sets_load_time_[is_masks]; - if (!td_->auth_manager_->is_bot() && next_load_time >= -9e9 && (next_load_time < Time::now() || force)) { + if (!td_->auth_manager_->is_bot() && next_load_time >= 0 && (next_load_time < Time::now() || force)) { LOG_IF(INFO, force) << "Reload sticker sets"; - next_load_time = -1e10; + next_load_time = -1; td_->create_handler()->send(is_masks, installed_sticker_sets_hash_[is_masks]); } } @@ -1893,9 +1893,9 @@ void StickersManager::reload_featured_sticker_sets(bool force) { } auto &next_load_time = next_featured_sticker_sets_load_time_; - if (!td_->auth_manager_->is_bot() && next_load_time >= -9e9 && (next_load_time < Time::now() || force)) { + if (!td_->auth_manager_->is_bot() && next_load_time >= 0 && (next_load_time < Time::now() || force)) { LOG_IF(INFO, force) << "Reload trending sticker sets"; - next_load_time = -1e10; + next_load_time = -1; td_->create_handler()->send(featured_sticker_sets_hash_); } } @@ -5018,9 +5018,9 @@ void StickersManager::reload_recent_stickers(bool is_attached, bool force) { } auto &next_load_time = next_recent_stickers_load_time_[is_attached]; - if (!td_->auth_manager_->is_bot() && next_load_time >= -9e9 && (next_load_time < Time::now() || force)) { + if (!td_->auth_manager_->is_bot() && next_load_time >= 0 && (next_load_time < Time::now() || force)) { LOG_IF(INFO, force) << "Reload recent " << (is_attached ? "attached " : "") << "stickers"; - next_load_time = -1e10; + next_load_time = -1; td_->create_handler()->send(false, is_attached, recent_stickers_hash_[is_attached]); } } @@ -5441,9 +5441,9 @@ void StickersManager::reload_favorite_stickers(bool force) { } auto &next_load_time = next_favorite_stickers_load_time_; - if (!td_->auth_manager_->is_bot() && next_load_time >= -9e9 && (next_load_time < Time::now() || force)) { + if (!td_->auth_manager_->is_bot() && next_load_time >= 0 && (next_load_time < Time::now() || force)) { LOG_IF(INFO, force) << "Reload favorite stickers"; - next_load_time = -1e10; + next_load_time = -1; td_->create_handler()->send(false, get_favorite_stickers_hash()); } } diff --git a/td/telegram/StickersManager.h b/td/telegram/StickersManager.h index 4846190f2..d93514c02 100644 --- a/td/telegram/StickersManager.h +++ b/td/telegram/StickersManager.h @@ -634,10 +634,10 @@ class StickersManager : public Actor { vector recent_sticker_ids_[2]; vector favorite_sticker_ids_; - double next_installed_sticker_sets_load_time_[2] = {-1e10, -1e10}; - double next_featured_sticker_sets_load_time_ = -1e10; - double next_recent_stickers_load_time_[2] = {-1e10, -1e10}; - double next_favorite_stickers_load_time_ = -1e10; + double next_installed_sticker_sets_load_time_[2] = {0, 0}; + double next_featured_sticker_sets_load_time_ = 0; + double next_recent_stickers_load_time_[2] = {0, 0}; + double next_favorite_stickers_load_time_ = 0; int32 installed_sticker_sets_hash_[2] = {0, 0}; int32 featured_sticker_sets_hash_ = 0; diff --git a/td/telegram/Td.h b/td/telegram/Td.h index d84043ac8..7eb1fdc2a 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -241,7 +241,7 @@ class Td final : public NetQueryCallback { static td_api::object_ptr static_request(td_api::object_ptr function); private: - static constexpr const char *TDLIB_VERSION = "1.6.10"; + static constexpr const char *TDLIB_VERSION = "1.7.0"; static constexpr int64 ONLINE_ALARM_ID = 0; static constexpr int64 PING_SERVER_ALARM_ID = -1; static constexpr int32 PING_SERVER_TIMEOUT = 300;