Add MessageThreadInfo.h.

This commit is contained in:
levlam 2021-08-12 22:00:27 +03:00
parent 01d83bf85c
commit 05c9934074
4 changed files with 28 additions and 8 deletions

View File

@ -539,6 +539,7 @@ set(TDLIB_SOURCE
td/telegram/MessageId.h td/telegram/MessageId.h
td/telegram/MessageLinkInfo.h td/telegram/MessageLinkInfo.h
td/telegram/MessageReplyInfo.h td/telegram/MessageReplyInfo.h
td/telegram/MessageThreadInfo.h
td/telegram/MessagesDb.h td/telegram/MessagesDb.h
td/telegram/MessageSearchFilter.h td/telegram/MessageSearchFilter.h
td/telegram/MessagesManager.h td/telegram/MessagesManager.h

View File

@ -0,0 +1,21 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
//
// 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/utils/common.h"
namespace td {
struct MessageThreadInfo {
DialogId dialog_id;
vector<MessageId> message_ids;
};
} // namespace td

View File

@ -31,6 +31,7 @@
#include "td/telegram/MessageId.h" #include "td/telegram/MessageId.h"
#include "td/telegram/MessageLinkInfo.h" #include "td/telegram/MessageLinkInfo.h"
#include "td/telegram/MessageReplyInfo.h" #include "td/telegram/MessageReplyInfo.h"
#include "td/telegram/MessageThreadInfo.h"
#include "td/telegram/MessagesDb.h" #include "td/telegram/MessagesDb.h"
#include "td/telegram/MessageSearchFilter.h" #include "td/telegram/MessageSearchFilter.h"
#include "td/telegram/MessageTtlSetting.h" #include "td/telegram/MessageTtlSetting.h"
@ -567,10 +568,6 @@ class MessagesManager final : public Actor {
void get_messages_from_server(vector<FullMessageId> &&message_ids, Promise<Unit> &&promise, const char *source, void get_messages_from_server(vector<FullMessageId> &&message_ids, Promise<Unit> &&promise, const char *source,
tl_object_ptr<telegram_api::InputMessage> input_message = nullptr); tl_object_ptr<telegram_api::InputMessage> input_message = nullptr);
struct MessageThreadInfo {
DialogId dialog_id;
vector<MessageId> message_ids;
};
void get_message_thread(DialogId dialog_id, MessageId message_id, Promise<MessageThreadInfo> &&promise); void get_message_thread(DialogId dialog_id, MessageId message_id, Promise<MessageThreadInfo> &&promise);
td_api::object_ptr<td_api::messageThreadInfo> get_message_thread_info_object(const MessageThreadInfo &info); td_api::object_ptr<td_api::messageThreadInfo> get_message_thread_info_object(const MessageThreadInfo &info);

View File

@ -59,6 +59,7 @@
#include "td/telegram/MessageLinkInfo.h" #include "td/telegram/MessageLinkInfo.h"
#include "td/telegram/MessageSearchFilter.h" #include "td/telegram/MessageSearchFilter.h"
#include "td/telegram/MessagesManager.h" #include "td/telegram/MessagesManager.h"
#include "td/telegram/MessageThreadInfo.h"
#include "td/telegram/misc.h" #include "td/telegram/misc.h"
#include "td/telegram/net/ConnectionCreator.h" #include "td/telegram/net/ConnectionCreator.h"
#include "td/telegram/net/DcId.h" #include "td/telegram/net/DcId.h"
@ -1002,13 +1003,13 @@ class GetRepliedMessageRequest final : public RequestOnceActor {
} }
}; };
class GetMessageThreadRequest final : public RequestActor<MessagesManager::MessageThreadInfo> { class GetMessageThreadRequest final : public RequestActor<MessageThreadInfo> {
DialogId dialog_id_; DialogId dialog_id_;
MessageId message_id_; MessageId message_id_;
MessagesManager::MessageThreadInfo message_thread_info_; MessageThreadInfo message_thread_info_;
void do_run(Promise<MessagesManager::MessageThreadInfo> &&promise) final { void do_run(Promise<MessageThreadInfo> &&promise) final {
if (get_tries() < 2) { if (get_tries() < 2) {
promise.set_value(std::move(message_thread_info_)); promise.set_value(std::move(message_thread_info_));
return; return;
@ -1016,7 +1017,7 @@ class GetMessageThreadRequest final : public RequestActor<MessagesManager::Messa
td->messages_manager_->get_message_thread(dialog_id_, message_id_, std::move(promise)); td->messages_manager_->get_message_thread(dialog_id_, message_id_, std::move(promise));
} }
void do_set_result(MessagesManager::MessageThreadInfo &&result) final { void do_set_result(MessageThreadInfo &&result) final {
message_thread_info_ = std::move(result); message_thread_info_ = std::move(result);
} }