Add separate ChainId(DialogId) constructor.

This commit is contained in:
levlam 2022-02-08 17:30:06 +03:00
parent 367a0101d2
commit 7f7b3b6653
3 changed files with 10 additions and 3 deletions

View File

@ -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<uint64>(dialog_id.get()) << 10) + get_message_content_chain_id(message_content_type)) {
}
ChainId(DialogId dialog_id) : id((static_cast<uint64>(dialog_id.get()) << 10) + 10) {
}
ChainId(FolderId folder_id) : id((static_cast<uint64>(folder_id.get() + (1 << 30)) << 10)) {
}

View File

@ -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<tl_object_ptr<telegram_api::MessageEntity>>(), 0),
{{poll_id}}));
{{poll_id}, {dialog_id_}}));
}
void on_result(BufferSlice packet) final {

View File

@ -15,6 +15,8 @@
#include "td/utils/misc.h"
#include "td/utils/SliceBuilder.h"
#include <algorithm>
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<ChainId> &&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) {