2023-04-10 15:32:59 +02:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2023-04-10 15:32:59 +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/BackgroundId.h"
|
|
|
|
#include "td/telegram/BackgroundType.h"
|
2023-04-19 09:38:55 +02:00
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
2023-04-10 15:32:59 +02:00
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class BackgroundInfo {
|
|
|
|
BackgroundId background_id_;
|
|
|
|
BackgroundType background_type_;
|
|
|
|
|
|
|
|
friend StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundInfo &background_info);
|
|
|
|
|
|
|
|
public:
|
|
|
|
BackgroundInfo() : background_id_(), background_type_() {
|
|
|
|
}
|
|
|
|
|
2024-02-13 14:56:07 +01:00
|
|
|
BackgroundInfo(Td *td, telegram_api::object_ptr<telegram_api::WallPaper> &&wallpaper_ptr, bool allow_empty);
|
2023-04-10 15:32:59 +02:00
|
|
|
|
|
|
|
td_api::object_ptr<td_api::background> get_background_object(const Td *td) const;
|
|
|
|
|
2023-04-10 17:45:26 +02:00
|
|
|
td_api::object_ptr<td_api::chatBackground> get_chat_background_object(const Td *td) const;
|
|
|
|
|
2023-04-10 15:32:59 +02:00
|
|
|
bool is_valid() const {
|
|
|
|
return background_id_.is_valid();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const BackgroundInfo &other) const {
|
|
|
|
return background_id_ == other.background_id_ && background_type_ == other.background_type_;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const BackgroundInfo &other) const {
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
|
|
|
};
|
|
|
|
|
|
|
|
inline StringBuilder &operator<<(StringBuilder &string_builder, const BackgroundInfo &background_info) {
|
2024-03-19 15:51:24 +01:00
|
|
|
return string_builder << background_info.background_id_ << " with " << background_info.background_type_;
|
2023-04-10 15:32:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace td
|