2022-10-17 19:07:06 +02:00
|
|
|
//
|
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
|
|
|
|
//
|
|
|
|
// 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/DialogId.h"
|
2022-10-27 18:03:58 +02:00
|
|
|
#include "td/telegram/ForumTopicEditedData.h"
|
2022-10-18 14:04:52 +02:00
|
|
|
#include "td/telegram/ForumTopicIcon.h"
|
2022-10-17 19:07:06 +02:00
|
|
|
#include "td/telegram/MessageId.h"
|
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class ForumTopicInfo {
|
|
|
|
MessageId top_thread_message_id_;
|
|
|
|
string title_;
|
2022-10-18 14:04:52 +02:00
|
|
|
ForumTopicIcon icon_;
|
2022-10-17 19:07:06 +02:00
|
|
|
int32 creation_date_ = 0;
|
|
|
|
DialogId creator_dialog_id_;
|
|
|
|
bool is_outgoing_ = false;
|
|
|
|
bool is_closed_ = false;
|
2022-11-30 13:47:55 +01:00
|
|
|
bool is_hidden_ = false;
|
2022-10-17 19:07:06 +02:00
|
|
|
|
2022-11-15 14:00:19 +01:00
|
|
|
friend bool operator==(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs);
|
|
|
|
friend bool operator!=(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs);
|
|
|
|
|
2022-10-17 19:07:06 +02:00
|
|
|
friend StringBuilder &operator<<(StringBuilder &string_builder, const ForumTopicInfo &topic_info);
|
|
|
|
|
|
|
|
public:
|
|
|
|
ForumTopicInfo() = default;
|
|
|
|
|
2022-10-20 12:28:07 +02:00
|
|
|
explicit ForumTopicInfo(const tl_object_ptr<telegram_api::ForumTopic> &forum_topic_ptr);
|
2022-10-17 19:07:06 +02:00
|
|
|
|
2022-10-25 15:10:15 +02:00
|
|
|
ForumTopicInfo(MessageId top_thread_message_id, string title, ForumTopicIcon icon, int32 creation_date,
|
2022-11-30 13:47:55 +01:00
|
|
|
DialogId creator_dialog_id, bool is_outgoing, bool is_closed, bool is_hidden)
|
2022-10-25 15:10:15 +02:00
|
|
|
: top_thread_message_id_(top_thread_message_id)
|
|
|
|
, title_(std::move(title))
|
|
|
|
, icon_(std::move(icon))
|
|
|
|
, creation_date_(creation_date)
|
|
|
|
, creator_dialog_id_(creator_dialog_id)
|
|
|
|
, is_outgoing_(is_outgoing)
|
2022-11-30 13:47:55 +01:00
|
|
|
, is_closed_(is_closed)
|
|
|
|
, is_hidden_(is_hidden) {
|
2022-10-25 15:10:15 +02:00
|
|
|
}
|
|
|
|
|
2022-10-17 19:07:06 +02:00
|
|
|
bool is_empty() const {
|
|
|
|
return !top_thread_message_id_.is_valid();
|
|
|
|
}
|
|
|
|
|
2022-11-02 17:51:41 +01:00
|
|
|
MessageId get_top_thread_message_id() const {
|
2022-10-24 20:10:12 +02:00
|
|
|
return top_thread_message_id_;
|
|
|
|
}
|
|
|
|
|
2022-11-04 15:52:26 +01:00
|
|
|
DialogId get_creator_dialog_id() const {
|
|
|
|
return creator_dialog_id_;
|
|
|
|
}
|
|
|
|
|
2022-10-27 18:18:25 +02:00
|
|
|
bool is_outgoing() const {
|
|
|
|
return is_outgoing_;
|
|
|
|
}
|
|
|
|
|
2022-10-27 18:52:26 +02:00
|
|
|
bool is_closed() const {
|
|
|
|
return is_closed_;
|
|
|
|
}
|
|
|
|
|
2022-11-30 13:47:55 +01:00
|
|
|
bool is_hidden() const {
|
|
|
|
return is_hidden_;
|
|
|
|
}
|
|
|
|
|
2022-10-27 18:03:58 +02:00
|
|
|
bool apply_edited_data(const ForumTopicEditedData &edited_data);
|
|
|
|
|
2022-10-17 19:07:06 +02:00
|
|
|
td_api::object_ptr<td_api::forumTopicInfo> get_forum_topic_info_object(Td *td) const;
|
2022-11-16 15:26:51 +01:00
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
2022-10-17 19:07:06 +02:00
|
|
|
};
|
|
|
|
|
2022-11-15 14:00:19 +01:00
|
|
|
bool operator==(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs);
|
|
|
|
bool operator!=(const ForumTopicInfo &lhs, const ForumTopicInfo &rhs);
|
|
|
|
|
2022-10-17 19:07:06 +02:00
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const ForumTopicInfo &topic_info);
|
|
|
|
|
|
|
|
} // namespace td
|