Add MessageReplyInfo::get_message_reply_info_object.
GitOrigin-RevId: 8d46914fd096afca99942bec63f2c6f65f9cbb9e
This commit is contained in:
parent
6f71dca6e6
commit
e5e9eb3838
@ -6,6 +6,7 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/MessageReplyInfo.h"
|
#include "td/telegram/MessageReplyInfo.h"
|
||||||
|
|
||||||
|
#include "td/telegram/ContactsManager.h"
|
||||||
#include "td/telegram/ServerMessageId.h"
|
#include "td/telegram/ServerMessageId.h"
|
||||||
|
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
@ -123,6 +124,23 @@ void MessageReplyInfo::add_reply(DialogId replier_dialog_id, MessageId reply_mes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::messageReplyInfo> MessageReplyInfo::get_message_reply_info_object(
|
||||||
|
ContactsManager *contacts_manager) const {
|
||||||
|
if (is_empty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
vector<UserId> recent_replier_user_ids;
|
||||||
|
for (auto recent_replier_dialog_id : recent_replier_dialog_ids) {
|
||||||
|
if (recent_replier_dialog_id.get_type() == DialogType::User) {
|
||||||
|
recent_replier_user_ids.push_back(recent_replier_dialog_id.get_user_id());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return td_api::make_object<td_api::messageReplyInfo>(
|
||||||
|
reply_count, contacts_manager->get_user_ids_object(recent_replier_user_ids, "get_message_reply_info_object"),
|
||||||
|
last_read_inbox_message_id.get(), last_read_outbox_message_id.get(), max_message_id.get());
|
||||||
|
}
|
||||||
|
|
||||||
StringBuilder &operator<<(StringBuilder &string_builder, const MessageReplyInfo &reply_info) {
|
StringBuilder &operator<<(StringBuilder &string_builder, const MessageReplyInfo &reply_info) {
|
||||||
if (reply_info.is_comment) {
|
if (reply_info.is_comment) {
|
||||||
return string_builder << reply_info.reply_count << " comments in " << reply_info.channel_id << " by "
|
return string_builder << reply_info.reply_count << " comments in " << reply_info.channel_id << " by "
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "td/telegram/ChannelId.h"
|
#include "td/telegram/ChannelId.h"
|
||||||
#include "td/telegram/DialogId.h"
|
#include "td/telegram/DialogId.h"
|
||||||
#include "td/telegram/MessageId.h"
|
#include "td/telegram/MessageId.h"
|
||||||
|
#include "Td/telegram/td_api.h"
|
||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
@ -17,6 +18,8 @@
|
|||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
class ContactsManager;
|
||||||
|
|
||||||
struct MessageReplyInfo {
|
struct MessageReplyInfo {
|
||||||
int32 reply_count = -1;
|
int32 reply_count = -1;
|
||||||
int32 pts = -1;
|
int32 pts = -1;
|
||||||
@ -44,6 +47,8 @@ struct MessageReplyInfo {
|
|||||||
|
|
||||||
void add_reply(DialogId replier_dialog_id, MessageId reply_message_id);
|
void add_reply(DialogId replier_dialog_id, MessageId reply_message_id);
|
||||||
|
|
||||||
|
td_api::object_ptr<td_api::messageReplyInfo> get_message_reply_info_object(ContactsManager *contacts_manager) const;
|
||||||
|
|
||||||
template <class StorerT>
|
template <class StorerT>
|
||||||
void store(StorerT &storer) const {
|
void store(StorerT &storer) const {
|
||||||
CHECK(!is_empty());
|
CHECK(!is_empty());
|
||||||
|
@ -6560,18 +6560,8 @@ td_api::object_ptr<td_api::messageInteractionInfo> MessagesManager::get_message_
|
|||||||
|
|
||||||
td_api::object_ptr<td_api::messageReplyInfo> reply_info;
|
td_api::object_ptr<td_api::messageReplyInfo> reply_info;
|
||||||
if (is_visible_reply_info) {
|
if (is_visible_reply_info) {
|
||||||
vector<UserId> recent_replier_user_ids;
|
reply_info = m->reply_info.get_message_reply_info_object(td_->contacts_manager_.get());
|
||||||
for (auto recent_replier_dialog_id : m->reply_info.recent_replier_dialog_ids) {
|
CHECK(reply_info != nullptr);
|
||||||
if (recent_replier_dialog_id.get_type() == DialogType::User) {
|
|
||||||
recent_replier_user_ids.push_back(recent_replier_dialog_id.get_user_id());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reply_info = td_api::make_object<td_api::messageReplyInfo>(
|
|
||||||
m->reply_info.reply_count,
|
|
||||||
td_->contacts_manager_->get_user_ids_object(recent_replier_user_ids, "get_message_interaction_info_object"),
|
|
||||||
m->reply_info.last_read_inbox_message_id.get(), m->reply_info.last_read_outbox_message_id.get(),
|
|
||||||
m->reply_info.max_message_id.get());
|
|
||||||
CHECK(reply_info->reply_count_ >= 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return td_api::make_object<td_api::messageInteractionInfo>(m->view_count, m->forward_count, std::move(reply_info));
|
return td_api::make_object<td_api::messageInteractionInfo>(m->view_count, m->forward_count, std::move(reply_info));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user