2024-01-13 10:06:31 +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/DialogId.h"
|
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/HashTableUtils.h"
|
2024-01-15 21:25:51 +01:00
|
|
|
#include "td/utils/Status.h"
|
2024-01-13 10:06:31 +01:00
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Dependencies;
|
|
|
|
class MessageForwardInfo;
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class SavedMessagesTopicId {
|
|
|
|
DialogId dialog_id_;
|
|
|
|
|
|
|
|
friend struct SavedMessagesTopicIdHash;
|
|
|
|
|
2024-01-15 17:43:03 +01:00
|
|
|
friend bool operator==(const SavedMessagesTopicId &lhs, const SavedMessagesTopicId &rhs);
|
|
|
|
|
2024-01-13 10:06:31 +01:00
|
|
|
friend StringBuilder &operator<<(StringBuilder &string_builder, SavedMessagesTopicId saved_messages_topic_id);
|
|
|
|
|
2024-01-15 21:25:51 +01:00
|
|
|
bool have_input_peer(Td *td) const;
|
|
|
|
|
2024-01-13 10:06:31 +01:00
|
|
|
public:
|
|
|
|
SavedMessagesTopicId() = default;
|
|
|
|
|
|
|
|
explicit SavedMessagesTopicId(DialogId dialog_id) : dialog_id_(dialog_id) {
|
|
|
|
}
|
|
|
|
|
|
|
|
SavedMessagesTopicId(DialogId my_dialog_id, const MessageForwardInfo *message_forward_info);
|
|
|
|
|
2024-01-15 17:43:03 +01:00
|
|
|
SavedMessagesTopicId(const Td *td, const td_api::object_ptr<td_api::SavedMessagesTopic> &saved_messages_topic);
|
|
|
|
|
2024-01-13 10:06:31 +01:00
|
|
|
bool is_valid() const {
|
|
|
|
return dialog_id_.is_valid();
|
|
|
|
}
|
|
|
|
|
2024-01-18 15:38:15 +01:00
|
|
|
Status is_valid_status(Td *td) const;
|
|
|
|
|
2024-01-15 21:25:51 +01:00
|
|
|
Status is_valid_in(Td *td, DialogId dialog_id) const;
|
2024-01-13 10:06:31 +01:00
|
|
|
|
2024-01-15 21:25:51 +01:00
|
|
|
td_api::object_ptr<td_api::SavedMessagesTopic> get_saved_messages_topic_object(Td *td) const;
|
2024-01-13 10:06:31 +01:00
|
|
|
|
2024-01-15 17:43:03 +01:00
|
|
|
telegram_api::object_ptr<telegram_api::InputPeer> get_input_peer(const Td *td) const;
|
2024-01-13 10:06:31 +01:00
|
|
|
|
2024-01-18 17:22:31 +01:00
|
|
|
telegram_api::object_ptr<telegram_api::InputDialogPeer> get_input_dialog_peer(const Td *td) const;
|
|
|
|
|
2024-01-15 17:43:03 +01:00
|
|
|
void add_dependencies(Dependencies &dependencies) const;
|
2024-01-13 10:06:31 +01:00
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const {
|
|
|
|
dialog_id_.store(storer);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser) {
|
|
|
|
dialog_id_.parse(parser);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SavedMessagesTopicIdHash {
|
|
|
|
uint32 operator()(SavedMessagesTopicId saved_messages_topic_id) const {
|
|
|
|
return Hash<DialogId>()(saved_messages_topic_id.dialog_id_);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-01-15 17:43:03 +01:00
|
|
|
inline bool operator==(const SavedMessagesTopicId &lhs, const SavedMessagesTopicId &rhs) {
|
|
|
|
return lhs.dialog_id_ == rhs.dialog_id_;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool operator!=(const SavedMessagesTopicId &lhs, const SavedMessagesTopicId &rhs) {
|
|
|
|
return !(lhs == rhs);
|
|
|
|
}
|
|
|
|
|
2024-01-13 10:06:31 +01:00
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, SavedMessagesTopicId saved_messages_topic_id);
|
|
|
|
|
|
|
|
} // namespace td
|