2023-10-24 11:04:45 +02:00
|
|
|
//
|
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
|
|
|
//
|
|
|
|
// 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/MessageId.h"
|
|
|
|
#include "td/telegram/MessageOrigin.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class Td;
|
|
|
|
|
|
|
|
class RepliedMessageInfo {
|
2023-10-24 15:34:54 +02:00
|
|
|
MessageId message_id_;
|
|
|
|
DialogId dialog_id_; // DialogId() if reply is to a message in the same chat
|
|
|
|
int32 origin_date_ = 0; // for replies in other chats
|
|
|
|
MessageOrigin origin_; // for replies in other chats
|
2023-10-24 11:04:45 +02:00
|
|
|
|
2023-10-24 13:06:49 +02:00
|
|
|
friend bool operator==(const RepliedMessageInfo &lhs, const RepliedMessageInfo &rhs);
|
|
|
|
|
2023-10-24 14:55:52 +02:00
|
|
|
public:
|
2023-10-24 11:04:45 +02:00
|
|
|
RepliedMessageInfo() = default;
|
|
|
|
|
2023-10-24 15:34:54 +02:00
|
|
|
explicit RepliedMessageInfo(MessageId reply_to_message_id) : message_id_(reply_to_message_id) {
|
2023-10-24 11:04:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
RepliedMessageInfo(Td *td, tl_object_ptr<telegram_api::messageReplyHeader> &&reply_header, DialogId dialog_id,
|
|
|
|
MessageId message_id, int32 date);
|
|
|
|
|
|
|
|
bool is_same_chat_reply() const {
|
2023-10-24 15:34:54 +02:00
|
|
|
return dialog_id_ == DialogId() && origin_date_ == 0;
|
2023-10-24 11:04:45 +02:00
|
|
|
}
|
|
|
|
|
2023-10-24 13:06:49 +02:00
|
|
|
bool is_empty() const {
|
2023-10-24 15:34:54 +02:00
|
|
|
return message_id_ == MessageId() && dialog_id_ == DialogId() && origin_date_ == 0 && origin_.is_empty();
|
2023-10-24 13:06:49 +02:00
|
|
|
}
|
|
|
|
|
2023-10-24 11:04:45 +02:00
|
|
|
MessageId get_same_chat_reply_to_message_id() const;
|
|
|
|
|
2023-10-24 17:54:32 +02:00
|
|
|
MessageFullId get_reply_message_full_id(DialogId owner_dialog_id) const;
|
2023-10-24 13:06:49 +02:00
|
|
|
|
|
|
|
template <class StorerT>
|
|
|
|
void store(StorerT &storer) const;
|
|
|
|
|
|
|
|
template <class ParserT>
|
|
|
|
void parse(ParserT &parser);
|
2023-10-24 11:04:45 +02:00
|
|
|
};
|
|
|
|
|
2023-10-24 13:06:49 +02:00
|
|
|
bool operator==(const RepliedMessageInfo &lhs, const RepliedMessageInfo &rhs);
|
|
|
|
|
|
|
|
bool operator!=(const RepliedMessageInfo &lhs, const RepliedMessageInfo &rhs);
|
|
|
|
|
2023-10-24 11:04:45 +02:00
|
|
|
} // namespace td
|