2024-02-26 21:09:52 +01:00
|
|
|
//
|
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
|
|
|
//
|
|
|
|
// 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/BusinessInfo.h"
|
2024-02-26 23:58:14 +01:00
|
|
|
|
|
|
|
#include "td/telegram/BusinessAwayMessage.hpp"
|
2024-02-27 00:07:21 +01:00
|
|
|
#include "td/telegram/BusinessGreetingMessage.hpp"
|
2024-03-19 12:31:19 +01:00
|
|
|
#include "td/telegram/BusinessIntro.hpp"
|
2024-02-26 21:09:52 +01:00
|
|
|
#include "td/telegram/BusinessWorkHours.hpp"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/tl_helpers.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void BusinessInfo::store(StorerT &storer) const {
|
|
|
|
bool has_location = !is_empty_location(location_);
|
|
|
|
bool has_work_hours = !work_hours_.is_empty();
|
2024-02-26 23:58:14 +01:00
|
|
|
bool has_away_message = away_message_.is_valid();
|
2024-02-27 00:07:21 +01:00
|
|
|
bool has_greeting_message = greeting_message_.is_valid();
|
2024-03-19 12:31:19 +01:00
|
|
|
bool has_intro = !intro_.is_empty();
|
2024-02-26 21:09:52 +01:00
|
|
|
BEGIN_STORE_FLAGS();
|
|
|
|
STORE_FLAG(has_location);
|
|
|
|
STORE_FLAG(has_work_hours);
|
2024-02-26 23:58:14 +01:00
|
|
|
STORE_FLAG(has_away_message);
|
2024-02-27 00:07:21 +01:00
|
|
|
STORE_FLAG(has_greeting_message);
|
2024-03-19 12:31:19 +01:00
|
|
|
STORE_FLAG(has_intro);
|
2024-02-26 21:09:52 +01:00
|
|
|
END_STORE_FLAGS();
|
|
|
|
if (has_location) {
|
|
|
|
td::store(location_, storer);
|
|
|
|
}
|
|
|
|
if (has_work_hours) {
|
|
|
|
td::store(work_hours_, storer);
|
|
|
|
}
|
2024-02-26 23:58:14 +01:00
|
|
|
if (has_away_message) {
|
|
|
|
td::store(away_message_, storer);
|
|
|
|
}
|
2024-02-27 00:07:21 +01:00
|
|
|
if (has_greeting_message) {
|
|
|
|
td::store(greeting_message_, storer);
|
|
|
|
}
|
2024-03-19 12:31:19 +01:00
|
|
|
if (has_intro) {
|
|
|
|
td::store(intro_, storer);
|
|
|
|
}
|
2024-02-26 21:09:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void BusinessInfo::parse(ParserT &parser) {
|
|
|
|
bool has_location;
|
|
|
|
bool has_work_hours;
|
2024-02-26 23:58:14 +01:00
|
|
|
bool has_away_message;
|
2024-02-27 00:07:21 +01:00
|
|
|
bool has_greeting_message;
|
2024-03-19 12:31:19 +01:00
|
|
|
bool has_intro;
|
2024-02-26 21:09:52 +01:00
|
|
|
BEGIN_PARSE_FLAGS();
|
|
|
|
PARSE_FLAG(has_location);
|
|
|
|
PARSE_FLAG(has_work_hours);
|
2024-02-26 23:58:14 +01:00
|
|
|
PARSE_FLAG(has_away_message);
|
2024-02-27 00:07:21 +01:00
|
|
|
PARSE_FLAG(has_greeting_message);
|
2024-03-19 12:31:19 +01:00
|
|
|
PARSE_FLAG(has_intro);
|
2024-02-26 21:09:52 +01:00
|
|
|
END_PARSE_FLAGS();
|
|
|
|
if (has_location) {
|
|
|
|
td::parse(location_, parser);
|
|
|
|
}
|
|
|
|
if (has_work_hours) {
|
|
|
|
td::parse(work_hours_, parser);
|
|
|
|
}
|
2024-02-26 23:58:14 +01:00
|
|
|
if (has_away_message) {
|
|
|
|
td::parse(away_message_, parser);
|
|
|
|
}
|
2024-02-27 00:07:21 +01:00
|
|
|
if (has_greeting_message) {
|
|
|
|
td::parse(greeting_message_, parser);
|
|
|
|
}
|
2024-03-19 12:31:19 +01:00
|
|
|
if (has_intro) {
|
|
|
|
td::parse(intro_, parser);
|
|
|
|
}
|
2024-02-26 21:09:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|