From c2999d8557bb06793d41fdb608435a9b952994a4 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 13 Jul 2023 19:32:54 +0300 Subject: [PATCH] Minor improvements. --- td/generate/scheme/td_api.tl | 2 +- td/telegram/ContactsManager.h | 1 - td/telegram/EmojiStatus.cpp | 2 -- td/telegram/StoryContent.cpp | 1 + td/telegram/StoryDb.cpp | 14 +------------- td/telegram/StoryDb.h | 1 - td/telegram/StoryManager.cpp | 9 ++++++--- td/telegram/StoryManager.h | 2 ++ 8 files changed, 11 insertions(+), 21 deletions(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index 3a954ec96..488fff202 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -4960,7 +4960,7 @@ stories total_count:int32 stories:vector = Stories; //@description Contains basic information about a story //@story_id Unique story identifier among stories of the given sender //@date Point in time (Unix timestamp) when the story was published -//@is_for_close_friends True, if the story is available only for close friends +//@is_for_close_friends True, if the story is available only to close friends storyInfo story_id:int32 date:int32 is_for_close_friends:Bool = StoryInfo; //@description Describes active stories posted by a chat diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 9f171f3df..a0ddd8499 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -13,7 +13,6 @@ #include "td/telegram/ChannelType.h" #include "td/telegram/ChatId.h" #include "td/telegram/Contact.h" -#include "td/telegram/CustomEmojiId.h" #include "td/telegram/DialogAdministrator.h" #include "td/telegram/DialogId.h" #include "td/telegram/DialogInviteLink.h" diff --git a/td/telegram/EmojiStatus.cpp b/td/telegram/EmojiStatus.cpp index da5a900d4..db202c224 100644 --- a/td/telegram/EmojiStatus.cpp +++ b/td/telegram/EmojiStatus.cpp @@ -18,8 +18,6 @@ #include "td/utils/logging.h" #include "td/utils/Status.h" -#include - namespace td { struct EmojiStatuses { diff --git a/td/telegram/StoryContent.cpp b/td/telegram/StoryContent.cpp index 6da05a353..f95db21f3 100644 --- a/td/telegram/StoryContent.cpp +++ b/td/telegram/StoryContent.cpp @@ -23,6 +23,7 @@ #include "td/utils/common.h" #include "td/utils/logging.h" +#include "td/utils/tl_helpers.h" #include diff --git a/td/telegram/StoryDb.cpp b/td/telegram/StoryDb.cpp index 661ef7f3d..18705b888 100644 --- a/td/telegram/StoryDb.cpp +++ b/td/telegram/StoryDb.cpp @@ -6,8 +6,7 @@ // #include "td/telegram/StoryDb.h" -#include "td/telegram/logevent/LogEvent.h" -#include "td/telegram/UserId.h" +#include "td/telegram/StoryId.h" #include "td/telegram/Version.h" #include "td/db/SqliteConnectionSafe.h" @@ -20,20 +19,9 @@ #include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/ScopeGuard.h" -#include "td/utils/Slice.h" -#include "td/utils/SliceBuilder.h" -#include "td/utils/StackAllocator.h" #include "td/utils/StringBuilder.h" #include "td/utils/Time.h" -#include "td/utils/tl_helpers.h" -#include "td/utils/unicode.h" -#include "td/utils/utf8.h" -#include -#include -#include -#include -#include #include namespace td { diff --git a/td/telegram/StoryDb.h b/td/telegram/StoryDb.h index 67e81b8af..b3d8566b0 100644 --- a/td/telegram/StoryDb.h +++ b/td/telegram/StoryDb.h @@ -17,7 +17,6 @@ #include "td/utils/Status.h" #include -#include namespace td { diff --git a/td/telegram/StoryManager.cpp b/td/telegram/StoryManager.cpp index 24ab9ed98..213f5bb8e 100644 --- a/td/telegram/StoryManager.cpp +++ b/td/telegram/StoryManager.cpp @@ -18,10 +18,12 @@ #include "td/telegram/logevent/LogEventHelper.h" #include "td/telegram/MessageEntity.h" #include "td/telegram/MessagesManager.h" +#include "td/telegram/NotificationId.h" #include "td/telegram/NotificationManager.h" #include "td/telegram/OptionManager.h" #include "td/telegram/ReportReason.h" #include "td/telegram/StoryContent.h" +#include "td/telegram/StoryContentType.h" #include "td/telegram/StoryDb.h" #include "td/telegram/StoryInteractionInfo.hpp" #include "td/telegram/Td.h" @@ -36,6 +38,7 @@ #include "td/utils/algorithm.h" #include "td/utils/buffer.h" +#include "td/utils/format.h" #include "td/utils/logging.h" #include "td/utils/misc.h" #include "td/utils/Random.h" @@ -142,7 +145,7 @@ class GetAllReadUserStoriesQuery final : public Td::ResultHandler { } void on_error(Status status) final { - LOG(INFO) << "Failed to get all read user stories: " << status; + LOG(INFO) << "Receive error for GetAllReadUserStoriesQuery: " << status; } }; @@ -1123,7 +1126,7 @@ StoryManager::Story *StoryManager::on_get_story_from_database(StoryFullId story_ register_story_global_id(story_full_id, result); CHECK(!is_inaccessible_story(story_full_id)); - CHECK(being_edited_stories_.find(story_full_id) == being_edited_stories_.end()); + CHECK(being_edited_stories_.count(story_full_id) == 0); on_story_changed(story_full_id, result, true, false, true); @@ -1370,7 +1373,7 @@ void StoryManager::toggle_dialog_stories_hidden(DialogId dialog_id, StoryListId return promise.set_value(Unit()); } if (!story_list_id.is_valid()) { - return promise.set_error(Status::Error(400, "Story list must not be empty")); + return promise.set_error(Status::Error(400, "Story list must be non-empty")); } td_->create_handler(std::move(promise)) diff --git a/td/telegram/StoryManager.h b/td/telegram/StoryManager.h index 5e4ea8086..d970642eb 100644 --- a/td/telegram/StoryManager.h +++ b/td/telegram/StoryManager.h @@ -19,12 +19,14 @@ #include "td/telegram/StoryListId.h" #include "td/telegram/td_api.h" #include "td/telegram/telegram_api.h" +#include "td/telegram/UserId.h" #include "td/telegram/UserPrivacySettingRule.h" #include "td/actor/actor.h" #include "td/actor/MultiTimeout.h" #include "td/actor/Timeout.h" +#include "td/utils/buffer.h" #include "td/utils/common.h" #include "td/utils/FlatHashMap.h" #include "td/utils/FlatHashSet.h"