Add ChatReactions.hpp.

This commit is contained in:
levlam 2023-08-06 02:32:09 +03:00
parent 3fa863e98e
commit 39103e07db
6 changed files with 49 additions and 23 deletions

View File

@ -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

View File

@ -7,6 +7,7 @@
#include "td/telegram/ChatReactions.h"
#include "td/utils/algorithm.h"
#include "td/utils/format.h"
namespace td {

View File

@ -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 <class StorerT>
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 <class ParserT>
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);

View File

@ -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 <class StorerT>
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 <class ParserT>
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

View File

@ -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"

View File

@ -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"