From 7f7b3b665398509c1f197e522863a76f947236a8 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 8 Feb 2022 17:30:06 +0300 Subject: [PATCH] Add separate ChainId(DialogId) constructor. --- td/telegram/ChainId.h | 5 ++++- td/telegram/PollManager.cpp | 5 +++-- td/telegram/net/NetQuery.cpp | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/td/telegram/ChainId.h b/td/telegram/ChainId.h index a03f6cf5e..fc264045b 100644 --- a/td/telegram/ChainId.h +++ b/td/telegram/ChainId.h @@ -21,10 +21,13 @@ class ChainId { uint64 id = 0; public: - ChainId(DialogId dialog_id, MessageContentType message_content_type = MessageContentType::None) + ChainId(DialogId dialog_id, MessageContentType message_content_type) : id((static_cast(dialog_id.get()) << 10) + get_message_content_chain_id(message_content_type)) { } + ChainId(DialogId dialog_id) : id((static_cast(dialog_id.get()) << 10) + 10) { + } + ChainId(FolderId folder_id) : id((static_cast(folder_id.get() + (1 << 30)) << 10)) { } diff --git a/td/telegram/PollManager.cpp b/td/telegram/PollManager.cpp index 4508438da..2aaa3a597 100644 --- a/td/telegram/PollManager.cpp +++ b/td/telegram/PollManager.cpp @@ -155,7 +155,8 @@ class SendVoteQuery final : public Td::ResultHandler { auto message_id = full_message_id.get_message_id().get_server_message_id().get(); auto query = G()->net_query_creator().create( - telegram_api::messages_sendVote(std::move(input_peer), message_id, std::move(options)), {{poll_id}}); + telegram_api::messages_sendVote(std::move(input_peer), message_id, std::move(options)), + {{poll_id}, {dialog_id_}}); *query_ref = query.get_weak(); send_query(std::move(query)); } @@ -208,7 +209,7 @@ class StopPollQuery final : public Td::ResultHandler { telegram_api::messages_editMessage(flags, false /*ignored*/, std::move(input_peer), message_id, string(), std::move(input_media), std::move(input_reply_markup), vector>(), 0), - {{poll_id}})); + {{poll_id}, {dialog_id_}})); } void on_result(BufferSlice packet) final { diff --git a/td/telegram/net/NetQuery.cpp b/td/telegram/net/NetQuery.cpp index 8bc4019cf..39767d59b 100644 --- a/td/telegram/net/NetQuery.cpp +++ b/td/telegram/net/NetQuery.cpp @@ -15,6 +15,8 @@ #include "td/utils/misc.h" #include "td/utils/SliceBuilder.h" +#include + namespace td { int VERBOSITY_NAME(net_query) = VERBOSITY_NAME(INFO); @@ -26,6 +28,7 @@ int64 NetQuery::get_my_id() { void NetQuery::set_chain_ids(vector &&chain_ids) { chain_ids_ = transform(chain_ids, [](ChainId chain_id) { return chain_id.get() == 0 ? 1 : chain_id.get(); }); td::unique(chain_ids_); + // LOG(ERROR) << chain_ids_; } void NetQuery::on_net_write(size_t size) {