2023-08-06 01:32:09 +02:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2023-08-06 01:32:09 +02:00
|
|
|
//
|
|
|
|
// 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();
|
2024-04-22 02:19:40 +02:00
|
|
|
bool has_reactions_limit = reactions_limit_ != 0;
|
2023-08-06 01:32:09 +02:00
|
|
|
BEGIN_STORE_FLAGS();
|
2023-11-19 00:03:19 +01:00
|
|
|
STORE_FLAG(allow_all_regular_);
|
|
|
|
STORE_FLAG(allow_all_custom_);
|
2023-08-06 01:32:09 +02:00
|
|
|
STORE_FLAG(has_reactions);
|
2024-04-22 02:19:40 +02:00
|
|
|
STORE_FLAG(has_reactions_limit);
|
2023-08-06 01:32:09 +02:00
|
|
|
END_STORE_FLAGS();
|
|
|
|
if (has_reactions) {
|
|
|
|
td::store(reaction_types_, storer);
|
|
|
|
}
|
2024-04-22 02:19:40 +02:00
|
|
|
if (has_reactions_limit) {
|
|
|
|
td::store(reactions_limit_, storer);
|
|
|
|
}
|
2023-08-06 01:32:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void ChatReactions::parse(ParserT &parser) {
|
|
|
|
bool has_reactions;
|
2024-04-22 02:19:40 +02:00
|
|
|
bool has_reactions_limit;
|
2023-08-06 01:32:09 +02:00
|
|
|
BEGIN_PARSE_FLAGS();
|
2023-11-19 00:03:19 +01:00
|
|
|
PARSE_FLAG(allow_all_regular_);
|
|
|
|
PARSE_FLAG(allow_all_custom_);
|
2023-08-06 01:32:09 +02:00
|
|
|
PARSE_FLAG(has_reactions);
|
2024-04-22 02:19:40 +02:00
|
|
|
PARSE_FLAG(has_reactions_limit);
|
2023-08-06 01:32:09 +02:00
|
|
|
END_PARSE_FLAGS();
|
|
|
|
if (has_reactions) {
|
|
|
|
td::parse(reaction_types_, parser);
|
|
|
|
}
|
2024-04-22 02:19:40 +02:00
|
|
|
if (has_reactions_limit) {
|
|
|
|
td::parse(reactions_limit_, parser);
|
|
|
|
}
|
2023-08-06 01:32:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|