diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c318c193..c66d93421 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -749,6 +749,7 @@ set(TDLIB_SOURCE td/telegram/files/FileLocation.hpp td/telegram/files/FileManager.hpp td/telegram/files/FileSourceId.hpp + td/telegram/ForumTopicEditedData.hpp td/telegram/ForumTopicIcon.hpp td/telegram/Game.hpp td/telegram/InputInvoice.hpp diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 2a4552be4..764c7dd3a 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1303,7 +1303,7 @@ messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyI //@edit_icon_custom_emoji_id True, if icon's custom_emoji_id is changed //@icon_custom_emoji_id New unique identifier of the custom emoji shown on the topic icon; 0 if none. Ignored if edit_icon_custom_emoji_id is false //@edit_is_closed True, if the topic is reopened or closed -//@is_closed True, if the topic is closed, or false if it is reopened. Ignored if edit_is_closed is false +//@is_closed True, if the topic is closed; false if it is reopened. Ignored if edit_is_closed is false forumTopicEditedData title:string edit_icon_custom_emoji_id:Bool icon_custom_emoji_id:int64 edit_is_closed:Bool is_closed:Bool = ForumTopicEditedData; //@description Describes a forum topic icon @color Color of the topic icon in RGB format @custom_emoji_id Unique identifier of the custom emoji shown on the topic icon; 0 if none @@ -6247,7 +6247,7 @@ setBio bio:string = Ok; //@description Changes the editable username of the current user @username The new value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username setUsername username:string = Ok; -//@description Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @username The username to change @is_active True, if the username must be activated, or false, if it must be disabled +//@description Changes active state for a username of the current user. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @username The username to change @is_active Pass true to activate the username; pass false to disable it toggleUsernameIsActive username:string is_active:Bool = Ok; //@description Changes order of active usernames of the current user @usernames The new order of active usernames. All currently active usernames must be specified @@ -6335,7 +6335,7 @@ disconnectAllWebsites = Ok; //@description Changes the editable username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username. The username can't be completely removed if there is another active or disabled username setSupergroupUsername supergroup_id:int53 username:string = Ok; -//@description Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @supergroup_id Identifier of the supergroup or channel @username The username to change @is_active True, if the username must be activated, or false, if it must be disabled +//@description Changes active state for a username of a supergroup or channel, requires owner privileges in the supergroup or channel. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached @supergroup_id Identifier of the supergroup or channel @username The username to change @is_active Pass true to activate the username; pass false to disable it toggleSupergroupUsernameIsActive supergroup_id:int53 username:string is_active:Bool = Ok; //@description Disables all active non-editable usernames of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 56f0e8a98..31dde8e21 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -12067,7 +12067,7 @@ void ContactsManager::on_update_user_usernames(User *u, UserId user_id, Username if (u->usernames != usernames) { u->usernames = std::move(usernames); u->is_username_changed = true; - LOG(DEBUG) << "Usernames has changed for " << user_id; + LOG(DEBUG) << "Usernames have changed for " << user_id; u->is_changed = true; } } diff --git a/td/telegram/DialogEventLog.cpp b/td/telegram/DialogEventLog.cpp index 0e59f0bb3..780a1e5eb 100644 --- a/td/telegram/DialogEventLog.cpp +++ b/td/telegram/DialogEventLog.cpp @@ -364,7 +364,7 @@ static td_api::object_ptr get_chat_event_action_object( } case telegram_api::channelAdminLogEventActionCreateTopic::ID: { auto action = move_tl_object_as(action_ptr); - auto topic_info = ForumTopicInfo(td, action->topic_); + auto topic_info = ForumTopicInfo(action->topic_); if (topic_info.is_empty()) { return nullptr; } @@ -372,8 +372,8 @@ static td_api::object_ptr get_chat_event_action_object( } case telegram_api::channelAdminLogEventActionEditTopic::ID: { auto action = move_tl_object_as(action_ptr); - auto old_topic_info = ForumTopicInfo(td, action->prev_topic_); - auto new_topic_info = ForumTopicInfo(td, action->new_topic_); + auto old_topic_info = ForumTopicInfo(action->prev_topic_); + auto new_topic_info = ForumTopicInfo(action->new_topic_); if (old_topic_info.is_empty() || new_topic_info.is_empty()) { return nullptr; } @@ -382,7 +382,7 @@ static td_api::object_ptr get_chat_event_action_object( } case telegram_api::channelAdminLogEventActionDeleteTopic::ID: { auto action = move_tl_object_as(action_ptr); - auto topic_info = ForumTopicInfo(td, action->topic_); + auto topic_info = ForumTopicInfo(action->topic_); if (topic_info.is_empty()) { return nullptr; } @@ -393,10 +393,10 @@ static td_api::object_ptr get_chat_event_action_object( ForumTopicInfo old_topic_info; ForumTopicInfo new_topic_info; if (action->prev_topic_ != nullptr) { - old_topic_info = ForumTopicInfo(td, action->prev_topic_); + old_topic_info = ForumTopicInfo(action->prev_topic_); } if (action->new_topic_ != nullptr) { - new_topic_info = ForumTopicInfo(td, action->new_topic_); + new_topic_info = ForumTopicInfo(action->new_topic_); } if (old_topic_info.is_empty() && new_topic_info.is_empty()) { return nullptr; diff --git a/td/telegram/ForumTopicEditedData.cpp b/td/telegram/ForumTopicEditedData.cpp index e388313bd..c82745cf5 100644 --- a/td/telegram/ForumTopicEditedData.cpp +++ b/td/telegram/ForumTopicEditedData.cpp @@ -6,8 +6,6 @@ // #include "td/telegram/ForumTopicEditedData.h" -#include "td/utils/logging.h" - namespace td { td_api::object_ptr ForumTopicEditedData::get_forum_topic_edited_data_object() const { diff --git a/td/telegram/ForumTopicInfo.cpp b/td/telegram/ForumTopicInfo.cpp index 1aff5f3bc..4bf949372 100644 --- a/td/telegram/ForumTopicInfo.cpp +++ b/td/telegram/ForumTopicInfo.cpp @@ -8,13 +8,12 @@ #include "td/telegram/MessageSender.h" #include "td/telegram/ServerMessageId.h" -#include "td/telegram/Td.h" #include "td/utils/logging.h" namespace td { -ForumTopicInfo::ForumTopicInfo(Td *td, const tl_object_ptr &forum_topic_ptr) { +ForumTopicInfo::ForumTopicInfo(const tl_object_ptr &forum_topic_ptr) { CHECK(forum_topic_ptr != nullptr); if (forum_topic_ptr->get_id() != telegram_api::forumTopic::ID) { LOG(ERROR) << "Receive " << to_string(forum_topic_ptr); diff --git a/td/telegram/ForumTopicInfo.h b/td/telegram/ForumTopicInfo.h index 213d91e7c..3ac1ed14f 100644 --- a/td/telegram/ForumTopicInfo.h +++ b/td/telegram/ForumTopicInfo.h @@ -33,7 +33,7 @@ class ForumTopicInfo { public: ForumTopicInfo() = default; - ForumTopicInfo(Td *td, const tl_object_ptr &forum_topic_ptr); + explicit ForumTopicInfo(const tl_object_ptr &forum_topic_ptr); bool is_empty() const { return !top_thread_message_id_.is_valid(); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 7b3abd4df..f4f8d10f7 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -6278,10 +6278,10 @@ void StickersManager::timeout_expired() { } void StickersManager::flush_pending_animated_emoji_clicks() { - if (pending_animated_emoji_clicks_.empty()) { + if (G()->close_flag()) { return; } - if (G()->close_flag()) { + if (pending_animated_emoji_clicks_.empty()) { return; } auto clicks = std::move(pending_animated_emoji_clicks_); diff --git a/td/telegram/TranscriptionInfo.cpp b/td/telegram/TranscriptionInfo.cpp index 17a02f31d..fee7aa183 100644 --- a/td/telegram/TranscriptionInfo.cpp +++ b/td/telegram/TranscriptionInfo.cpp @@ -6,9 +6,12 @@ // #include "td/telegram/TranscriptionInfo.h" +#include "td/telegram/AccessRights.h" #include "td/telegram/DialogId.h" +#include "td/telegram/Global.h" #include "td/telegram/MessagesManager.h" #include "td/telegram/Td.h" +#include "td/telegram/telegram_api.h" #include "td/utils/buffer.h" #include "td/utils/logging.h" diff --git a/td/telegram/Usernames.cpp b/td/telegram/Usernames.cpp index cb859733b..e7bf50ee3 100644 --- a/td/telegram/Usernames.cpp +++ b/td/telegram/Usernames.cpp @@ -6,11 +6,11 @@ // #include "td/telegram/Usernames.h" -#include "td/telegram/misc.h" -#include "td/telegram/secret_api.h" - #include "td/utils/algorithm.h" +#include "td/utils/FlatHashSet.h" +#include "td/utils/logging.h" #include "td/utils/misc.h" +#include "td/utils/utf8.h" namespace td { @@ -133,7 +133,7 @@ Usernames Usernames::deactivate_all() const { result.disabled_usernames_.push_back(active_usernames_[i]); } } - td::append(result.disabled_usernames_, disabled_usernames_); + append(result.disabled_usernames_, disabled_usernames_); CHECK(result.has_editable_username() == has_editable_username()); return result; } diff --git a/td/telegram/VideoNotesManager.h b/td/telegram/VideoNotesManager.h index a69596aa4..cdb8c12dd 100644 --- a/td/telegram/VideoNotesManager.h +++ b/td/telegram/VideoNotesManager.h @@ -16,6 +16,7 @@ #include "td/utils/buffer.h" #include "td/utils/common.h" +#include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashSet.h" #include "td/utils/WaitFreeHashMap.h"