2023-02-23 13:15:10 +01:00
|
|
|
//
|
2024-01-01 01:07:21 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
|
2023-02-23 13:15:10 +01: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/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
#include "td/telegram/UserId.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
2024-04-02 02:52:34 +02:00
|
|
|
class UserManager;
|
2023-02-23 13:15:10 +01:00
|
|
|
|
|
|
|
class MessageViewer {
|
|
|
|
UserId user_id_;
|
|
|
|
int32 date_ = 0;
|
|
|
|
|
|
|
|
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageViewer &viewer);
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MessageViewer(telegram_api::object_ptr<telegram_api::readParticipantDate> &&read_date);
|
|
|
|
|
2023-06-18 22:25:50 +02:00
|
|
|
MessageViewer(UserId user_id, int32 date) : user_id_(user_id), date_(td::max(date, static_cast<int32>(0))) {
|
|
|
|
}
|
|
|
|
|
2023-02-23 13:15:10 +01:00
|
|
|
UserId get_user_id() const {
|
|
|
|
return user_id_;
|
|
|
|
}
|
|
|
|
|
2023-06-20 13:48:51 +02:00
|
|
|
bool is_empty() const {
|
|
|
|
return user_id_ == UserId() && date_ == 0;
|
|
|
|
}
|
|
|
|
|
2024-04-02 02:52:34 +02:00
|
|
|
td_api::object_ptr<td_api::messageViewer> get_message_viewer_object(UserManager *user_manager) const;
|
2023-02-23 13:15:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const MessageViewer &viewer);
|
|
|
|
|
2023-06-28 20:35:59 +02:00
|
|
|
class MessageViewers {
|
2023-02-23 13:15:10 +01:00
|
|
|
vector<MessageViewer> message_viewers_;
|
|
|
|
|
2023-06-28 20:35:59 +02:00
|
|
|
friend StringBuilder &operator<<(StringBuilder &string_builder, const MessageViewers &viewers);
|
|
|
|
|
|
|
|
public:
|
2023-06-20 14:54:47 +02:00
|
|
|
MessageViewers() = default;
|
|
|
|
|
2023-02-23 13:15:10 +01:00
|
|
|
explicit MessageViewers(vector<telegram_api::object_ptr<telegram_api::readParticipantDate>> &&read_dates);
|
|
|
|
|
2023-06-20 15:12:12 +02:00
|
|
|
vector<UserId> get_user_ids() const;
|
|
|
|
|
2024-04-02 02:52:34 +02:00
|
|
|
td_api::object_ptr<td_api::messageViewers> get_message_viewers_object(UserManager *user_manager) const;
|
2023-02-23 13:15:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const MessageViewers &viewers);
|
|
|
|
|
|
|
|
} // namespace td
|