From c95cb5d75c00247931d2c3871a9149ab08b6388b Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 25 Jan 2024 20:06:07 +0300 Subject: [PATCH] Minor imrovements. --- td/generate/scheme/td_api.tl | 8 ++++---- td/telegram/BoostManager.cpp | 1 + td/telegram/CountryInfoManager.cpp | 1 + td/telegram/GlobalPrivacySettings.cpp | 1 + td/telegram/MessageForwardInfo.cpp | 2 ++ td/telegram/MessageForwardInfo.hpp | 2 -- td/telegram/MessagesManager.cpp | 4 ++-- td/telegram/OptionManager.cpp | 1 + td/telegram/ReactionManager.cpp | 7 +++++-- td/telegram/ReactionManager.h | 1 + td/telegram/SavedMessagesTopicId.cpp | 1 + td/telegram/SavedMessagesTopicId.h | 1 + td/telegram/Td.cpp | 2 +- tddb/td/db/BinlogKeyValue.h | 1 + tdutils/td/utils/Promise.h | 2 +- 15 files changed, 23 insertions(+), 12 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index ba1f961fc..2bab566cf 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -1222,7 +1222,7 @@ reactionTypeCustomEmoji custom_emoji_id:int64 = ReactionType; //@description Contains information about a forwarded message //@origin Origin of the forwarded message //@date Point in time (Unix timestamp) when the message was originally sent -//@source For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message, from which the message was forwarded last time; may be null for other forwards or if unknown +//@source For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown //@public_service_announcement_type The type of a public service announcement for the forwarded message messageForwardInfo origin:MessageOrigin date:int32 source:forwardSource public_service_announcement_type:string = MessageForwardInfo; @@ -1247,7 +1247,7 @@ messageReplyInfo reply_count:int32 recent_replier_ids:vector last //@recent_sender_ids Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats messageReaction type:ReactionType total_count:int32 is_chosen:Bool used_sender_id:MessageSender recent_sender_ids:vector = MessageReaction; -//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false +//@description Contains a list of reactions added to a message @reactions List of added reactions @are_tags True, if the reactions are tags and Telegram Premium users can filter messages by them; currently, always false messageReactions reactions:vector are_tags:Bool = MessageReactions; @@ -4045,7 +4045,7 @@ availableReaction type:ReactionType needs_premium:Bool = AvailableReaction; //@popular_reactions List of popular reactions //@allow_custom_emoji True, if any custom emoji reaction can be added by Telegram Premium subscribers //@are_tags True, if the reactions will be tags and the message can be found by them; currently, always false -//@unavailability_reason The reason why the current user can't add reactions to the message, despite some other users can; null if none +//@unavailability_reason The reason why the current user can't add reactions to the message, despite some other users can; may be null if none availableReactions top_reactions:vector recent_reactions:vector popular_reactions:vector allow_custom_emoji:Bool are_tags:Bool unavailability_reason:ReactionUnavailabilityReason = AvailableReactions; //@description Contains information about an emoji reaction @@ -6730,7 +6730,7 @@ updateActiveEmojiReactions emojis:vector = Update; //@description The type of default reaction has changed @reaction_type The new type of the default reaction updateDefaultReactionType reaction_type:ReactionType = Update; -//@description Used Saved Messages tags has changed @tags The new used tags +//@description Used Saved Messages tags have changed @tags The new used tags updateSavedMessagesTags tags:savedMessagesTags = Update; //@description The parameters of speech recognition without Telegram Premium subscription has changed diff --git a/td/telegram/BoostManager.cpp b/td/telegram/BoostManager.cpp index 89960010c..836aead9b 100644 --- a/td/telegram/BoostManager.cpp +++ b/td/telegram/BoostManager.cpp @@ -24,6 +24,7 @@ #include "td/utils/buffer.h" #include "td/utils/logging.h" #include "td/utils/misc.h" +#include "td/utils/SliceBuilder.h" namespace td { diff --git a/td/telegram/CountryInfoManager.cpp b/td/telegram/CountryInfoManager.cpp index e68480f06..06cacb7d8 100644 --- a/td/telegram/CountryInfoManager.cpp +++ b/td/telegram/CountryInfoManager.cpp @@ -23,6 +23,7 @@ #include "td/utils/Random.h" #include "td/utils/Time.h" #include "td/utils/tl_parsers.h" +#include "td/utils/utf8.h" namespace td { diff --git a/td/telegram/GlobalPrivacySettings.cpp b/td/telegram/GlobalPrivacySettings.cpp index b6001b577..70ae812aa 100644 --- a/td/telegram/GlobalPrivacySettings.cpp +++ b/td/telegram/GlobalPrivacySettings.cpp @@ -16,6 +16,7 @@ #include "td/actor/actor.h" #include "td/utils/buffer.h" +#include "td/utils/logging.h" #include "td/utils/Status.h" namespace td { diff --git a/td/telegram/MessageForwardInfo.cpp b/td/telegram/MessageForwardInfo.cpp index 07a2241d9..9c36cd1f3 100644 --- a/td/telegram/MessageForwardInfo.cpp +++ b/td/telegram/MessageForwardInfo.cpp @@ -11,9 +11,11 @@ #include "td/telegram/DialogManager.h" #include "td/telegram/MessageSender.h" #include "td/telegram/MessagesManager.h" +#include "td/telegram/ServerMessageId.h" #include "td/telegram/Td.h" #include "td/utils/logging.h" +#include "td/utils/misc.h" namespace td { diff --git a/td/telegram/MessageForwardInfo.hpp b/td/telegram/MessageForwardInfo.hpp index c077e4085..9a2ad859b 100644 --- a/td/telegram/MessageForwardInfo.hpp +++ b/td/telegram/MessageForwardInfo.hpp @@ -6,9 +6,7 @@ // #pragma once -#include "td/telegram/DialogId.h" #include "td/telegram/MessageForwardInfo.h" -#include "td/telegram/MessageId.h" #include "td/telegram/MessageOrigin.hpp" #include "td/utils/common.h" diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index eb7930779..2bfc07cfc 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -207,7 +207,7 @@ class GetPinnedSavedDialogsQuery final : public Td::ResultHandler { } auto result = result_ptr.move_as_ok(); - LOG(INFO) << "Receive pinned Saved Messages topics: " << to_string(result); + LOG(INFO) << "Receive result for GetPinnedSavedDialogsQuery: " << to_string(result); td_->messages_manager_->on_get_saved_messages_topics(std::move(result), std::move(promise_)); } @@ -241,7 +241,7 @@ class GetSavedDialogsQuery final : public Td::ResultHandler { } auto result = result_ptr.move_as_ok(); - LOG(INFO) << "Receive Saved Messages topics: " << to_string(result); + LOG(INFO) << "Receive result for GetSavedDialogsQuery: " << to_string(result); td_->messages_manager_->on_get_saved_messages_topics(std::move(result), std::move(promise_)); } diff --git a/td/telegram/OptionManager.cpp b/td/telegram/OptionManager.cpp index 768089495..9ce152707 100644 --- a/td/telegram/OptionManager.cpp +++ b/td/telegram/OptionManager.cpp @@ -38,6 +38,7 @@ #include "td/actor/actor.h" #include "td/utils/algorithm.h" +#include "td/utils/FlatHashSet.h" #include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/port/Clocks.h" diff --git a/td/telegram/ReactionManager.cpp b/td/telegram/ReactionManager.cpp index 2d38e326a..a3e3aa659 100644 --- a/td/telegram/ReactionManager.cpp +++ b/td/telegram/ReactionManager.cpp @@ -29,7 +29,7 @@ #include "td/utils/Status.h" #include -#include +#include namespace td { @@ -594,8 +594,11 @@ void ReactionManager::reload_reactions() { } void ReactionManager::reload_reaction_list(ReactionListType reaction_list_type) { + if (G()->close_flag()) { + return; + } auto &reaction_list = get_reaction_list(reaction_list_type); - if (G()->close_flag() || reaction_list.is_being_reloaded_) { + if (reaction_list.is_being_reloaded_) { return; } CHECK(!td_->auth_manager_->is_bot()); diff --git a/td/telegram/ReactionManager.h b/td/telegram/ReactionManager.h index 4078199c2..d5aea4ffc 100644 --- a/td/telegram/ReactionManager.h +++ b/td/telegram/ReactionManager.h @@ -18,6 +18,7 @@ #include "td/utils/common.h" #include "td/utils/Promise.h" +#include "td/utils/Status.h" #include "td/utils/StringBuilder.h" #include diff --git a/td/telegram/SavedMessagesTopicId.cpp b/td/telegram/SavedMessagesTopicId.cpp index cb9c7d7ea..5be5e1d64 100644 --- a/td/telegram/SavedMessagesTopicId.cpp +++ b/td/telegram/SavedMessagesTopicId.cpp @@ -12,6 +12,7 @@ #include "td/telegram/MessageForwardInfo.h" #include "td/telegram/MessagesManager.h" #include "td/telegram/Td.h" +#include "td/telegram/telegram_api.h" namespace td { diff --git a/td/telegram/SavedMessagesTopicId.h b/td/telegram/SavedMessagesTopicId.h index fbe41d361..1739441e1 100644 --- a/td/telegram/SavedMessagesTopicId.h +++ b/td/telegram/SavedMessagesTopicId.h @@ -8,6 +8,7 @@ #include "td/telegram/DialogId.h" #include "td/telegram/td_api.h" +#include "td/telegram/telegram_api.h" #include "td/utils/common.h" #include "td/utils/HashTableUtils.h" diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index eebbd9180..acd0fbbc1 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -5084,7 +5084,7 @@ void Td::on_request(uint64 id, const td_api::setPinnedSavedMessagesTopics &reque CHECK_IS_USER(); CREATE_OK_REQUEST_PROMISE(); auto saved_messages_topic_ids = transform(request.saved_messages_topics_, - [td = this](const auto &topic) { return SavedMessagesTopicId(td, topic); }); + [this](const auto &topic) { return SavedMessagesTopicId(this, topic); }); messages_manager_->set_pinned_saved_messages_topics(std::move(saved_messages_topic_ids), std::move(promise)); } diff --git a/tddb/td/db/BinlogKeyValue.h b/tddb/td/db/BinlogKeyValue.h index 735e120d0..20f802df4 100644 --- a/tddb/td/db/BinlogKeyValue.h +++ b/tddb/td/db/BinlogKeyValue.h @@ -26,6 +26,7 @@ #include "td/utils/tl_parsers.h" #include "td/utils/tl_storers.h" +#include #include #include #include diff --git a/tdutils/td/utils/Promise.h b/tdutils/td/utils/Promise.h index 9edf92d8e..183797e88 100644 --- a/tdutils/td/utils/Promise.h +++ b/tdutils/td/utils/Promise.h @@ -116,7 +116,7 @@ class LambdaPromise : public PromiseInterface { } template - explicit LambdaPromise(const char *file, int line, FromT &&func) + LambdaPromise(const char *file, int line, FromT &&func) : func_(std::forward(func)), state_(State::Ready), file_(file), line_(line) { }