Use invoke after for reaction-related queries.

This commit is contained in:
levlam 2022-02-16 18:36:55 +03:00
parent 0646eb3f2e
commit 786f2dc504
2 changed files with 13 additions and 6 deletions

View File

@ -8,6 +8,7 @@
#include "td/telegram/DialogId.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/FullMessageId.h"
#include "td/telegram/MessageContentType.h"
#include "td/telegram/PollId.h"
@ -28,6 +29,10 @@ class ChainId {
ChainId(DialogId dialog_id) : id((static_cast<uint64>(dialog_id.get()) << 10) + 10) {
}
ChainId(FullMessageId full_message_id) : ChainId(full_message_id.get_dialog_id()) {
id += static_cast<uint64>(full_message_id.get_message_id().get()) << 10;
}
ChainId(FolderId folder_id) : id((static_cast<uint64>(folder_id.get() + (1 << 30)) << 10)) {
}

View File

@ -76,7 +76,6 @@ class GetMessagesReactionsQuery final : public Td::ResultHandler {
class SendReactionQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
DialogId dialog_id_;
MessageId message_id_;
public:
explicit SendReactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
@ -84,7 +83,6 @@ class SendReactionQuery final : public Td::ResultHandler {
void send(FullMessageId full_message_id, string reaction, bool is_big) {
dialog_id_ = full_message_id.get_dialog_id();
message_id_ = full_message_id.get_message_id();
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
if (input_peer == nullptr) {
@ -100,8 +98,10 @@ class SendReactionQuery final : public Td::ResultHandler {
}
}
send_query(G()->net_query_creator().create(telegram_api::messages_sendReaction(
flags, false /*ignored*/, std::move(input_peer), message_id_.get_server_message_id().get(), reaction)));
send_query(G()->net_query_creator().create(
telegram_api::messages_sendReaction(flags, false /*ignored*/, std::move(input_peer),
full_message_id.get_message_id().get_server_message_id().get(), reaction),
{{dialog_id_}, {full_message_id}}));
}
void on_result(BufferSlice packet) final {
@ -152,8 +152,10 @@ class GetMessageReactionsListQuery final : public Td::ResultHandler {
flags |= telegram_api::messages_getMessageReactionsList::OFFSET_MASK;
}
send_query(G()->net_query_creator().create(telegram_api::messages_getMessageReactionsList(
flags, std::move(input_peer), message_id_.get_server_message_id().get(), reaction_, offset_, limit)));
send_query(G()->net_query_creator().create(
telegram_api::messages_getMessageReactionsList(
flags, std::move(input_peer), message_id_.get_server_message_id().get(), reaction_, offset_, limit),
{{full_message_id}}));
}
void on_result(BufferSlice packet) final {