2023-01-11 14:54:46 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2023-01-11 14:54:46 +01: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/RequestedDialogType.h"
|
|
|
|
|
|
|
|
#include "td/utils/tl_helpers.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void RequestedDialogType::store(StorerT &storer) const {
|
2023-12-22 16:06:40 +01:00
|
|
|
bool has_max_quantity = max_quantity_ != 1;
|
2023-01-11 14:54:46 +01:00
|
|
|
BEGIN_STORE_FLAGS();
|
2023-01-11 17:52:35 +01:00
|
|
|
STORE_FLAG(restrict_is_bot_);
|
|
|
|
STORE_FLAG(is_bot_);
|
|
|
|
STORE_FLAG(restrict_is_premium_);
|
|
|
|
STORE_FLAG(is_premium_);
|
|
|
|
STORE_FLAG(restrict_is_forum_);
|
|
|
|
STORE_FLAG(is_forum_);
|
|
|
|
STORE_FLAG(bot_is_participant_);
|
|
|
|
STORE_FLAG(restrict_has_username_);
|
|
|
|
STORE_FLAG(has_username_);
|
|
|
|
STORE_FLAG(is_created_);
|
|
|
|
STORE_FLAG(restrict_user_administrator_rights_);
|
|
|
|
STORE_FLAG(restrict_bot_administrator_rights_);
|
2023-12-22 16:06:40 +01:00
|
|
|
STORE_FLAG(has_max_quantity);
|
2023-01-11 14:54:46 +01:00
|
|
|
END_STORE_FLAGS();
|
2023-01-11 17:52:35 +01:00
|
|
|
td::store(type_, storer);
|
|
|
|
td::store(button_id_, storer);
|
|
|
|
if (restrict_user_administrator_rights_) {
|
|
|
|
td::store(user_administrator_rights_, storer);
|
|
|
|
}
|
|
|
|
if (restrict_bot_administrator_rights_) {
|
|
|
|
td::store(bot_administrator_rights_, storer);
|
|
|
|
}
|
2023-12-22 16:06:40 +01:00
|
|
|
if (has_max_quantity) {
|
|
|
|
td::store(max_quantity_, storer);
|
|
|
|
}
|
2023-01-11 14:54:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void RequestedDialogType::parse(ParserT &parser) {
|
2023-12-22 16:06:40 +01:00
|
|
|
bool has_max_quantity;
|
2023-01-11 14:54:46 +01:00
|
|
|
BEGIN_PARSE_FLAGS();
|
2023-01-11 17:52:35 +01:00
|
|
|
PARSE_FLAG(restrict_is_bot_);
|
|
|
|
PARSE_FLAG(is_bot_);
|
|
|
|
PARSE_FLAG(restrict_is_premium_);
|
|
|
|
PARSE_FLAG(is_premium_);
|
|
|
|
PARSE_FLAG(restrict_is_forum_);
|
|
|
|
PARSE_FLAG(is_forum_);
|
|
|
|
PARSE_FLAG(bot_is_participant_);
|
|
|
|
PARSE_FLAG(restrict_has_username_);
|
|
|
|
PARSE_FLAG(has_username_);
|
|
|
|
PARSE_FLAG(is_created_);
|
|
|
|
PARSE_FLAG(restrict_user_administrator_rights_);
|
|
|
|
PARSE_FLAG(restrict_bot_administrator_rights_);
|
2023-12-22 16:06:40 +01:00
|
|
|
PARSE_FLAG(has_max_quantity);
|
2023-01-11 14:54:46 +01:00
|
|
|
END_PARSE_FLAGS();
|
2023-01-11 17:52:35 +01:00
|
|
|
td::parse(type_, parser);
|
|
|
|
td::parse(button_id_, parser);
|
|
|
|
if (restrict_user_administrator_rights_) {
|
|
|
|
td::parse(user_administrator_rights_, parser);
|
|
|
|
}
|
|
|
|
if (restrict_bot_administrator_rights_) {
|
|
|
|
td::parse(bot_administrator_rights_, parser);
|
|
|
|
}
|
2023-12-22 16:06:40 +01:00
|
|
|
if (has_max_quantity) {
|
|
|
|
td::parse(max_quantity_, parser);
|
|
|
|
} else {
|
|
|
|
max_quantity_ = 1;
|
|
|
|
}
|
2023-01-11 14:54:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|