From c9441d78be1b2e05a375a4a73dda7fed2f3e60e5 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 15 Mar 2022 14:49:05 +0300 Subject: [PATCH 1/2] Allow to send MentionName using TextUrl entities. --- td/telegram/MessageEntity.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 74b835548..25d3f8d98 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -3274,9 +3274,17 @@ Result> get_message_entities(const ContactsManager *contac if (!clean_input_string(entity->url_)) { return Status::Error(400, "MessageEntityTextUrl.url must be encoded in UTF-8"); } + auto user_id = LinkManager::get_link_user_id(entity->url_); + if (user_id.is_valid()) { + if (contacts_manager != nullptr && !contacts_manager->have_input_user(user_id)) { + return Status::Error(400, "Have no access to the user"); + } + entities.emplace_back(offset, length, user_id); + break; + } auto r_url = LinkManager::check_link(entity->url_); if (r_url.is_error()) { - return Status::Error(400, PSTRING() << "Wrong message input_entity: " << r_url.error().message()); + return Status::Error(400, PSTRING() << "Wrong URL entity specified: " << r_url.error().message()); } entities.emplace_back(MessageEntity::Type::TextUrl, offset, length, r_url.move_as_ok()); break; From 3f54c301ead1bbe6529df4ecfb63c7f645dd181c Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 15 Mar 2022 20:09:29 +0300 Subject: [PATCH 2/2] Update version to 1.8.2. --- CMakeLists.txt | 2 +- README.md | 2 +- example/cpp/CMakeLists.txt | 2 +- example/uwp/extension.vsixmanifest | 2 +- td/telegram/Td.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c80a06397..2e5900bff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ if (POLICY CMP0065) cmake_policy(SET CMP0065 NEW) endif() -project(TDLib VERSION 1.8.1 LANGUAGES CXX C) +project(TDLib VERSION 1.8.2 LANGUAGES CXX C) if (NOT DEFINED CMAKE_MODULE_PATH) set(CMAKE_MODULE_PATH "") diff --git a/README.md b/README.md index 4461ae028..dafd19f8d 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,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.8.1 REQUIRED) +find_package(Td 1.8.2 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/example/cpp/CMakeLists.txt b/example/cpp/CMakeLists.txt index 061ec0be0..5a68d2593 100644 --- a/example/cpp/CMakeLists.txt +++ b/example/cpp/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.4 FATAL_ERROR) project(TdExample VERSION 1.0 LANGUAGES CXX) -find_package(Td 1.8.1 REQUIRED) +find_package(Td 1.8.2 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 7d7c9f864..e691126e2 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/td/telegram/Td.h b/td/telegram/Td.h index a60c9bc6d..4c8d8ceae 100644 --- a/td/telegram/Td.h +++ b/td/telegram/Td.h @@ -99,7 +99,7 @@ class Td final : public Actor { Td &operator=(Td &&) = delete; ~Td() final; - static constexpr const char *TDLIB_VERSION = "1.8.1"; + static constexpr const char *TDLIB_VERSION = "1.8.2"; struct Options { std::shared_ptr net_query_stats;