diff --git a/CMakeLists.txt b/CMakeLists.txt index 482c7fd5f..37bace4ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -808,6 +808,7 @@ set(TDLIB_SOURCE td/telegram/AuthManager.hpp td/telegram/BackgroundInfo.hpp td/telegram/BackgroundType.hpp + td/telegram/ChatReactions.hpp td/telegram/DialogNotificationSettings.hpp td/telegram/DialogFilter.hpp td/telegram/Dimensions.hpp diff --git a/td/telegram/ChatReactions.cpp b/td/telegram/ChatReactions.cpp index ac2c6370e..4b1d8bddc 100644 --- a/td/telegram/ChatReactions.cpp +++ b/td/telegram/ChatReactions.cpp @@ -7,6 +7,7 @@ #include "td/telegram/ChatReactions.h" #include "td/utils/algorithm.h" +#include "td/utils/format.h" namespace td { diff --git a/td/telegram/ChatReactions.h b/td/telegram/ChatReactions.h index cdab23bdf..d169fbb96 100644 --- a/td/telegram/ChatReactions.h +++ b/td/telegram/ChatReactions.h @@ -13,7 +13,6 @@ #include "td/utils/common.h" #include "td/utils/FlatHashMap.h" #include "td/utils/StringBuilder.h" -#include "td/utils/tl_helpers.h" namespace td { @@ -48,30 +47,10 @@ struct ChatReactions { } template - void store(StorerT &storer) const { - bool has_reactions = !reaction_types_.empty(); - BEGIN_STORE_FLAGS(); - STORE_FLAG(allow_all_); - STORE_FLAG(allow_custom_); - STORE_FLAG(has_reactions); - END_STORE_FLAGS(); - if (has_reactions) { - td::store(reaction_types_, storer); - } - } + void store(StorerT &storer) const; template - void parse(ParserT &parser) { - bool has_reactions; - BEGIN_PARSE_FLAGS(); - PARSE_FLAG(allow_all_); - PARSE_FLAG(allow_custom_); - PARSE_FLAG(has_reactions); - END_PARSE_FLAGS(); - if (has_reactions) { - td::parse(reaction_types_, parser); - } - } + void parse(ParserT &parser); }; bool operator==(const ChatReactions &lhs, const ChatReactions &rhs); diff --git a/td/telegram/ChatReactions.hpp b/td/telegram/ChatReactions.hpp new file mode 100644 index 000000000..8bae2e417 --- /dev/null +++ b/td/telegram/ChatReactions.hpp @@ -0,0 +1,43 @@ +// +// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023 +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +#pragma once + +#include "td/telegram/ChatReactions.h" +#include "td/telegram/ReactionType.hpp" + +#include "td/utils/common.h" +#include "td/utils/tl_helpers.h" + +namespace td { + +template +void ChatReactions::store(StorerT &storer) const { + bool has_reactions = !reaction_types_.empty(); + BEGIN_STORE_FLAGS(); + STORE_FLAG(allow_all_); + STORE_FLAG(allow_custom_); + STORE_FLAG(has_reactions); + END_STORE_FLAGS(); + if (has_reactions) { + td::store(reaction_types_, storer); + } +} + +template +void ChatReactions::parse(ParserT &parser) { + bool has_reactions; + BEGIN_PARSE_FLAGS(); + PARSE_FLAG(allow_all_); + PARSE_FLAG(allow_custom_); + PARSE_FLAG(has_reactions); + END_PARSE_FLAGS(); + if (has_reactions) { + td::parse(reaction_types_, parser); + } +} + +} // namespace td diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5518bb2d3..823a2194e 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -12,6 +12,7 @@ #include "td/telegram/ChainId.h" #include "td/telegram/ChannelType.h" #include "td/telegram/ChatId.h" +#include "td/telegram/ChatReactions.hpp" #include "td/telegram/ContactsManager.h" #include "td/telegram/Dependencies.h" #include "td/telegram/DialogActionBar.h" diff --git a/td/telegram/StickersManager.hpp b/td/telegram/StickersManager.hpp index 73f498119..b7d5307d7 100644 --- a/td/telegram/StickersManager.hpp +++ b/td/telegram/StickersManager.hpp @@ -11,6 +11,7 @@ #include "td/telegram/files/FileId.hpp" #include "td/telegram/misc.h" #include "td/telegram/PhotoSize.hpp" +#include "td/telegram/ReactionType.hpp" #include "td/telegram/StickerFormat.h" #include "td/telegram/StickerMaskPosition.hpp" #include "td/telegram/StickersManager.h"