Rename FullMessageId to MessageFullId.
This commit is contained in:
parent
0362411550
commit
1e2c0ce814
@ -642,7 +642,6 @@ set(TDLIB_SOURCE
|
||||
td/telegram/ForumTopicIcon.h
|
||||
td/telegram/ForumTopicInfo.h
|
||||
td/telegram/ForumTopicManager.h
|
||||
td/telegram/FullMessageId.h
|
||||
td/telegram/Game.h
|
||||
td/telegram/GameManager.h
|
||||
td/telegram/GitCommitHash.h
|
||||
@ -676,6 +675,7 @@ set(TDLIB_SOURCE
|
||||
td/telegram/MessageDb.h
|
||||
td/telegram/MessageEntity.h
|
||||
td/telegram/MessageExtendedMedia.h
|
||||
td/telegram/MessageFullId.h
|
||||
td/telegram/MessageId.h
|
||||
td/telegram/MessageInputReplyTo.h
|
||||
td/telegram/MessageLinkInfo.h
|
||||
|
@ -228,7 +228,7 @@ void CallbackQueriesManager::on_new_inline_query(
|
||||
std::move(payload)));
|
||||
}
|
||||
|
||||
void CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,
|
||||
void CallbackQueriesManager::send_callback_query(MessageFullId message_full_id,
|
||||
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
@ -239,19 +239,19 @@ void CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,
|
||||
return promise.set_error(Status::Error(400, "Payload must be non-empty"));
|
||||
}
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
td_->messages_manager_->have_dialog_force(dialog_id, "send_callback_query");
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
return promise.set_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
|
||||
if (!td_->messages_manager_->have_message_force(full_message_id, "send_callback_query")) {
|
||||
if (!td_->messages_manager_->have_message_force(message_full_id, "send_callback_query")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
if (full_message_id.get_message_id().is_valid_scheduled()) {
|
||||
if (message_full_id.get_message_id().is_valid_scheduled()) {
|
||||
return promise.set_error(Status::Error(400, "Can't send callback queries from scheduled messages"));
|
||||
}
|
||||
if (!full_message_id.get_message_id().is_server()) {
|
||||
if (!message_full_id.get_message_id().is_server()) {
|
||||
return promise.set_error(Status::Error(400, "Bad message identifier"));
|
||||
}
|
||||
if (dialog_id.get_type() == DialogType::SecretChat) {
|
||||
@ -262,34 +262,34 @@ void CallbackQueriesManager::send_callback_query(FullMessageId full_message_id,
|
||||
auto password = static_cast<const td_api::callbackQueryPayloadDataWithPassword *>(payload.get())->password_;
|
||||
send_closure(
|
||||
td_->password_manager_, &PasswordManager::get_input_check_password_srp, std::move(password),
|
||||
PromiseCreator::lambda([this, full_message_id, payload = std::move(payload), promise = std::move(promise)](
|
||||
PromiseCreator::lambda([this, message_full_id, payload = std::move(payload), promise = std::move(promise)](
|
||||
Result<tl_object_ptr<telegram_api::InputCheckPasswordSRP>> result) mutable {
|
||||
if (result.is_error()) {
|
||||
return promise.set_error(result.move_as_error());
|
||||
}
|
||||
send_get_callback_answer_query(full_message_id, std::move(payload), result.move_as_ok(), std::move(promise));
|
||||
send_get_callback_answer_query(message_full_id, std::move(payload), result.move_as_ok(), std::move(promise));
|
||||
}));
|
||||
} else {
|
||||
send_get_callback_answer_query(full_message_id, std::move(payload), nullptr, std::move(promise));
|
||||
send_get_callback_answer_query(message_full_id, std::move(payload), nullptr, std::move(promise));
|
||||
}
|
||||
}
|
||||
|
||||
void CallbackQueriesManager::send_get_callback_answer_query(
|
||||
FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
MessageFullId message_full_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
return promise.set_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
if (!td_->messages_manager_->have_message_force(full_message_id, "send_callback_query")) {
|
||||
if (!td_->messages_manager_->have_message_force(message_full_id, "send_callback_query")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
|
||||
td_->create_handler<GetBotCallbackAnswerQuery>(std::move(promise))
|
||||
->send(dialog_id, full_message_id.get_message_id(), payload, std::move(password));
|
||||
->send(dialog_id, message_full_id.get_message_id(), payload, std::move(password));
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
@ -35,7 +35,7 @@ class CallbackQueriesManager {
|
||||
tl_object_ptr<telegram_api::InputBotInlineMessageID> &&inline_message_id, BufferSlice &&data,
|
||||
int64 chat_instance, string &&game_short_name);
|
||||
|
||||
void send_callback_query(FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
void send_callback_query(MessageFullId message_full_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
|
||||
|
||||
private:
|
||||
@ -46,7 +46,7 @@ class CallbackQueriesManager {
|
||||
static tl_object_ptr<td_api::CallbackQueryPayload> get_query_payload(int32 flags, BufferSlice &&data,
|
||||
string &&game_short_name);
|
||||
|
||||
void send_get_callback_answer_query(FullMessageId full_message_id,
|
||||
void send_get_callback_answer_query(MessageFullId message_full_id,
|
||||
tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise);
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "td/telegram/ChatId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FolderId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageContentType.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/PollId.h"
|
||||
#include "td/telegram/StoryFullId.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
@ -38,8 +38,8 @@ 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(MessageFullId message_full_id) : ChainId(message_full_id.get_dialog_id()) {
|
||||
id += static_cast<uint64>(message_full_id.get_message_id().get()) << 10;
|
||||
}
|
||||
|
||||
ChainId(FolderId folder_id) : id((static_cast<uint64>(folder_id.get() + (1 << 30)) << 10)) {
|
||||
|
@ -5327,10 +5327,10 @@ Result<tl_object_ptr<telegram_api::InputUser>> ContactsManager::get_input_user(U
|
||||
auto it = user_messages_.find(user_id);
|
||||
if (it != user_messages_.end()) {
|
||||
CHECK(!it->second.empty());
|
||||
auto full_message_id = *it->second.begin();
|
||||
auto message_full_id = *it->second.begin();
|
||||
return make_tl_object<telegram_api::inputUserFromMessage>(
|
||||
get_simple_input_peer(full_message_id.get_dialog_id()),
|
||||
full_message_id.get_message_id().get_server_message_id().get(), user_id.get());
|
||||
get_simple_input_peer(message_full_id.get_dialog_id()),
|
||||
message_full_id.get_message_id().get_server_message_id().get(), user_id.get());
|
||||
}
|
||||
if (u == nullptr) {
|
||||
return Status::Error(400, "User not found");
|
||||
@ -5360,10 +5360,10 @@ tl_object_ptr<telegram_api::InputChannel> ContactsManager::get_input_channel(Cha
|
||||
auto it = channel_messages_.find(channel_id);
|
||||
if (it != channel_messages_.end()) {
|
||||
CHECK(!it->second.empty());
|
||||
auto full_message_id = *it->second.begin();
|
||||
auto message_full_id = *it->second.begin();
|
||||
return make_tl_object<telegram_api::inputChannelFromMessage>(
|
||||
get_simple_input_peer(full_message_id.get_dialog_id()),
|
||||
full_message_id.get_message_id().get_server_message_id().get(), channel_id.get());
|
||||
get_simple_input_peer(message_full_id.get_dialog_id()),
|
||||
message_full_id.get_message_id().get_server_message_id().get(), channel_id.get());
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -5422,10 +5422,10 @@ tl_object_ptr<telegram_api::InputPeer> ContactsManager::get_input_peer_user(User
|
||||
auto it = user_messages_.find(user_id);
|
||||
CHECK(it != user_messages_.end());
|
||||
CHECK(!it->second.empty());
|
||||
auto full_message_id = *it->second.begin();
|
||||
auto message_full_id = *it->second.begin();
|
||||
return make_tl_object<telegram_api::inputPeerUserFromMessage>(
|
||||
get_simple_input_peer(full_message_id.get_dialog_id()),
|
||||
full_message_id.get_message_id().get_server_message_id().get(), user_id.get());
|
||||
get_simple_input_peer(message_full_id.get_dialog_id()),
|
||||
message_full_id.get_message_id().get_server_message_id().get(), user_id.get());
|
||||
}
|
||||
|
||||
return make_tl_object<telegram_api::inputPeerUser>(user_id.get(), u->access_hash);
|
||||
@ -5485,10 +5485,10 @@ tl_object_ptr<telegram_api::InputPeer> ContactsManager::get_input_peer_channel(C
|
||||
auto it = channel_messages_.find(channel_id);
|
||||
CHECK(it != channel_messages_.end());
|
||||
CHECK(!it->second.empty());
|
||||
auto full_message_id = *it->second.begin();
|
||||
auto message_full_id = *it->second.begin();
|
||||
return make_tl_object<telegram_api::inputPeerChannelFromMessage>(
|
||||
get_simple_input_peer(full_message_id.get_dialog_id()),
|
||||
full_message_id.get_message_id().get_server_message_id().get(), channel_id.get());
|
||||
get_simple_input_peer(message_full_id.get_dialog_id()),
|
||||
message_full_id.get_message_id().get_server_message_id().get(), channel_id.get());
|
||||
}
|
||||
|
||||
return make_tl_object<telegram_api::inputPeerChannel>(channel_id.get(), c->access_hash);
|
||||
@ -9530,14 +9530,14 @@ void ContactsManager::remove_inactive_channel(ChannelId channel_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::register_message_users(FullMessageId full_message_id, vector<UserId> user_ids) {
|
||||
void ContactsManager::register_message_users(MessageFullId message_full_id, vector<UserId> user_ids) {
|
||||
for (auto user_id : user_ids) {
|
||||
CHECK(user_id.is_valid());
|
||||
const User *u = get_user(user_id);
|
||||
if (u == nullptr || u->access_hash == -1 || u->is_min_access_hash) {
|
||||
auto &user_messages = user_messages_[user_id];
|
||||
auto need_update = user_messages.empty();
|
||||
user_messages.insert(full_message_id);
|
||||
user_messages.insert(message_full_id);
|
||||
if (need_update) {
|
||||
send_closure(G()->td(), &Td::send_update, get_update_user_object(user_id, u));
|
||||
}
|
||||
@ -9545,12 +9545,12 @@ void ContactsManager::register_message_users(FullMessageId full_message_id, vect
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::register_message_channels(FullMessageId full_message_id, vector<ChannelId> channel_ids) {
|
||||
void ContactsManager::register_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids) {
|
||||
for (auto channel_id : channel_ids) {
|
||||
CHECK(channel_id.is_valid());
|
||||
const Channel *c = get_channel(channel_id);
|
||||
if (c == nullptr) {
|
||||
channel_messages_[channel_id].insert(full_message_id);
|
||||
channel_messages_[channel_id].insert(message_full_id);
|
||||
|
||||
// get info about the channel
|
||||
get_channel_queries_.add_query(channel_id.get(), Promise<Unit>());
|
||||
@ -9558,7 +9558,7 @@ void ContactsManager::register_message_channels(FullMessageId full_message_id, v
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::unregister_message_users(FullMessageId full_message_id, vector<UserId> user_ids) {
|
||||
void ContactsManager::unregister_message_users(MessageFullId message_full_id, vector<UserId> user_ids) {
|
||||
if (user_messages_.empty()) {
|
||||
// fast path
|
||||
return;
|
||||
@ -9566,7 +9566,7 @@ void ContactsManager::unregister_message_users(FullMessageId full_message_id, ve
|
||||
for (auto user_id : user_ids) {
|
||||
auto it = user_messages_.find(user_id);
|
||||
if (it != user_messages_.end()) {
|
||||
it->second.erase(full_message_id);
|
||||
it->second.erase(message_full_id);
|
||||
if (it->second.empty()) {
|
||||
user_messages_.erase(it);
|
||||
|
||||
@ -9579,7 +9579,7 @@ void ContactsManager::unregister_message_users(FullMessageId full_message_id, ve
|
||||
}
|
||||
}
|
||||
|
||||
void ContactsManager::unregister_message_channels(FullMessageId full_message_id, vector<ChannelId> channel_ids) {
|
||||
void ContactsManager::unregister_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids) {
|
||||
if (channel_messages_.empty()) {
|
||||
// fast path
|
||||
return;
|
||||
@ -9587,7 +9587,7 @@ void ContactsManager::unregister_message_channels(FullMessageId full_message_id,
|
||||
for (auto channel_id : channel_ids) {
|
||||
auto it = channel_messages_.find(channel_id);
|
||||
if (it != channel_messages_.end()) {
|
||||
it->second.erase(full_message_id);
|
||||
it->second.erase(message_full_id);
|
||||
if (it->second.empty()) {
|
||||
channel_messages_.erase(it);
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FolderId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/Location.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/net/DcId.h"
|
||||
#include "td/telegram/Photo.h"
|
||||
@ -282,13 +282,13 @@ class ContactsManager final : public Actor {
|
||||
|
||||
void remove_inactive_channel(ChannelId channel_id);
|
||||
|
||||
void register_message_users(FullMessageId full_message_id, vector<UserId> user_ids);
|
||||
void register_message_users(MessageFullId message_full_id, vector<UserId> user_ids);
|
||||
|
||||
void register_message_channels(FullMessageId full_message_id, vector<ChannelId> channel_ids);
|
||||
void register_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids);
|
||||
|
||||
void unregister_message_users(FullMessageId full_message_id, vector<UserId> user_ids);
|
||||
void unregister_message_users(MessageFullId message_full_id, vector<UserId> user_ids);
|
||||
|
||||
void unregister_message_channels(FullMessageId full_message_id, vector<ChannelId> channel_ids);
|
||||
void unregister_message_channels(MessageFullId message_full_id, vector<ChannelId> channel_ids);
|
||||
|
||||
UserId get_my_id() const;
|
||||
|
||||
@ -2023,8 +2023,8 @@ class ContactsManager final : public Actor {
|
||||
|
||||
FlatHashMap<string, UserId> resolved_phone_numbers_;
|
||||
|
||||
FlatHashMap<UserId, FlatHashSet<FullMessageId, FullMessageIdHash>, UserIdHash> user_messages_;
|
||||
FlatHashMap<ChannelId, FlatHashSet<FullMessageId, FullMessageIdHash>, ChannelIdHash> channel_messages_;
|
||||
FlatHashMap<UserId, FlatHashSet<MessageFullId, MessageFullIdHash>, UserIdHash> user_messages_;
|
||||
FlatHashMap<ChannelId, FlatHashSet<MessageFullId, MessageFullIdHash>, ChannelIdHash> channel_messages_;
|
||||
|
||||
// bot-administrators only
|
||||
struct ChannelParticipantInfo {
|
||||
|
@ -92,9 +92,9 @@ FileSourceId FileReferenceManager::add_file_source_id(T &source, Slice source_st
|
||||
return get_current_file_source_id();
|
||||
}
|
||||
|
||||
FileSourceId FileReferenceManager::create_message_file_source(FullMessageId full_message_id) {
|
||||
FileSourceMessage source{full_message_id};
|
||||
return add_file_source_id(source, PSLICE() << full_message_id);
|
||||
FileSourceId FileReferenceManager::create_message_file_source(MessageFullId message_full_id) {
|
||||
FileSourceMessage source{message_full_id};
|
||||
return add_file_source_id(source, PSLICE() << message_full_id);
|
||||
}
|
||||
|
||||
FileSourceId FileReferenceManager::create_user_photo_file_source(UserId user_id, int64 photo_id) {
|
||||
@ -204,16 +204,16 @@ vector<FileSourceId> FileReferenceManager::get_some_file_sources(NodeId node_id)
|
||||
return node->file_source_ids.get_some_elements();
|
||||
}
|
||||
|
||||
vector<FullMessageId> FileReferenceManager::get_some_message_file_sources(NodeId node_id) {
|
||||
vector<MessageFullId> FileReferenceManager::get_some_message_file_sources(NodeId node_id) {
|
||||
auto file_source_ids = get_some_file_sources(node_id);
|
||||
|
||||
vector<FullMessageId> result;
|
||||
vector<MessageFullId> result;
|
||||
for (auto file_source_id : file_source_ids) {
|
||||
auto index = static_cast<size_t>(file_source_id.get()) - 1;
|
||||
CHECK(index < file_sources_.size());
|
||||
const auto &file_source = file_sources_[index];
|
||||
if (file_source.get_offset() == 0) {
|
||||
result.push_back(file_source.get<FileSourceMessage>().full_message_id);
|
||||
result.push_back(file_source.get<FileSourceMessage>().message_full_id);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -312,7 +312,7 @@ void FileReferenceManager::send_query(Destination dest, FileSourceId file_source
|
||||
CHECK(index < file_sources_.size());
|
||||
file_sources_[index].visit(overloaded(
|
||||
[&](const FileSourceMessage &source) {
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::get_message_from_server, source.full_message_id,
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::get_message_from_server, source.message_full_id,
|
||||
std::move(promise), "FileSourceMessage", nullptr);
|
||||
},
|
||||
[&](const FileSourceUserPhoto &source) {
|
||||
@ -475,7 +475,7 @@ void FileReferenceManager::get_file_search_text(FileSourceId file_source_id, str
|
||||
file_sources_[index].visit(overloaded(
|
||||
[&](const FileSourceMessage &source) {
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::get_message_file_search_text,
|
||||
source.full_message_id, std::move(unique_file_id), std::move(promise));
|
||||
source.message_full_id, std::move(unique_file_id), std::move(promise));
|
||||
},
|
||||
[&](const auto &source) { promise.set_error(Status::Error(500, "Unsupported file source")); }));
|
||||
}
|
||||
@ -486,7 +486,7 @@ td_api::object_ptr<td_api::message> FileReferenceManager::get_message_object(Fil
|
||||
td_api::object_ptr<td_api::message> result;
|
||||
file_sources_[index].visit(overloaded(
|
||||
[&](const FileSourceMessage &source) {
|
||||
result = G()->td().get_actor_unsafe()->messages_manager_->get_message_object(source.full_message_id,
|
||||
result = G()->td().get_actor_unsafe()->messages_manager_->get_message_object(source.message_full_id,
|
||||
"FileReferenceManager");
|
||||
},
|
||||
[&](const auto &source) { LOG(ERROR) << "Unsupported file source"; }));
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "td/telegram/ChatId.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/PhotoSizeSource.h"
|
||||
#include "td/telegram/SetWithPosition.h"
|
||||
#include "td/telegram/StoryFullId.h"
|
||||
@ -47,7 +47,7 @@ class FileReferenceManager final : public Actor {
|
||||
static bool is_file_reference_error(const Status &error);
|
||||
static size_t get_file_reference_error_pos(const Status &error);
|
||||
|
||||
FileSourceId create_message_file_source(FullMessageId full_message_id);
|
||||
FileSourceId create_message_file_source(MessageFullId message_full_id);
|
||||
FileSourceId create_user_photo_file_source(UserId user_id, int64 photo_id);
|
||||
// file reference aren't used for chat/channel photo download and the photos can't be reused
|
||||
// FileSourceId create_chat_photo_file_source(ChatId chat_id);
|
||||
@ -80,7 +80,7 @@ class FileReferenceManager final : public Actor {
|
||||
|
||||
vector<FileSourceId> get_some_file_sources(NodeId node_id);
|
||||
|
||||
vector<FullMessageId> get_some_message_file_sources(NodeId node_id);
|
||||
vector<MessageFullId> get_some_message_file_sources(NodeId node_id);
|
||||
|
||||
bool remove_file_source(NodeId node_id, FileSourceId file_source_id);
|
||||
|
||||
@ -118,7 +118,7 @@ class FileReferenceManager final : public Actor {
|
||||
};
|
||||
|
||||
struct FileSourceMessage {
|
||||
FullMessageId full_message_id;
|
||||
MessageFullId message_full_id;
|
||||
};
|
||||
struct FileSourceUserPhoto {
|
||||
int64 photo_id;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "td/telegram/ContactsManager.h"
|
||||
#include "td/telegram/FileReferenceManager.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessagesManager.h"
|
||||
#include "td/telegram/NotificationSettingsManager.h"
|
||||
#include "td/telegram/StickersManager.h"
|
||||
@ -36,7 +36,7 @@ void FileReferenceManager::store_file_source(FileSourceId file_source_id, Storer
|
||||
CHECK(index < file_sources_.size());
|
||||
auto &source = file_sources_[index];
|
||||
td::store(source.get_offset(), storer);
|
||||
source.visit(overloaded([&](const FileSourceMessage &source) { td::store(source.full_message_id, storer); },
|
||||
source.visit(overloaded([&](const FileSourceMessage &source) { td::store(source.message_full_id, storer); },
|
||||
[&](const FileSourceUserPhoto &source) {
|
||||
td::store(source.user_id, storer);
|
||||
td::store(source.photo_id, storer);
|
||||
@ -69,9 +69,9 @@ FileSourceId FileReferenceManager::parse_file_source(Td *td, ParserT &parser) {
|
||||
auto type = parser.fetch_int();
|
||||
switch (type) {
|
||||
case 0: {
|
||||
FullMessageId full_message_id;
|
||||
td::parse(full_message_id, parser);
|
||||
return td->messages_manager_->get_message_file_source_id(full_message_id);
|
||||
MessageFullId message_full_id;
|
||||
td::parse(message_full_id, parser);
|
||||
return td->messages_manager_->get_message_file_source_id(message_full_id);
|
||||
}
|
||||
case 1: {
|
||||
UserId user_id;
|
||||
|
@ -198,39 +198,39 @@ void GameManager::tear_down() {
|
||||
parent_.reset();
|
||||
}
|
||||
|
||||
void GameManager::set_game_score(FullMessageId full_message_id, bool edit_message, UserId user_id, int32 score,
|
||||
void GameManager::set_game_score(MessageFullId message_full_id, bool edit_message, UserId user_id, int32 score,
|
||||
bool force, Promise<td_api::object_ptr<td_api::message>> &&promise) {
|
||||
CHECK(td_->auth_manager_->is_bot());
|
||||
|
||||
if (!td_->messages_manager_->have_message_force(full_message_id, "set_game_score")) {
|
||||
if (!td_->messages_manager_->have_message_force(message_full_id, "set_game_score")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Edit)) {
|
||||
return promise.set_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
|
||||
TRY_RESULT_PROMISE(promise, input_user, td_->contacts_manager_->get_input_user(user_id));
|
||||
|
||||
if (!td_->messages_manager_->can_set_game_score(full_message_id)) {
|
||||
if (!td_->messages_manager_->can_set_game_score(message_full_id)) {
|
||||
return promise.set_error(Status::Error(400, "Game score can't be set"));
|
||||
}
|
||||
|
||||
auto query_promise = PromiseCreator::lambda(
|
||||
[actor_id = actor_id(this), full_message_id, promise = std::move(promise)](Result<Unit> &&result) mutable {
|
||||
[actor_id = actor_id(this), message_full_id, promise = std::move(promise)](Result<Unit> &&result) mutable {
|
||||
if (result.is_error()) {
|
||||
return promise.set_error(result.move_as_error());
|
||||
}
|
||||
send_closure(actor_id, &GameManager::on_set_game_score, full_message_id, std::move(promise));
|
||||
send_closure(actor_id, &GameManager::on_set_game_score, message_full_id, std::move(promise));
|
||||
});
|
||||
td_->create_handler<SetGameScoreQuery>(std::move(query_promise))
|
||||
->send(dialog_id, full_message_id.get_message_id(), edit_message, std::move(input_user), score, force);
|
||||
->send(dialog_id, message_full_id.get_message_id(), edit_message, std::move(input_user), score, force);
|
||||
}
|
||||
|
||||
void GameManager::on_set_game_score(FullMessageId full_message_id,
|
||||
void GameManager::on_set_game_score(MessageFullId message_full_id,
|
||||
Promise<td_api::object_ptr<td_api::message>> &&promise) {
|
||||
promise.set_value(td_->messages_manager_->get_message_object(full_message_id, "on_set_game_score"));
|
||||
promise.set_value(td_->messages_manager_->get_message_object(message_full_id, "on_set_game_score"));
|
||||
}
|
||||
|
||||
void GameManager::set_inline_game_score(const string &inline_message_id, bool edit_message, UserId user_id, int32 score,
|
||||
@ -248,19 +248,19 @@ void GameManager::set_inline_game_score(const string &inline_message_id, bool ed
|
||||
->send(std::move(input_bot_inline_message_id), edit_message, std::move(input_user), score, force);
|
||||
}
|
||||
|
||||
void GameManager::get_game_high_scores(FullMessageId full_message_id, UserId user_id,
|
||||
void GameManager::get_game_high_scores(MessageFullId message_full_id, UserId user_id,
|
||||
Promise<td_api::object_ptr<td_api::gameHighScores>> &&promise) {
|
||||
CHECK(td_->auth_manager_->is_bot());
|
||||
|
||||
if (!td_->messages_manager_->have_message_force(full_message_id, "get_game_high_scores")) {
|
||||
if (!td_->messages_manager_->have_message_force(message_full_id, "get_game_high_scores")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
return promise.set_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
if (message_id.is_scheduled() || !message_id.is_server() || dialog_id.get_type() == DialogType::SecretChat) {
|
||||
return promise.set_error(Status::Error(400, "Wrong message identifier specified"));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
@ -29,13 +29,13 @@ class GameManager final : public Actor {
|
||||
GameManager &operator=(GameManager &&) = delete;
|
||||
~GameManager() final;
|
||||
|
||||
void set_game_score(FullMessageId full_message_id, bool edit_message, UserId user_id, int32 score, bool force,
|
||||
void set_game_score(MessageFullId message_full_id, bool edit_message, UserId user_id, int32 score, bool force,
|
||||
Promise<td_api::object_ptr<td_api::message>> &&promise);
|
||||
|
||||
void set_inline_game_score(const string &inline_message_id, bool edit_message, UserId user_id, int32 score,
|
||||
bool force, Promise<Unit> &&promise);
|
||||
|
||||
void get_game_high_scores(FullMessageId full_message_id, UserId user_id,
|
||||
void get_game_high_scores(MessageFullId message_full_id, UserId user_id,
|
||||
Promise<td_api::object_ptr<td_api::gameHighScores>> &&promise);
|
||||
|
||||
void get_inline_game_high_scores(const string &inline_message_id, UserId user_id,
|
||||
@ -47,7 +47,7 @@ class GameManager final : public Actor {
|
||||
private:
|
||||
void tear_down() final;
|
||||
|
||||
void on_set_game_score(FullMessageId full_message_id, Promise<td_api::object_ptr<td_api::message>> &&promise);
|
||||
void on_set_game_score(MessageFullId message_full_id, Promise<td_api::object_ptr<td_api::message>> &&promise);
|
||||
|
||||
Td *td_;
|
||||
ActorShared<> parent_;
|
||||
|
@ -823,12 +823,12 @@ class RequestUrlAuthQuery final : public Td::ResultHandler {
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(string url, FullMessageId full_message_id, int32 button_id) {
|
||||
void send(string url, MessageFullId message_full_id, int32 button_id) {
|
||||
url_ = std::move(url);
|
||||
int32 flags = 0;
|
||||
tl_object_ptr<telegram_api::InputPeer> input_peer;
|
||||
if (full_message_id.get_dialog_id().is_valid()) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
if (message_full_id.get_dialog_id().is_valid()) {
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
CHECK(input_peer != nullptr);
|
||||
flags |= telegram_api::messages_requestUrlAuth::PEER_MASK;
|
||||
@ -836,7 +836,7 @@ class RequestUrlAuthQuery final : public Td::ResultHandler {
|
||||
flags |= telegram_api::messages_requestUrlAuth::URL_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::messages_requestUrlAuth(
|
||||
flags, std::move(input_peer), full_message_id.get_message_id().get_server_message_id().get(), button_id,
|
||||
flags, std::move(input_peer), message_full_id.get_message_id().get_server_message_id().get(), button_id,
|
||||
url_)));
|
||||
}
|
||||
|
||||
@ -890,12 +890,12 @@ class AcceptUrlAuthQuery final : public Td::ResultHandler {
|
||||
explicit AcceptUrlAuthQuery(Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(string url, FullMessageId full_message_id, int32 button_id, bool allow_write_access) {
|
||||
void send(string url, MessageFullId message_full_id, int32 button_id, bool allow_write_access) {
|
||||
url_ = std::move(url);
|
||||
int32 flags = 0;
|
||||
tl_object_ptr<telegram_api::InputPeer> input_peer;
|
||||
if (full_message_id.get_dialog_id().is_valid()) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
if (message_full_id.get_dialog_id().is_valid()) {
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
CHECK(input_peer != nullptr);
|
||||
flags |= telegram_api::messages_acceptUrlAuth::PEER_MASK;
|
||||
@ -906,7 +906,7 @@ class AcceptUrlAuthQuery final : public Td::ResultHandler {
|
||||
flags |= telegram_api::messages_acceptUrlAuth::WRITE_ALLOWED_MASK;
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::messages_acceptUrlAuth(
|
||||
flags, false /*ignored*/, std::move(input_peer), full_message_id.get_message_id().get_server_message_id().get(),
|
||||
flags, false /*ignored*/, std::move(input_peer), message_full_id.get_message_id().get_server_message_id().get(),
|
||||
button_id, url_)));
|
||||
}
|
||||
|
||||
@ -2386,7 +2386,7 @@ void LinkManager::get_external_link_info(string &&link, Promise<td_api::object_p
|
||||
|
||||
if (!td::contains(autologin_domains_, url.host_)) {
|
||||
if (td::contains(url_auth_domains_, url.host_)) {
|
||||
td_->create_handler<RequestUrlAuthQuery>(std::move(promise))->send(link, FullMessageId(), 0);
|
||||
td_->create_handler<RequestUrlAuthQuery>(std::move(promise))->send(link, MessageFullId(), 0);
|
||||
return;
|
||||
}
|
||||
return promise.set_value(std::move(default_result));
|
||||
@ -2431,23 +2431,23 @@ void LinkManager::get_external_link_info(string &&link, Promise<td_api::object_p
|
||||
promise.set_value(td_api::make_object<td_api::loginUrlInfoOpen>(url.get_url(), skip_confirmation));
|
||||
}
|
||||
|
||||
void LinkManager::get_login_url_info(FullMessageId full_message_id, int64 button_id,
|
||||
void LinkManager::get_login_url_info(MessageFullId message_full_id, int64 button_id,
|
||||
Promise<td_api::object_ptr<td_api::LoginUrlInfo>> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, url, td_->messages_manager_->get_login_button_url(full_message_id, button_id));
|
||||
TRY_RESULT_PROMISE(promise, url, td_->messages_manager_->get_login_button_url(message_full_id, button_id));
|
||||
td_->create_handler<RequestUrlAuthQuery>(std::move(promise))
|
||||
->send(std::move(url), full_message_id, narrow_cast<int32>(button_id));
|
||||
->send(std::move(url), message_full_id, narrow_cast<int32>(button_id));
|
||||
}
|
||||
|
||||
void LinkManager::get_login_url(FullMessageId full_message_id, int64 button_id, bool allow_write_access,
|
||||
void LinkManager::get_login_url(MessageFullId message_full_id, int64 button_id, bool allow_write_access,
|
||||
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, url, td_->messages_manager_->get_login_button_url(full_message_id, button_id));
|
||||
TRY_RESULT_PROMISE(promise, url, td_->messages_manager_->get_login_button_url(message_full_id, button_id));
|
||||
td_->create_handler<AcceptUrlAuthQuery>(std::move(promise))
|
||||
->send(std::move(url), full_message_id, narrow_cast<int32>(button_id), allow_write_access);
|
||||
->send(std::move(url), message_full_id, narrow_cast<int32>(button_id), allow_write_access);
|
||||
}
|
||||
|
||||
void LinkManager::get_link_login_url(const string &url, bool allow_write_access,
|
||||
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise) {
|
||||
td_->create_handler<AcceptUrlAuthQuery>(std::move(promise))->send(url, FullMessageId(), 0, allow_write_access);
|
||||
td_->create_handler<AcceptUrlAuthQuery>(std::move(promise))->send(url, MessageFullId(), 0, allow_write_access);
|
||||
}
|
||||
|
||||
Result<string> LinkManager::get_background_url(const string &name,
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "td/telegram/CustomEmojiId.h"
|
||||
#include "td/telegram/DialogBoostLinkInfo.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageLinkInfo.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/UserId.h"
|
||||
@ -72,10 +72,10 @@ class LinkManager final : public Actor {
|
||||
|
||||
void get_external_link_info(string &&link, Promise<td_api::object_ptr<td_api::LoginUrlInfo>> &&promise);
|
||||
|
||||
void get_login_url_info(FullMessageId full_message_id, int64 button_id,
|
||||
void get_login_url_info(MessageFullId message_full_id, int64 button_id,
|
||||
Promise<td_api::object_ptr<td_api::LoginUrlInfo>> &&promise);
|
||||
|
||||
void get_login_url(FullMessageId full_message_id, int64 button_id, bool allow_write_access,
|
||||
void get_login_url(MessageFullId message_full_id, int64 button_id, bool allow_write_access,
|
||||
Promise<td_api::object_ptr<td_api::httpUrl>> &&promise);
|
||||
|
||||
void get_link_login_url(const string &url, bool allow_write_access,
|
||||
|
@ -3316,7 +3316,7 @@ string get_message_content_theme_name(const MessageContent *content) {
|
||||
}
|
||||
}
|
||||
|
||||
FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const MessageContent *content) {
|
||||
MessageFullId get_message_content_replied_message_id(DialogId dialog_id, const MessageContent *content) {
|
||||
switch (content->get_type()) {
|
||||
case MessageContentType::PinMessage:
|
||||
return {dialog_id, static_cast<const MessagePinMessage *>(content)->message_id};
|
||||
@ -3325,7 +3325,7 @@ FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const M
|
||||
case MessageContentType::PaymentSuccessful: {
|
||||
auto *m = static_cast<const MessagePaymentSuccessful *>(content);
|
||||
if (!m->invoice_message_id.is_valid()) {
|
||||
return FullMessageId();
|
||||
return MessageFullId();
|
||||
}
|
||||
|
||||
auto reply_in_dialog_id = m->invoice_dialog_id.is_valid() ? m->invoice_dialog_id : dialog_id;
|
||||
@ -3334,13 +3334,13 @@ FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const M
|
||||
case MessageContentType::SetBackground: {
|
||||
auto *m = static_cast<const MessageSetBackground *>(content);
|
||||
if (!m->old_message_id.is_valid()) {
|
||||
return FullMessageId();
|
||||
return MessageFullId();
|
||||
}
|
||||
|
||||
return {dialog_id, m->old_message_id};
|
||||
}
|
||||
default:
|
||||
return FullMessageId();
|
||||
return MessageFullId();
|
||||
}
|
||||
}
|
||||
|
||||
@ -3585,25 +3585,25 @@ bool can_message_content_have_media_timestamp(const MessageContent *content) {
|
||||
}
|
||||
}
|
||||
|
||||
void set_message_content_poll_answer(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void set_message_content_poll_answer(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
vector<int32> &&option_ids, Promise<Unit> &&promise) {
|
||||
CHECK(content->get_type() == MessageContentType::Poll);
|
||||
td->poll_manager_->set_poll_answer(static_cast<const MessagePoll *>(content)->poll_id, full_message_id,
|
||||
td->poll_manager_->set_poll_answer(static_cast<const MessagePoll *>(content)->poll_id, message_full_id,
|
||||
std::move(option_ids), std::move(promise));
|
||||
}
|
||||
|
||||
void get_message_content_poll_voters(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void get_message_content_poll_voters(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
int32 option_id, int32 offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise) {
|
||||
CHECK(content->get_type() == MessageContentType::Poll);
|
||||
td->poll_manager_->get_poll_voters(static_cast<const MessagePoll *>(content)->poll_id, full_message_id, option_id,
|
||||
td->poll_manager_->get_poll_voters(static_cast<const MessagePoll *>(content)->poll_id, message_full_id, option_id,
|
||||
offset, limit, std::move(promise));
|
||||
}
|
||||
|
||||
void stop_message_content_poll(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void stop_message_content_poll(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
unique_ptr<ReplyMarkup> &&reply_markup, Promise<Unit> &&promise) {
|
||||
CHECK(content->get_type() == MessageContentType::Poll);
|
||||
td->poll_manager_->stop_poll(static_cast<const MessagePoll *>(content)->poll_id, full_message_id,
|
||||
td->poll_manager_->stop_poll(static_cast<const MessagePoll *>(content)->poll_id, message_full_id,
|
||||
std::move(reply_markup), std::move(promise));
|
||||
}
|
||||
|
||||
@ -4372,48 +4372,48 @@ static CustomEmojiId get_custom_emoji_id(const FormattedText &text) {
|
||||
return text.entities.empty() ? CustomEmojiId() : text.entities[0].custom_emoji_id;
|
||||
}
|
||||
|
||||
void register_message_content(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void register_message_content(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
switch (content->get_type()) {
|
||||
case MessageContentType::Text: {
|
||||
auto text = static_cast<const MessageText *>(content);
|
||||
if (text->web_page_id.is_valid()) {
|
||||
td->web_pages_manager_->register_web_page(text->web_page_id, full_message_id, source);
|
||||
td->web_pages_manager_->register_web_page(text->web_page_id, message_full_id, source);
|
||||
} else if (can_be_animated_emoji(text->text)) {
|
||||
td->stickers_manager_->register_emoji(text->text.text, get_custom_emoji_id(text->text), full_message_id,
|
||||
td->stickers_manager_->register_emoji(text->text.text, get_custom_emoji_id(text->text), message_full_id,
|
||||
source);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case MessageContentType::VideoNote:
|
||||
return td->video_notes_manager_->register_video_note(static_cast<const MessageVideoNote *>(content)->file_id,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
case MessageContentType::VoiceNote:
|
||||
return td->voice_notes_manager_->register_voice_note(static_cast<const MessageVoiceNote *>(content)->file_id,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
case MessageContentType::Poll:
|
||||
return td->poll_manager_->register_poll(static_cast<const MessagePoll *>(content)->poll_id, full_message_id,
|
||||
return td->poll_manager_->register_poll(static_cast<const MessagePoll *>(content)->poll_id, message_full_id,
|
||||
source);
|
||||
case MessageContentType::Dice: {
|
||||
auto dice = static_cast<const MessageDice *>(content);
|
||||
return td->stickers_manager_->register_dice(dice->emoji, dice->dice_value, full_message_id, source);
|
||||
return td->stickers_manager_->register_dice(dice->emoji, dice->dice_value, message_full_id, source);
|
||||
}
|
||||
case MessageContentType::GiftPremium:
|
||||
return td->stickers_manager_->register_premium_gift(static_cast<const MessageGiftPremium *>(content)->months,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
case MessageContentType::SuggestProfilePhoto:
|
||||
return td->contacts_manager_->register_suggested_profile_photo(
|
||||
static_cast<const MessageSuggestProfilePhoto *>(content)->photo);
|
||||
case MessageContentType::Story:
|
||||
return td->story_manager_->register_story(static_cast<const MessageStory *>(content)->story_full_id,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void reregister_message_content(Td *td, const MessageContent *old_content, const MessageContent *new_content,
|
||||
FullMessageId full_message_id, const char *source) {
|
||||
MessageFullId message_full_id, const char *source) {
|
||||
auto old_content_type = old_content->get_type();
|
||||
auto new_content_type = new_content->get_type();
|
||||
if (old_content_type == new_content_type) {
|
||||
@ -4470,42 +4470,42 @@ void reregister_message_content(Td *td, const MessageContent *old_content, const
|
||||
return;
|
||||
}
|
||||
}
|
||||
unregister_message_content(td, old_content, full_message_id, source);
|
||||
register_message_content(td, new_content, full_message_id, source);
|
||||
unregister_message_content(td, old_content, message_full_id, source);
|
||||
register_message_content(td, new_content, message_full_id, source);
|
||||
}
|
||||
|
||||
void unregister_message_content(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void unregister_message_content(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
switch (content->get_type()) {
|
||||
case MessageContentType::Text: {
|
||||
auto text = static_cast<const MessageText *>(content);
|
||||
if (text->web_page_id.is_valid()) {
|
||||
td->web_pages_manager_->unregister_web_page(text->web_page_id, full_message_id, source);
|
||||
td->web_pages_manager_->unregister_web_page(text->web_page_id, message_full_id, source);
|
||||
} else if (can_be_animated_emoji(text->text)) {
|
||||
td->stickers_manager_->unregister_emoji(text->text.text, get_custom_emoji_id(text->text), full_message_id,
|
||||
td->stickers_manager_->unregister_emoji(text->text.text, get_custom_emoji_id(text->text), message_full_id,
|
||||
source);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case MessageContentType::VideoNote:
|
||||
return td->video_notes_manager_->unregister_video_note(static_cast<const MessageVideoNote *>(content)->file_id,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
case MessageContentType::VoiceNote:
|
||||
return td->voice_notes_manager_->unregister_voice_note(static_cast<const MessageVoiceNote *>(content)->file_id,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
case MessageContentType::Poll:
|
||||
return td->poll_manager_->unregister_poll(static_cast<const MessagePoll *>(content)->poll_id, full_message_id,
|
||||
return td->poll_manager_->unregister_poll(static_cast<const MessagePoll *>(content)->poll_id, message_full_id,
|
||||
source);
|
||||
case MessageContentType::Dice: {
|
||||
auto dice = static_cast<const MessageDice *>(content);
|
||||
return td->stickers_manager_->unregister_dice(dice->emoji, dice->dice_value, full_message_id, source);
|
||||
return td->stickers_manager_->unregister_dice(dice->emoji, dice->dice_value, message_full_id, source);
|
||||
}
|
||||
case MessageContentType::GiftPremium:
|
||||
return td->stickers_manager_->unregister_premium_gift(static_cast<const MessageGiftPremium *>(content)->months,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
case MessageContentType::Story:
|
||||
return td->story_manager_->unregister_story(static_cast<const MessageStory *>(content)->story_full_id,
|
||||
full_message_id, source);
|
||||
message_full_id, source);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -6539,7 +6539,7 @@ bool need_poll_message_content_extended_media(const MessageContent *content) {
|
||||
return static_cast<const MessageInvoice *>(content)->input_invoice.need_poll_extended_media();
|
||||
}
|
||||
|
||||
void get_message_content_animated_emoji_click_sticker(const MessageContent *content, FullMessageId full_message_id,
|
||||
void get_message_content_animated_emoji_click_sticker(const MessageContent *content, MessageFullId message_full_id,
|
||||
Td *td, Promise<td_api::object_ptr<td_api::sticker>> &&promise) {
|
||||
if (content->get_type() != MessageContentType::Text) {
|
||||
return promise.set_error(Status::Error(400, "Message is not an animated emoji message"));
|
||||
@ -6549,10 +6549,10 @@ void get_message_content_animated_emoji_click_sticker(const MessageContent *cont
|
||||
if (!can_be_animated_emoji(text)) {
|
||||
return promise.set_error(Status::Error(400, "Message is not an animated emoji message"));
|
||||
}
|
||||
td->stickers_manager_->get_animated_emoji_click_sticker(text.text, full_message_id, std::move(promise));
|
||||
td->stickers_manager_->get_animated_emoji_click_sticker(text.text, message_full_id, std::move(promise));
|
||||
}
|
||||
|
||||
void on_message_content_animated_emoji_clicked(const MessageContent *content, FullMessageId full_message_id, Td *td,
|
||||
void on_message_content_animated_emoji_clicked(const MessageContent *content, MessageFullId message_full_id, Td *td,
|
||||
string &&emoji, string &&data) {
|
||||
if (content->get_type() != MessageContentType::Text) {
|
||||
return;
|
||||
@ -6563,7 +6563,7 @@ void on_message_content_animated_emoji_clicked(const MessageContent *content, Fu
|
||||
if (!text.entities.empty() || remove_emoji_modifiers(text.text) != emoji) {
|
||||
return;
|
||||
}
|
||||
auto error = td->stickers_manager_->on_animated_emoji_message_clicked(std::move(emoji), full_message_id, data);
|
||||
auto error = td->stickers_manager_->on_animated_emoji_message_clicked(std::move(emoji), message_full_id, data);
|
||||
if (error.is_error()) {
|
||||
LOG(WARNING) << "Failed to process animated emoji click with data \"" << data << "\": " << error;
|
||||
}
|
||||
@ -6927,25 +6927,25 @@ void update_used_hashtags(Td *td, const MessageContent *content) {
|
||||
}
|
||||
}
|
||||
|
||||
void recognize_message_content_speech(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void recognize_message_content_speech(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
Promise<Unit> &&promise) {
|
||||
switch (content->get_type()) {
|
||||
case MessageContentType::VideoNote:
|
||||
return td->video_notes_manager_->recognize_speech(full_message_id, std::move(promise));
|
||||
return td->video_notes_manager_->recognize_speech(message_full_id, std::move(promise));
|
||||
case MessageContentType::VoiceNote:
|
||||
return td->voice_notes_manager_->recognize_speech(full_message_id, std::move(promise));
|
||||
return td->voice_notes_manager_->recognize_speech(message_full_id, std::move(promise));
|
||||
default:
|
||||
return promise.set_error(Status::Error(400, "Invalid message specified"));
|
||||
}
|
||||
}
|
||||
|
||||
void rate_message_content_speech_recognition(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void rate_message_content_speech_recognition(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
bool is_good, Promise<Unit> &&promise) {
|
||||
switch (content->get_type()) {
|
||||
case MessageContentType::VideoNote:
|
||||
return td->video_notes_manager_->rate_speech_recognition(full_message_id, is_good, std::move(promise));
|
||||
return td->video_notes_manager_->rate_speech_recognition(message_full_id, is_good, std::move(promise));
|
||||
case MessageContentType::VoiceNote:
|
||||
return td->voice_notes_manager_->rate_speech_recognition(full_message_id, is_good, std::move(promise));
|
||||
return td->voice_notes_manager_->rate_speech_recognition(message_full_id, is_good, std::move(promise));
|
||||
default:
|
||||
return promise.set_error(Status::Error(400, "Invalid message specified"));
|
||||
}
|
||||
|
@ -10,12 +10,12 @@
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/EncryptedFile.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/logevent/LogEvent.h"
|
||||
#include "td/telegram/MessageContentType.h"
|
||||
#include "td/telegram/MessageCopyOptions.h"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/Photo.h"
|
||||
#include "td/telegram/ReplyMarkup.h"
|
||||
@ -142,7 +142,7 @@ BackgroundInfo get_message_content_background_info(const MessageContent *content
|
||||
|
||||
string get_message_content_theme_name(const MessageContent *content);
|
||||
|
||||
FullMessageId get_message_content_replied_message_id(DialogId dialog_id, const MessageContent *content);
|
||||
MessageFullId get_message_content_replied_message_id(DialogId dialog_id, const MessageContent *content);
|
||||
|
||||
std::pair<InputGroupCallId, bool> get_message_content_group_call_info(const MessageContent *content);
|
||||
|
||||
@ -166,14 +166,14 @@ void remove_message_content_web_page(MessageContent *content);
|
||||
|
||||
bool can_message_content_have_media_timestamp(const MessageContent *content);
|
||||
|
||||
void set_message_content_poll_answer(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void set_message_content_poll_answer(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
vector<int32> &&option_ids, Promise<Unit> &&promise);
|
||||
|
||||
void get_message_content_poll_voters(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void get_message_content_poll_voters(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
int32 option_id, int32 offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
||||
|
||||
void stop_message_content_poll(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void stop_message_content_poll(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
unique_ptr<ReplyMarkup> &&reply_markup, Promise<Unit> &&promise);
|
||||
|
||||
void merge_message_contents(Td *td, const MessageContent *old_content, MessageContent *new_content,
|
||||
@ -182,12 +182,12 @@ void merge_message_contents(Td *td, const MessageContent *old_content, MessageCo
|
||||
|
||||
bool merge_message_content_file_id(Td *td, MessageContent *message_content, FileId new_file_id);
|
||||
|
||||
void register_message_content(Td *td, const MessageContent *content, FullMessageId full_message_id, const char *source);
|
||||
void register_message_content(Td *td, const MessageContent *content, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void reregister_message_content(Td *td, const MessageContent *old_content, const MessageContent *new_content,
|
||||
FullMessageId full_message_id, const char *source);
|
||||
MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_message_content(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void unregister_message_content(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
const char *source);
|
||||
|
||||
unique_ptr<MessageContent> get_secret_message_content(
|
||||
@ -251,10 +251,10 @@ bool update_message_content_extended_media(MessageContent *content,
|
||||
|
||||
bool need_poll_message_content_extended_media(const MessageContent *content);
|
||||
|
||||
void get_message_content_animated_emoji_click_sticker(const MessageContent *content, FullMessageId full_message_id,
|
||||
void get_message_content_animated_emoji_click_sticker(const MessageContent *content, MessageFullId message_full_id,
|
||||
Td *td, Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
||||
|
||||
void on_message_content_animated_emoji_clicked(const MessageContent *content, FullMessageId full_message_id, Td *td,
|
||||
void on_message_content_animated_emoji_clicked(const MessageContent *content, MessageFullId message_full_id, Td *td,
|
||||
string &&emoji, string &&data);
|
||||
|
||||
bool need_reget_message_content(const MessageContent *content);
|
||||
@ -282,10 +282,10 @@ void on_dialog_used(TopDialogCategory category, DialogId dialog_id, int32 date);
|
||||
|
||||
void update_used_hashtags(Td *td, const MessageContent *content);
|
||||
|
||||
void recognize_message_content_speech(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void recognize_message_content_speech(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void rate_message_content_speech_recognition(Td *td, const MessageContent *content, FullMessageId full_message_id,
|
||||
void rate_message_content_speech_recognition(Td *td, const MessageContent *content, MessageFullId message_full_id,
|
||||
bool is_good, Promise<Unit> &&promise);
|
||||
|
||||
} // namespace td
|
||||
|
@ -287,13 +287,13 @@ class MessageDbImpl final : public MessageDbSyncInterface {
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
void add_message(MessageFullId message_full_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
|
||||
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data) final {
|
||||
LOG(INFO) << "Add " << full_message_id << " to database";
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
LOG_CHECK(dialog_id.is_valid()) << dialog_id << ' ' << message_id << ' ' << full_message_id;
|
||||
LOG(INFO) << "Add " << message_full_id << " to database";
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
LOG_CHECK(dialog_id.is_valid()) << dialog_id << ' ' << message_id << ' ' << message_full_id;
|
||||
CHECK(message_id.is_valid());
|
||||
SCOPE_EXIT {
|
||||
add_message_stmt_.reset();
|
||||
@ -366,10 +366,10 @@ class MessageDbImpl final : public MessageDbSyncInterface {
|
||||
add_message_stmt_.step().ensure();
|
||||
}
|
||||
|
||||
void add_scheduled_message(FullMessageId full_message_id, BufferSlice data) final {
|
||||
LOG(INFO) << "Add " << full_message_id << " to database";
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
void add_scheduled_message(MessageFullId message_full_id, BufferSlice data) final {
|
||||
LOG(INFO) << "Add " << message_full_id << " to database";
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
CHECK(dialog_id.is_valid());
|
||||
CHECK(message_id.is_valid_scheduled());
|
||||
SCOPE_EXIT {
|
||||
@ -389,10 +389,10 @@ class MessageDbImpl final : public MessageDbSyncInterface {
|
||||
add_scheduled_message_stmt_.step().ensure();
|
||||
}
|
||||
|
||||
void delete_message(FullMessageId full_message_id) final {
|
||||
LOG(INFO) << "Delete " << full_message_id << " from database";
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
void delete_message(MessageFullId message_full_id) final {
|
||||
LOG(INFO) << "Delete " << message_full_id << " from database";
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
CHECK(dialog_id.is_valid());
|
||||
CHECK(message_id.is_valid() || message_id.is_valid_scheduled());
|
||||
bool is_scheduled = message_id.is_scheduled();
|
||||
@ -439,9 +439,9 @@ class MessageDbImpl final : public MessageDbSyncInterface {
|
||||
delete_dialog_messages_by_sender_stmt_.step().ensure();
|
||||
}
|
||||
|
||||
Result<MessageDbDialogMessage> get_message(FullMessageId full_message_id) final {
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
Result<MessageDbDialogMessage> get_message(MessageFullId message_full_id) final {
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
CHECK(dialog_id.is_valid());
|
||||
CHECK(message_id.is_valid() || message_id.is_valid_scheduled());
|
||||
bool is_scheduled = message_id.is_scheduled();
|
||||
@ -988,20 +988,20 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
|
||||
impl_ = create_actor_on_scheduler<Impl>("MessageDbActor", scheduler_id, std::move(sync_db));
|
||||
}
|
||||
|
||||
void add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
void add_message(MessageFullId message_full_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
|
||||
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data,
|
||||
Promise<> promise) final {
|
||||
send_closure_later(impl_, &Impl::add_message, full_message_id, unique_message_id, sender_dialog_id, random_id,
|
||||
send_closure_later(impl_, &Impl::add_message, message_full_id, unique_message_id, sender_dialog_id, random_id,
|
||||
ttl_expires_at, index_mask, search_id, std::move(text), notification_id, top_thread_message_id,
|
||||
std::move(data), std::move(promise));
|
||||
}
|
||||
void add_scheduled_message(FullMessageId full_message_id, BufferSlice data, Promise<> promise) final {
|
||||
send_closure_later(impl_, &Impl::add_scheduled_message, full_message_id, std::move(data), std::move(promise));
|
||||
void add_scheduled_message(MessageFullId message_full_id, BufferSlice data, Promise<> promise) final {
|
||||
send_closure_later(impl_, &Impl::add_scheduled_message, message_full_id, std::move(data), std::move(promise));
|
||||
}
|
||||
|
||||
void delete_message(FullMessageId full_message_id, Promise<> promise) final {
|
||||
send_closure_later(impl_, &Impl::delete_message, full_message_id, std::move(promise));
|
||||
void delete_message(MessageFullId message_full_id, Promise<> promise) final {
|
||||
send_closure_later(impl_, &Impl::delete_message, message_full_id, std::move(promise));
|
||||
}
|
||||
void delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id, Promise<> promise) final {
|
||||
send_closure_later(impl_, &Impl::delete_all_dialog_messages, dialog_id, from_message_id, std::move(promise));
|
||||
@ -1010,8 +1010,8 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
|
||||
send_closure_later(impl_, &Impl::delete_dialog_messages_by_sender, dialog_id, sender_dialog_id, std::move(promise));
|
||||
}
|
||||
|
||||
void get_message(FullMessageId full_message_id, Promise<MessageDbDialogMessage> promise) final {
|
||||
send_closure_later(impl_, &Impl::get_message, full_message_id, std::move(promise));
|
||||
void get_message(MessageFullId message_full_id, Promise<MessageDbDialogMessage> promise) final {
|
||||
send_closure_later(impl_, &Impl::get_message, message_full_id, std::move(promise));
|
||||
}
|
||||
void get_message_by_unique_message_id(ServerMessageId unique_message_id, Promise<MessageDbMessage> promise) final {
|
||||
send_closure_later(impl_, &Impl::get_message_by_unique_message_id, unique_message_id, std::move(promise));
|
||||
@ -1068,29 +1068,29 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
|
||||
public:
|
||||
explicit Impl(std::shared_ptr<MessageDbSyncSafeInterface> sync_db_safe) : sync_db_safe_(std::move(sync_db_safe)) {
|
||||
}
|
||||
void add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
void add_message(MessageFullId message_full_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
|
||||
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data,
|
||||
Promise<> promise) {
|
||||
add_write_query([this, full_message_id, unique_message_id, sender_dialog_id, random_id, ttl_expires_at,
|
||||
add_write_query([this, message_full_id, unique_message_id, sender_dialog_id, random_id, ttl_expires_at,
|
||||
index_mask, search_id, text = std::move(text), notification_id, top_thread_message_id,
|
||||
data = std::move(data), promise = std::move(promise)](Unit) mutable {
|
||||
sync_db_->add_message(full_message_id, unique_message_id, sender_dialog_id, random_id, ttl_expires_at,
|
||||
sync_db_->add_message(message_full_id, unique_message_id, sender_dialog_id, random_id, ttl_expires_at,
|
||||
index_mask, search_id, std::move(text), notification_id, top_thread_message_id,
|
||||
std::move(data));
|
||||
on_write_result(std::move(promise));
|
||||
});
|
||||
}
|
||||
void add_scheduled_message(FullMessageId full_message_id, BufferSlice data, Promise<> promise) {
|
||||
add_write_query([this, full_message_id, promise = std::move(promise), data = std::move(data)](Unit) mutable {
|
||||
sync_db_->add_scheduled_message(full_message_id, std::move(data));
|
||||
void add_scheduled_message(MessageFullId message_full_id, BufferSlice data, Promise<> promise) {
|
||||
add_write_query([this, message_full_id, promise = std::move(promise), data = std::move(data)](Unit) mutable {
|
||||
sync_db_->add_scheduled_message(message_full_id, std::move(data));
|
||||
on_write_result(std::move(promise));
|
||||
});
|
||||
}
|
||||
|
||||
void delete_message(FullMessageId full_message_id, Promise<> promise) {
|
||||
add_write_query([this, full_message_id, promise = std::move(promise)](Unit) mutable {
|
||||
sync_db_->delete_message(full_message_id);
|
||||
void delete_message(MessageFullId message_full_id, Promise<> promise) {
|
||||
add_write_query([this, message_full_id, promise = std::move(promise)](Unit) mutable {
|
||||
sync_db_->delete_message(message_full_id);
|
||||
on_write_result(std::move(promise));
|
||||
});
|
||||
}
|
||||
@ -1112,9 +1112,9 @@ class MessageDbAsync final : public MessageDbAsyncInterface {
|
||||
promise.set_value(Unit());
|
||||
}
|
||||
|
||||
void get_message(FullMessageId full_message_id, Promise<MessageDbDialogMessage> promise) {
|
||||
void get_message(MessageFullId message_full_id, Promise<MessageDbDialogMessage> promise) {
|
||||
add_read_query();
|
||||
promise.set_result(sync_db_->get_message(full_message_id));
|
||||
promise.set_result(sync_db_->get_message(message_full_id));
|
||||
}
|
||||
void get_message_by_unique_message_id(ServerMessageId unique_message_id, Promise<MessageDbMessage> promise) {
|
||||
add_read_query();
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/MessageSearchFilter.h"
|
||||
#include "td/telegram/NotificationId.h"
|
||||
@ -104,16 +104,16 @@ class MessageDbSyncInterface {
|
||||
MessageDbSyncInterface &operator=(const MessageDbSyncInterface &) = delete;
|
||||
virtual ~MessageDbSyncInterface() = default;
|
||||
|
||||
virtual void add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
virtual void add_message(MessageFullId message_full_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
|
||||
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data) = 0;
|
||||
virtual void add_scheduled_message(FullMessageId full_message_id, BufferSlice data) = 0;
|
||||
virtual void add_scheduled_message(MessageFullId message_full_id, BufferSlice data) = 0;
|
||||
|
||||
virtual void delete_message(FullMessageId full_message_id) = 0;
|
||||
virtual void delete_message(MessageFullId message_full_id) = 0;
|
||||
virtual void delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id) = 0;
|
||||
virtual void delete_dialog_messages_by_sender(DialogId dialog_id, DialogId sender_dialog_id) = 0;
|
||||
|
||||
virtual Result<MessageDbDialogMessage> get_message(FullMessageId full_message_id) = 0;
|
||||
virtual Result<MessageDbDialogMessage> get_message(MessageFullId message_full_id) = 0;
|
||||
virtual Result<MessageDbMessage> get_message_by_unique_message_id(ServerMessageId unique_message_id) = 0;
|
||||
virtual Result<MessageDbDialogMessage> get_message_by_random_id(DialogId dialog_id, int64 random_id) = 0;
|
||||
virtual Result<MessageDbDialogMessage> get_dialog_message_by_date(DialogId dialog_id, MessageId first_message_id,
|
||||
@ -155,17 +155,17 @@ class MessageDbAsyncInterface {
|
||||
MessageDbAsyncInterface &operator=(const MessageDbAsyncInterface &) = delete;
|
||||
virtual ~MessageDbAsyncInterface() = default;
|
||||
|
||||
virtual void add_message(FullMessageId full_message_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
virtual void add_message(MessageFullId message_full_id, ServerMessageId unique_message_id, DialogId sender_dialog_id,
|
||||
int64 random_id, int32 ttl_expires_at, int32 index_mask, int64 search_id, string text,
|
||||
NotificationId notification_id, MessageId top_thread_message_id, BufferSlice data,
|
||||
Promise<> promise) = 0;
|
||||
virtual void add_scheduled_message(FullMessageId full_message_id, BufferSlice data, Promise<> promise) = 0;
|
||||
virtual void add_scheduled_message(MessageFullId message_full_id, BufferSlice data, Promise<> promise) = 0;
|
||||
|
||||
virtual void delete_message(FullMessageId full_message_id, Promise<> promise) = 0;
|
||||
virtual void delete_message(MessageFullId message_full_id, Promise<> promise) = 0;
|
||||
virtual void delete_all_dialog_messages(DialogId dialog_id, MessageId from_message_id, Promise<> promise) = 0;
|
||||
virtual void delete_dialog_messages_by_sender(DialogId dialog_id, DialogId sender_dialog_id, Promise<> promise) = 0;
|
||||
|
||||
virtual void get_message(FullMessageId full_message_id, Promise<MessageDbDialogMessage> promise) = 0;
|
||||
virtual void get_message(MessageFullId message_full_id, Promise<MessageDbDialogMessage> promise) = 0;
|
||||
virtual void get_message_by_unique_message_id(ServerMessageId unique_message_id,
|
||||
Promise<MessageDbMessage> promise) = 0;
|
||||
virtual void get_message_by_random_id(DialogId dialog_id, int64 random_id,
|
||||
|
@ -16,23 +16,23 @@
|
||||
|
||||
namespace td {
|
||||
|
||||
struct FullMessageId {
|
||||
struct MessageFullId {
|
||||
private:
|
||||
DialogId dialog_id;
|
||||
MessageId message_id;
|
||||
|
||||
public:
|
||||
FullMessageId() : dialog_id(), message_id() {
|
||||
MessageFullId() : dialog_id(), message_id() {
|
||||
}
|
||||
|
||||
FullMessageId(DialogId dialog_id, MessageId message_id) : dialog_id(dialog_id), message_id(message_id) {
|
||||
MessageFullId(DialogId dialog_id, MessageId message_id) : dialog_id(dialog_id), message_id(message_id) {
|
||||
}
|
||||
|
||||
bool operator==(const FullMessageId &other) const {
|
||||
bool operator==(const MessageFullId &other) const {
|
||||
return dialog_id == other.dialog_id && message_id == other.message_id;
|
||||
}
|
||||
|
||||
bool operator!=(const FullMessageId &other) const {
|
||||
bool operator!=(const MessageFullId &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ struct FullMessageId {
|
||||
return message_id;
|
||||
}
|
||||
|
||||
static FullMessageId get_full_message_id(const tl_object_ptr<telegram_api::Message> &message_ptr, bool is_scheduled) {
|
||||
static MessageFullId get_message_full_id(const tl_object_ptr<telegram_api::Message> &message_ptr, bool is_scheduled) {
|
||||
return {DialogId::get_message_dialog_id(message_ptr), MessageId::get_message_id(message_ptr, is_scheduled)};
|
||||
}
|
||||
|
||||
@ -61,15 +61,15 @@ struct FullMessageId {
|
||||
}
|
||||
};
|
||||
|
||||
struct FullMessageIdHash {
|
||||
uint32 operator()(FullMessageId full_message_id) const {
|
||||
return combine_hashes(DialogIdHash()(full_message_id.get_dialog_id()),
|
||||
MessageIdHash()(full_message_id.get_message_id()));
|
||||
struct MessageFullIdHash {
|
||||
uint32 operator()(MessageFullId message_full_id) const {
|
||||
return combine_hashes(DialogIdHash()(message_full_id.get_dialog_id()),
|
||||
MessageIdHash()(message_full_id.get_message_id()));
|
||||
}
|
||||
};
|
||||
|
||||
inline StringBuilder &operator<<(StringBuilder &string_builder, FullMessageId full_message_id) {
|
||||
return string_builder << full_message_id.get_message_id() << " in " << full_message_id.get_dialog_id();
|
||||
inline StringBuilder &operator<<(StringBuilder &string_builder, MessageFullId message_full_id) {
|
||||
return string_builder << message_full_id.get_message_id() << " in " << message_full_id.get_dialog_id();
|
||||
}
|
||||
|
||||
} // namespace td
|
@ -101,8 +101,8 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
explicit SendReactionQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, vector<ReactionType> reaction_types, bool is_big, bool add_to_recent) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
void send(MessageFullId message_full_id, vector<ReactionType> reaction_types, bool is_big, bool add_to_recent) {
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
if (input_peer == nullptr) {
|
||||
@ -125,10 +125,10 @@ class SendReactionQuery final : public Td::ResultHandler {
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::messages_sendReaction(
|
||||
flags, false /*ignored*/, false /*ignored*/, std::move(input_peer),
|
||||
full_message_id.get_message_id().get_server_message_id().get(),
|
||||
message_full_id.get_message_id().get_server_message_id().get(),
|
||||
transform(reaction_types,
|
||||
[](const ReactionType &reaction_type) { return reaction_type.get_input_reaction(); })),
|
||||
{{dialog_id_}, {full_message_id}}));
|
||||
{{dialog_id_}, {message_full_id}}));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
@ -163,9 +163,9 @@ class GetMessageReactionsListQuery final : public Td::ResultHandler {
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, ReactionType reaction_type, string offset, int32 limit) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
message_id_ = full_message_id.get_message_id();
|
||||
void send(MessageFullId message_full_id, ReactionType reaction_type, string offset, int32 limit) {
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
message_id_ = message_full_id.get_message_id();
|
||||
reaction_type_ = std::move(reaction_type);
|
||||
offset_ = std::move(offset);
|
||||
|
||||
@ -186,7 +186,7 @@ class GetMessageReactionsListQuery final : public Td::ResultHandler {
|
||||
telegram_api::messages_getMessageReactionsList(flags, std::move(input_peer),
|
||||
message_id_.get_server_message_id().get(),
|
||||
reaction_type_.get_input_reaction(), offset_, limit),
|
||||
{{full_message_id}}));
|
||||
{{message_full_id}}));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
@ -871,20 +871,20 @@ void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&me
|
||||
td->create_handler<GetMessagesReactionsQuery>()->send(dialog_id, std::move(message_ids));
|
||||
}
|
||||
|
||||
void send_message_reaction(Td *td, FullMessageId full_message_id, vector<ReactionType> reaction_types, bool is_big,
|
||||
void send_message_reaction(Td *td, MessageFullId message_full_id, vector<ReactionType> reaction_types, bool is_big,
|
||||
bool add_to_recent, Promise<Unit> &&promise) {
|
||||
td->create_handler<SendReactionQuery>(std::move(promise))
|
||||
->send(full_message_id, std::move(reaction_types), is_big, add_to_recent);
|
||||
->send(message_full_id, std::move(reaction_types), is_big, add_to_recent);
|
||||
}
|
||||
|
||||
void get_message_added_reactions(Td *td, FullMessageId full_message_id, ReactionType reaction_type, string offset,
|
||||
void get_message_added_reactions(Td *td, MessageFullId message_full_id, ReactionType reaction_type, string offset,
|
||||
int32 limit, Promise<td_api::object_ptr<td_api::addedReactions>> &&promise) {
|
||||
if (!td->messages_manager_->have_message_force(full_message_id, "get_message_added_reactions")) {
|
||||
if (!td->messages_manager_->have_message_force(message_full_id, "get_message_added_reactions")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
if (full_message_id.get_dialog_id().get_type() == DialogType::SecretChat || !message_id.is_valid() ||
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
if (message_full_id.get_dialog_id().get_type() == DialogType::SecretChat || !message_id.is_valid() ||
|
||||
!message_id.is_server()) {
|
||||
return promise.set_value(td_api::make_object<td_api::addedReactions>(0, Auto(), string()));
|
||||
}
|
||||
@ -898,12 +898,12 @@ void get_message_added_reactions(Td *td, FullMessageId full_message_id, Reaction
|
||||
}
|
||||
|
||||
td->create_handler<GetMessageReactionsListQuery>(std::move(promise))
|
||||
->send(full_message_id, std::move(reaction_type), std::move(offset), limit);
|
||||
->send(message_full_id, std::move(reaction_type), std::move(offset), limit);
|
||||
}
|
||||
|
||||
void report_message_reactions(Td *td, FullMessageId full_message_id, DialogId chooser_dialog_id,
|
||||
void report_message_reactions(Td *td, MessageFullId message_full_id, DialogId chooser_dialog_id,
|
||||
Promise<Unit> &&promise) {
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td->messages_manager_->have_dialog_force(dialog_id, "send_callback_query")) {
|
||||
return promise.set_error(Status::Error(400, "Chat not found"));
|
||||
}
|
||||
@ -914,10 +914,10 @@ void report_message_reactions(Td *td, FullMessageId full_message_id, DialogId ch
|
||||
return promise.set_error(Status::Error(400, "Reactions can't be reported in the chat"));
|
||||
}
|
||||
|
||||
if (!td->messages_manager_->have_message_force(full_message_id, "report_user_reactions")) {
|
||||
if (!td->messages_manager_->have_message_force(message_full_id, "report_user_reactions")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
auto message_id = full_message_id.get_message_id();
|
||||
auto message_id = message_full_id.get_message_id();
|
||||
if (message_id.is_valid_scheduled()) {
|
||||
return promise.set_error(Status::Error(400, "Can't report reactions on scheduled messages"));
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "td/telegram/ChannelId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/MinChannel.h"
|
||||
#include "td/telegram/ReactionType.h"
|
||||
@ -212,13 +212,13 @@ StringBuilder &operator<<(StringBuilder &string_builder, const unique_ptr<Messag
|
||||
|
||||
void reload_message_reactions(Td *td, DialogId dialog_id, vector<MessageId> &&message_ids);
|
||||
|
||||
void send_message_reaction(Td *td, FullMessageId full_message_id, vector<ReactionType> reaction_types, bool is_big,
|
||||
void send_message_reaction(Td *td, MessageFullId message_full_id, vector<ReactionType> reaction_types, bool is_big,
|
||||
bool add_to_recent, Promise<Unit> &&promise);
|
||||
|
||||
void get_message_added_reactions(Td *td, FullMessageId full_message_id, ReactionType reaction_type, string offset,
|
||||
void get_message_added_reactions(Td *td, MessageFullId message_full_id, ReactionType reaction_type, string offset,
|
||||
int32 limit, Promise<td_api::object_ptr<td_api::addedReactions>> &&promise);
|
||||
|
||||
void report_message_reactions(Td *td, FullMessageId full_message_id, DialogId chooser_dialog_id,
|
||||
void report_message_reactions(Td *td, MessageFullId message_full_id, DialogId chooser_dialog_id,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
} // namespace td
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
#include "td/telegram/MessageReplyHeader.h"
|
||||
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/ScheduledServerMessageId.h"
|
||||
#include "td/telegram/ServerMessageId.h"
|
||||
#include "td/telegram/StoryId.h"
|
||||
@ -40,13 +40,13 @@ MessageReplyHeader::MessageReplyHeader(tl_object_ptr<telegram_api::MessageReplyH
|
||||
auto reply_to_peer_id = std::move(reply_header->reply_to_peer_id_);
|
||||
if (reply_to_peer_id != nullptr) {
|
||||
reply_in_dialog_id_ = DialogId(reply_to_peer_id);
|
||||
LOG(ERROR) << "Receive reply to " << FullMessageId{reply_in_dialog_id_, reply_to_message_id_} << " in "
|
||||
<< FullMessageId{dialog_id, message_id};
|
||||
LOG(ERROR) << "Receive reply to " << MessageFullId{reply_in_dialog_id_, reply_to_message_id_} << " in "
|
||||
<< MessageFullId{dialog_id, message_id};
|
||||
reply_to_message_id_ = MessageId();
|
||||
reply_in_dialog_id_ = DialogId();
|
||||
}
|
||||
} else {
|
||||
LOG(ERROR) << "Receive reply to " << reply_to_message_id_ << " in " << FullMessageId{dialog_id, message_id};
|
||||
LOG(ERROR) << "Receive reply to " << reply_to_message_id_ << " in " << MessageFullId{dialog_id, message_id};
|
||||
reply_to_message_id_ = MessageId();
|
||||
}
|
||||
} else {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -26,13 +26,13 @@
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FolderId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/InputDialogId.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/logevent/LogEventHelper.h"
|
||||
#include "td/telegram/MessageContentType.h"
|
||||
#include "td/telegram/MessageCopyOptions.h"
|
||||
#include "td/telegram/MessageDb.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/MessageInputReplyTo.h"
|
||||
#include "td/telegram/MessageLinkInfo.h"
|
||||
@ -249,7 +249,7 @@ class MessagesManager final : public Actor {
|
||||
int32 next_rate, Promise<td_api::object_ptr<td_api::foundMessages>> &&promise);
|
||||
|
||||
// if message is from_update, flags have_previous and have_next are ignored and must be both true
|
||||
FullMessageId on_get_message(tl_object_ptr<telegram_api::Message> message_ptr, bool from_update,
|
||||
MessageFullId on_get_message(tl_object_ptr<telegram_api::Message> message_ptr, bool from_update,
|
||||
bool is_channel_message, bool is_scheduled, const char *source);
|
||||
|
||||
void open_secret_message(SecretChatId secret_chat_id, int64 random_id, Promise<Unit>);
|
||||
@ -280,7 +280,7 @@ class MessagesManager final : public Actor {
|
||||
void on_update_sent_text_message(int64 random_id, tl_object_ptr<telegram_api::MessageMedia> message_media,
|
||||
vector<tl_object_ptr<telegram_api::MessageEntity>> &&entities);
|
||||
|
||||
void delete_pending_message_web_page(FullMessageId full_message_id);
|
||||
void delete_pending_message_web_page(MessageFullId message_full_id);
|
||||
|
||||
void on_get_dialogs(FolderId folder_id, vector<tl_object_ptr<telegram_api::Dialog>> &&dialog_folders,
|
||||
int32 total_count, vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||
@ -348,35 +348,35 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void on_update_channel_too_long(tl_object_ptr<telegram_api::updateChannelTooLong> &&update, bool force_apply);
|
||||
|
||||
void on_update_message_view_count(FullMessageId full_message_id, int32 view_count);
|
||||
void on_update_message_view_count(MessageFullId message_full_id, int32 view_count);
|
||||
|
||||
void on_update_message_forward_count(FullMessageId full_message_id, int32 forward_count);
|
||||
void on_update_message_forward_count(MessageFullId message_full_id, int32 forward_count);
|
||||
|
||||
void on_update_message_reactions(FullMessageId full_message_id,
|
||||
void on_update_message_reactions(MessageFullId message_full_id,
|
||||
tl_object_ptr<telegram_api::messageReactions> &&reactions, Promise<Unit> &&promise);
|
||||
|
||||
void update_message_reactions(FullMessageId full_message_id, unique_ptr<MessageReactions> &&reactions);
|
||||
void update_message_reactions(MessageFullId message_full_id, unique_ptr<MessageReactions> &&reactions);
|
||||
|
||||
void try_reload_message_reactions(DialogId dialog_id, bool is_finished);
|
||||
|
||||
void on_get_message_reaction_list(FullMessageId full_message_id, const ReactionType &reaction_type,
|
||||
void on_get_message_reaction_list(MessageFullId message_full_id, const ReactionType &reaction_type,
|
||||
FlatHashMap<ReactionType, vector<DialogId>, ReactionTypeHash> reaction_types,
|
||||
int32 total_count);
|
||||
|
||||
void on_update_message_interaction_info(FullMessageId full_message_id, int32 view_count, int32 forward_count,
|
||||
void on_update_message_interaction_info(MessageFullId message_full_id, int32 view_count, int32 forward_count,
|
||||
bool has_reply_info,
|
||||
tl_object_ptr<telegram_api::messageReplies> &&reply_info);
|
||||
|
||||
void on_update_live_location_viewed(FullMessageId full_message_id);
|
||||
void on_update_live_location_viewed(MessageFullId message_full_id);
|
||||
|
||||
void on_update_some_live_location_viewed(Promise<Unit> &&promise);
|
||||
|
||||
void on_update_message_extended_media(FullMessageId full_message_id,
|
||||
void on_update_message_extended_media(MessageFullId message_full_id,
|
||||
telegram_api::object_ptr<telegram_api::MessageExtendedMedia> extended_media);
|
||||
|
||||
void on_external_update_message_content(FullMessageId full_message_id);
|
||||
void on_external_update_message_content(MessageFullId message_full_id);
|
||||
|
||||
void on_update_message_content(FullMessageId full_message_id);
|
||||
void on_update_message_content(MessageFullId message_full_id);
|
||||
|
||||
void on_read_channel_inbox(ChannelId channel_id, MessageId max_message_id, int32 server_unread_count, int32 pts,
|
||||
const char *source);
|
||||
@ -489,7 +489,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void set_dialog_message_ttl(DialogId dialog_id, int32 ttl, Promise<Unit> &&promise);
|
||||
|
||||
void share_dialog_with_bot(FullMessageId full_message_id, int32 button_id, DialogId shared_dialog_id,
|
||||
void share_dialog_with_bot(MessageFullId message_full_id, int32 button_id, DialogId shared_dialog_id,
|
||||
bool expect_user, bool only_check, Promise<Unit> &&promise);
|
||||
|
||||
Result<MessageId> add_local_message(DialogId dialog_id, td_api::object_ptr<td_api::MessageSender> &&sender,
|
||||
@ -508,20 +508,20 @@ class MessagesManager final : public Actor {
|
||||
void start_import_messages(DialogId dialog_id, int64 import_id, vector<FileId> &&attached_file_ids,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void edit_message_text(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
void edit_message_text(MessageFullId message_full_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Promise<Unit> &&promise);
|
||||
|
||||
void edit_message_live_location(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
void edit_message_live_location(MessageFullId message_full_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
tl_object_ptr<td_api::location> &&input_location, int32 heading,
|
||||
int32 proximity_alert_radius, Promise<Unit> &&promise);
|
||||
|
||||
void edit_message_media(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
void edit_message_media(MessageFullId message_full_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Promise<Unit> &&promise);
|
||||
|
||||
void edit_message_caption(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
void edit_message_caption(MessageFullId message_full_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
tl_object_ptr<td_api::formattedText> &&input_caption, Promise<Unit> &&promise);
|
||||
|
||||
void edit_message_reply_markup(FullMessageId full_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
void edit_message_reply_markup(MessageFullId message_full_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void edit_inline_message_text(const string &inline_message_id, tl_object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
@ -543,7 +543,7 @@ class MessagesManager final : public Actor {
|
||||
void edit_inline_message_reply_markup(const string &inline_message_id,
|
||||
tl_object_ptr<td_api::ReplyMarkup> &&reply_markup, Promise<Unit> &&promise);
|
||||
|
||||
void edit_message_scheduling_state(FullMessageId full_message_id,
|
||||
void edit_message_scheduling_state(MessageFullId message_full_id,
|
||||
td_api::object_ptr<td_api::MessageSchedulingState> &&scheduling_state,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
@ -644,15 +644,15 @@ class MessagesManager final : public Actor {
|
||||
vector<tl_object_ptr<telegram_api::peerBlocked>> &&blocked_peers,
|
||||
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
||||
|
||||
bool can_get_message_statistics(FullMessageId full_message_id);
|
||||
bool can_get_message_statistics(MessageFullId message_full_id);
|
||||
|
||||
DialogId get_dialog_message_sender(FullMessageId full_message_id);
|
||||
DialogId get_dialog_message_sender(MessageFullId message_full_id);
|
||||
|
||||
bool have_message_force(FullMessageId full_message_id, const char *source);
|
||||
bool have_message_force(MessageFullId message_full_id, const char *source);
|
||||
|
||||
void get_message(FullMessageId full_message_id, Promise<Unit> &&promise);
|
||||
void get_message(MessageFullId message_full_id, Promise<Unit> &&promise);
|
||||
|
||||
FullMessageId get_replied_message(DialogId dialog_id, MessageId message_id, bool force, Promise<Unit> &&promise);
|
||||
MessageFullId get_replied_message(DialogId dialog_id, MessageId message_id, bool force, Promise<Unit> &&promise);
|
||||
|
||||
MessageId get_dialog_pinned_message(DialogId dialog_id, Promise<Unit> &&promise);
|
||||
|
||||
@ -661,10 +661,10 @@ class MessagesManager final : public Actor {
|
||||
|
||||
bool get_messages(DialogId dialog_id, const vector<MessageId> &message_ids, Promise<Unit> &&promise);
|
||||
|
||||
void get_message_from_server(FullMessageId full_message_id, Promise<Unit> &&promise, const char *source,
|
||||
void get_message_from_server(MessageFullId message_full_id, Promise<Unit> &&promise, const char *source,
|
||||
tl_object_ptr<telegram_api::InputMessage> input_message = nullptr);
|
||||
|
||||
void get_messages_from_server(vector<FullMessageId> &&message_ids, Promise<Unit> &&promise, const char *source,
|
||||
void get_messages_from_server(vector<MessageFullId> &&message_ids, Promise<Unit> &&promise, const char *source,
|
||||
tl_object_ptr<telegram_api::InputMessage> input_message = nullptr);
|
||||
|
||||
void get_message_thread(DialogId dialog_id, MessageId message_id, Promise<MessageThreadInfo> &&promise);
|
||||
@ -675,26 +675,26 @@ class MessagesManager final : public Actor {
|
||||
DialogId dialog_id, MessageId message_id, DialogId expected_dialog_id,
|
||||
MessageId expected_message_id, Promise<MessageThreadInfo> promise);
|
||||
|
||||
void get_message_viewers(FullMessageId full_message_id,
|
||||
void get_message_viewers(MessageFullId message_full_id,
|
||||
Promise<td_api::object_ptr<td_api::messageViewers>> &&promise);
|
||||
|
||||
void translate_message_text(FullMessageId full_message_id, const string &to_language_code,
|
||||
void translate_message_text(MessageFullId message_full_id, const string &to_language_code,
|
||||
Promise<td_api::object_ptr<td_api::formattedText>> &&promise);
|
||||
|
||||
void recognize_speech(FullMessageId full_message_id, Promise<Unit> &&promise);
|
||||
void recognize_speech(MessageFullId message_full_id, Promise<Unit> &&promise);
|
||||
|
||||
void rate_speech_recognition(FullMessageId full_message_id, bool is_good, Promise<Unit> &&promise);
|
||||
void rate_speech_recognition(MessageFullId message_full_id, bool is_good, Promise<Unit> &&promise);
|
||||
|
||||
bool is_message_edited_recently(FullMessageId full_message_id, int32 seconds);
|
||||
bool is_message_edited_recently(MessageFullId message_full_id, int32 seconds);
|
||||
|
||||
bool is_deleted_secret_chat(DialogId dialog_id) const;
|
||||
|
||||
Result<std::pair<string, bool>> get_message_link(FullMessageId full_message_id, int32 media_timestamp, bool for_group,
|
||||
Result<std::pair<string, bool>> get_message_link(MessageFullId message_full_id, int32 media_timestamp, bool for_group,
|
||||
bool in_message_thread);
|
||||
|
||||
string get_message_embedding_code(FullMessageId full_message_id, bool for_group, Promise<Unit> &&promise);
|
||||
string get_message_embedding_code(MessageFullId message_full_id, bool for_group, Promise<Unit> &&promise);
|
||||
|
||||
void on_get_public_message_link(FullMessageId full_message_id, bool for_group, string url, string html);
|
||||
void on_get_public_message_link(MessageFullId message_full_id, bool for_group, string url, string html);
|
||||
|
||||
void get_message_link_info(Slice url, Promise<MessageLinkInfo> &&promise);
|
||||
|
||||
@ -754,9 +754,9 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void finish_get_message_extended_media(DialogId dialog_id, const vector<MessageId> &message_ids);
|
||||
|
||||
Status open_message_content(FullMessageId full_message_id) TD_WARN_UNUSED_RESULT;
|
||||
Status open_message_content(MessageFullId message_full_id) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
void click_animated_emoji_message(FullMessageId full_message_id,
|
||||
void click_animated_emoji_message(MessageFullId message_full_id,
|
||||
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
||||
|
||||
StoryNotificationSettings get_story_notification_settings(DialogId dialog_id);
|
||||
@ -813,7 +813,7 @@ class MessagesManager final : public Actor {
|
||||
int64 &random_id, bool use_db, Promise<Unit> &&promise);
|
||||
|
||||
struct FoundMessages {
|
||||
vector<FullMessageId> full_message_ids;
|
||||
vector<MessageFullId> message_full_ids;
|
||||
string next_offset;
|
||||
int32 total_count = 0;
|
||||
};
|
||||
@ -837,7 +837,7 @@ class MessagesManager final : public Actor {
|
||||
void search_dialog_recent_location_messages(DialogId dialog_id, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::messages>> &&promise);
|
||||
|
||||
vector<FullMessageId> get_active_live_location_messages(Promise<Unit> &&promise);
|
||||
vector<MessageFullId> get_active_live_location_messages(Promise<Unit> &&promise);
|
||||
|
||||
int64 get_dialog_message_by_date(DialogId dialog_id, int32 date, Promise<Unit> &&promise);
|
||||
|
||||
@ -859,21 +859,21 @@ class MessagesManager final : public Actor {
|
||||
void get_dialog_message_count(DialogId dialog_id, MessageSearchFilter filter, bool return_local,
|
||||
Promise<int32> &&promise);
|
||||
|
||||
void get_dialog_message_position(FullMessageId full_message_id, MessageSearchFilter filter,
|
||||
void get_dialog_message_position(MessageFullId message_full_id, MessageSearchFilter filter,
|
||||
MessageId top_thread_message_id, Promise<int32> &&promise);
|
||||
|
||||
vector<MessageId> get_dialog_scheduled_messages(DialogId dialog_id, bool force, bool ignore_result,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
Result<td_api::object_ptr<td_api::availableReactions>> get_message_available_reactions(FullMessageId full_message_id,
|
||||
Result<td_api::object_ptr<td_api::availableReactions>> get_message_available_reactions(MessageFullId message_full_id,
|
||||
int32 row_size);
|
||||
|
||||
void add_message_reaction(FullMessageId full_message_id, ReactionType reaction_type, bool is_big, bool add_to_recent,
|
||||
void add_message_reaction(MessageFullId message_full_id, ReactionType reaction_type, bool is_big, bool add_to_recent,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void remove_message_reaction(FullMessageId full_message_id, ReactionType reaction_type, Promise<Unit> &&promise);
|
||||
void remove_message_reaction(MessageFullId message_full_id, ReactionType reaction_type, Promise<Unit> &&promise);
|
||||
|
||||
void get_message_public_forwards(FullMessageId full_message_id, string offset, int32 limit,
|
||||
void get_message_public_forwards(MessageFullId message_full_id, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundMessages>> &&promise);
|
||||
|
||||
tl_object_ptr<td_api::message> get_dialog_message_by_date_object(int64 random_id);
|
||||
@ -881,13 +881,13 @@ class MessagesManager final : public Actor {
|
||||
td_api::object_ptr<td_api::message> get_dialog_event_log_message_object(
|
||||
DialogId dialog_id, tl_object_ptr<telegram_api::Message> &&message, DialogId &sender_dialog_id);
|
||||
|
||||
tl_object_ptr<td_api::message> get_message_object(FullMessageId full_message_id, const char *source);
|
||||
tl_object_ptr<td_api::message> get_message_object(MessageFullId message_full_id, const char *source);
|
||||
|
||||
tl_object_ptr<td_api::messages> get_messages_object(int32 total_count, DialogId dialog_id,
|
||||
const vector<MessageId> &message_ids, bool skip_not_found,
|
||||
const char *source);
|
||||
|
||||
tl_object_ptr<td_api::messages> get_messages_object(int32 total_count, const vector<FullMessageId> &full_message_ids,
|
||||
tl_object_ptr<td_api::messages> get_messages_object(int32 total_count, const vector<MessageFullId> &message_full_ids,
|
||||
bool skip_not_found, const char *source);
|
||||
|
||||
void process_pts_update(tl_object_ptr<telegram_api::Update> &&update_ptr);
|
||||
@ -957,7 +957,7 @@ class MessagesManager final : public Actor {
|
||||
void check_send_message_result(int64 random_id, DialogId dialog_id, const telegram_api::Updates *updates_ptr,
|
||||
const char *source);
|
||||
|
||||
FullMessageId on_send_message_success(int64 random_id, MessageId new_message_id, int32 date, int32 ttl_period,
|
||||
MessageFullId on_send_message_success(int64 random_id, MessageId new_message_id, int32 date, int32 ttl_period,
|
||||
FileId new_file_id, const char *source);
|
||||
|
||||
void on_send_message_file_parts_missing(int64 random_id, vector<int> &&bad_parts);
|
||||
@ -997,7 +997,7 @@ class MessagesManager final : public Actor {
|
||||
vector<tl_object_ptr<telegram_api::User>> users,
|
||||
vector<tl_object_ptr<telegram_api::Chat>> chats);
|
||||
|
||||
FileSourceId get_message_file_source_id(FullMessageId full_message_id, bool force = false);
|
||||
FileSourceId get_message_file_source_id(MessageFullId message_full_id, bool force = false);
|
||||
|
||||
struct MessagePushNotificationInfo {
|
||||
NotificationGroupId group_id;
|
||||
@ -1035,28 +1035,28 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void on_binlog_events(vector<BinlogEvent> &&events);
|
||||
|
||||
void set_poll_answer(FullMessageId full_message_id, vector<int32> &&option_ids, Promise<Unit> &&promise);
|
||||
void set_poll_answer(MessageFullId message_full_id, vector<int32> &&option_ids, Promise<Unit> &&promise);
|
||||
|
||||
void get_poll_voters(FullMessageId full_message_id, int32 option_id, int32 offset, int32 limit,
|
||||
void get_poll_voters(MessageFullId message_full_id, int32 option_id, int32 offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
||||
|
||||
void stop_poll(FullMessageId full_message_id, td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
void stop_poll(MessageFullId message_full_id, td_api::object_ptr<td_api::ReplyMarkup> &&reply_markup,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
Result<string> get_login_button_url(FullMessageId full_message_id, int64 button_id);
|
||||
Result<string> get_login_button_url(MessageFullId message_full_id, int64 button_id);
|
||||
|
||||
Result<ServerMessageId> get_invoice_message_id(FullMessageId full_message_id);
|
||||
Result<ServerMessageId> get_invoice_message_id(MessageFullId message_full_id);
|
||||
|
||||
Result<ServerMessageId> get_payment_successful_message_id(FullMessageId full_message_id);
|
||||
Result<ServerMessageId> get_payment_successful_message_id(MessageFullId message_full_id);
|
||||
|
||||
bool can_set_game_score(FullMessageId full_message_id) const;
|
||||
bool can_set_game_score(MessageFullId message_full_id) const;
|
||||
|
||||
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
|
||||
|
||||
void add_message_file_to_downloads(FullMessageId full_message_id, FileId file_id, int32 priority,
|
||||
void add_message_file_to_downloads(MessageFullId message_full_id, FileId file_id, int32 priority,
|
||||
Promise<td_api::object_ptr<td_api::file>> promise);
|
||||
|
||||
void get_message_file_search_text(FullMessageId full_message_id, string unique_file_id, Promise<string> promise);
|
||||
void get_message_file_search_text(MessageFullId message_full_id, string unique_file_id, Promise<string> promise);
|
||||
|
||||
private:
|
||||
class PendingPtsUpdate {
|
||||
@ -1150,13 +1150,13 @@ class MessagesManager final : public Actor {
|
||||
if (forward_info.sender_dialog_id.is_valid()) {
|
||||
string_builder << ", source ";
|
||||
if (forward_info.message_id.is_valid()) {
|
||||
string_builder << FullMessageId(forward_info.sender_dialog_id, forward_info.message_id);
|
||||
string_builder << MessageFullId(forward_info.sender_dialog_id, forward_info.message_id);
|
||||
} else {
|
||||
string_builder << forward_info.sender_dialog_id;
|
||||
}
|
||||
}
|
||||
if (forward_info.from_dialog_id.is_valid() || forward_info.from_message_id.is_valid()) {
|
||||
string_builder << ", from " << FullMessageId(forward_info.from_dialog_id, forward_info.from_message_id);
|
||||
string_builder << ", from " << MessageFullId(forward_info.from_dialog_id, forward_info.from_message_id);
|
||||
}
|
||||
return string_builder << " at " << forward_info.date << ']';
|
||||
}
|
||||
@ -1805,7 +1805,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void get_dialog_message_count_from_server(DialogId dialog_id, MessageSearchFilter filter, Promise<int32> &&promise);
|
||||
|
||||
FullMessageId on_get_message(MessageInfo &&message_info, const bool from_update, const bool is_channel_message,
|
||||
MessageFullId on_get_message(MessageInfo &&message_info, const bool from_update, const bool is_channel_message,
|
||||
const char *source);
|
||||
|
||||
Result<InputMessageContent> process_input_message_content(
|
||||
@ -1860,7 +1860,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
bool can_report_message_reactions(DialogId dialog_id, const Message *m) const;
|
||||
|
||||
Status can_get_message_viewers(FullMessageId full_message_id) TD_WARN_UNUSED_RESULT;
|
||||
Status can_get_message_viewers(MessageFullId message_full_id) TD_WARN_UNUSED_RESULT;
|
||||
|
||||
Status can_get_message_viewers(DialogId dialog_id, const Message *m) const TD_WARN_UNUSED_RESULT;
|
||||
|
||||
@ -1872,7 +1872,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
MessageId get_persistent_message_id(const Dialog *d, MessageId message_id) const;
|
||||
|
||||
static FullMessageId get_replied_message_id(DialogId dialog_id, const Message *m);
|
||||
static MessageFullId get_replied_message_id(DialogId dialog_id, const Message *m);
|
||||
|
||||
MessageInputReplyTo get_message_input_reply_to(Dialog *d, MessageId top_thread_message_id,
|
||||
td_api::object_ptr<td_api::MessageReplyTo> &&reply_to, bool for_draft);
|
||||
@ -1887,7 +1887,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
bool process_channel_update(tl_object_ptr<telegram_api::Update> &&update_ptr);
|
||||
|
||||
void on_message_edited(FullMessageId full_message_id, int32 pts, bool had_message);
|
||||
void on_message_edited(MessageFullId message_full_id, int32 pts, bool had_message);
|
||||
|
||||
void delete_messages_from_updates(const vector<MessageId> &message_ids, bool is_permanent);
|
||||
|
||||
@ -2118,7 +2118,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void on_pending_message_views_timeout(DialogId dialog_id);
|
||||
|
||||
void update_message_interaction_info(FullMessageId full_message_id, int32 view_count, int32 forward_count,
|
||||
void update_message_interaction_info(MessageFullId message_full_id, int32 view_count, int32 forward_count,
|
||||
bool has_reply_info, tl_object_ptr<telegram_api::messageReplies> &&reply_info,
|
||||
bool has_reactions, unique_ptr<MessageReactions> &&reactions);
|
||||
|
||||
@ -2137,7 +2137,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void on_message_reply_info_changed(DialogId dialog_id, const Message *m) const;
|
||||
|
||||
Result<FullMessageId> get_top_thread_full_message_id(DialogId dialog_id, const Message *m, bool allow_non_root) const;
|
||||
Result<MessageFullId> get_top_thread_message_full_id(DialogId dialog_id, const Message *m, bool allow_non_root) const;
|
||||
|
||||
td_api::object_ptr<td_api::messageInteractionInfo> get_message_interaction_info_object(DialogId dialog_id,
|
||||
const Message *m) const;
|
||||
@ -2255,11 +2255,11 @@ class MessagesManager final : public Actor {
|
||||
|
||||
bool is_message_auto_read(DialogId dialog_id, bool is_outgoing) const;
|
||||
|
||||
void fail_send_message(FullMessageId full_message_id, int32 error_code, const string &error_message);
|
||||
void fail_send_message(MessageFullId message_full_id, int32 error_code, const string &error_message);
|
||||
|
||||
void fail_send_message(FullMessageId full_message_id, Status error);
|
||||
void fail_send_message(MessageFullId message_full_id, Status error);
|
||||
|
||||
void fail_edit_message_media(FullMessageId full_message_id, Status &&error);
|
||||
void fail_edit_message_media(MessageFullId message_full_id, Status &&error);
|
||||
|
||||
void on_dialog_updated(DialogId dialog_id, const char *source);
|
||||
|
||||
@ -2318,7 +2318,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void on_message_notification_changed(Dialog *d, const Message *m, const char *source);
|
||||
|
||||
bool need_delete_file(FullMessageId full_message_id, FileId file_id) const;
|
||||
bool need_delete_file(MessageFullId message_full_id, FileId file_id) const;
|
||||
|
||||
bool need_delete_message_files(DialogId dialog_id, const Message *m) const;
|
||||
|
||||
@ -2457,7 +2457,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void send_update_message_unread_reactions(DialogId dialog_id, const Message *m, int32 unread_reaction_count) const;
|
||||
|
||||
void send_update_message_live_location_viewed(FullMessageId full_message_id);
|
||||
void send_update_message_live_location_viewed(MessageFullId message_full_id);
|
||||
|
||||
void send_update_delete_messages(DialogId dialog_id, vector<int64> &&message_ids, bool is_permanent) const;
|
||||
|
||||
@ -2674,7 +2674,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void set_message_reactions(Dialog *d, Message *m, bool is_big, bool add_to_recent, Promise<Unit> &&promise);
|
||||
|
||||
void on_set_message_reactions(FullMessageId full_message_id, Result<Unit> result, Promise<Unit> promise);
|
||||
void on_set_message_reactions(MessageFullId message_full_id, Result<Unit> result, Promise<Unit> promise);
|
||||
|
||||
void on_read_message_reactions(DialogId dialog_id, vector<MessageId> &&message_ids, Result<Unit> &&result);
|
||||
|
||||
@ -2694,7 +2694,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
static bool need_poll_message_reactions(const Dialog *d, const Message *m);
|
||||
|
||||
void queue_message_reactions_reload(FullMessageId full_message_id);
|
||||
void queue_message_reactions_reload(MessageFullId message_full_id);
|
||||
|
||||
void queue_message_reactions_reload(DialogId dialog_id, const vector<MessageId> &message_ids);
|
||||
|
||||
@ -2803,14 +2803,14 @@ class MessagesManager final : public Actor {
|
||||
static const Message *get_message(const Dialog *d, MessageId message_id);
|
||||
static const Message *get_message_static(const Dialog *d, MessageId message_id);
|
||||
|
||||
Message *get_message(FullMessageId full_message_id);
|
||||
const Message *get_message(FullMessageId full_message_id) const;
|
||||
Message *get_message(MessageFullId message_full_id);
|
||||
const Message *get_message(MessageFullId message_full_id) const;
|
||||
|
||||
bool have_message_force(Dialog *d, MessageId message_id, const char *source);
|
||||
|
||||
Message *get_message_force(Dialog *d, MessageId message_id, const char *source);
|
||||
|
||||
Message *get_message_force(FullMessageId full_message_id, const char *source);
|
||||
Message *get_message_force(MessageFullId message_full_id, const char *source);
|
||||
|
||||
void get_message_force_from_server(Dialog *d, MessageId message_id, Promise<Unit> &&promise,
|
||||
tl_object_ptr<telegram_api::InputMessage> input_message = nullptr);
|
||||
@ -2867,7 +2867,7 @@ class MessagesManager final : public Actor {
|
||||
static bool is_forward_info_sender_hidden(const MessageForwardInfo *forward_info);
|
||||
|
||||
unique_ptr<MessageForwardInfo> get_message_forward_info(
|
||||
tl_object_ptr<telegram_api::messageFwdHeader> &&forward_header, FullMessageId full_message_id);
|
||||
tl_object_ptr<telegram_api::messageFwdHeader> &&forward_header, MessageFullId message_full_id);
|
||||
|
||||
td_api::object_ptr<td_api::messageForwardInfo> get_message_forward_info_object(
|
||||
const unique_ptr<MessageForwardInfo> &forward_info) const;
|
||||
@ -2905,7 +2905,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void ttl_db_on_result(Result<std::vector<MessageDbMessage>> r_result, bool dummy);
|
||||
|
||||
void on_restore_missing_message_after_get_difference(FullMessageId full_message_id, MessageId old_message_id,
|
||||
void on_restore_missing_message_after_get_difference(MessageFullId message_full_id, MessageId old_message_id,
|
||||
Result<Unit> result);
|
||||
|
||||
void on_get_message_link_dialog(MessageLinkInfo &&info, DialogId dialog_id, Promise<MessageLinkInfo> &&promise);
|
||||
@ -2942,13 +2942,13 @@ class MessagesManager final : public Actor {
|
||||
void on_message_db_calls_result(Result<MessageDbCallsResult> result, int64 random_id, MessageId first_db_message_id,
|
||||
MessageSearchFilter filter, Promise<Unit> &&promise);
|
||||
|
||||
void on_load_active_live_location_full_message_ids_from_database(string value);
|
||||
void on_load_active_live_location_message_full_ids_from_database(string value);
|
||||
|
||||
void on_load_active_live_location_messages_finished();
|
||||
|
||||
void try_add_active_live_location(DialogId dialog_id, const Message *m);
|
||||
|
||||
void add_active_live_location(FullMessageId full_message_id);
|
||||
void add_active_live_location(MessageFullId message_full_id);
|
||||
|
||||
bool delete_active_live_location(DialogId dialog_id, const Message *m);
|
||||
|
||||
@ -2958,7 +2958,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
void view_message_live_location_on_server(int64 task_id);
|
||||
|
||||
void view_message_live_location_on_server_impl(int64 task_id, FullMessageId full_message_id);
|
||||
void view_message_live_location_on_server_impl(int64 task_id, MessageFullId message_full_id);
|
||||
|
||||
void on_message_live_location_viewed_on_server(int64 task_id);
|
||||
|
||||
@ -3149,7 +3149,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
Status can_import_messages(DialogId dialog_id);
|
||||
|
||||
void send_get_message_public_forwards_query(DcId dc_id, FullMessageId full_message_id, string offset, int32 limit,
|
||||
void send_get_message_public_forwards_query(DcId dc_id, MessageFullId message_full_id, string offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::foundMessages>> &&promise);
|
||||
|
||||
void add_sponsored_dialog(const Dialog *d, DialogSource source);
|
||||
@ -3297,16 +3297,16 @@ class MessagesManager final : public Actor {
|
||||
|
||||
double last_channel_pts_jump_warning_time_ = 0;
|
||||
|
||||
FlatHashMap<FileId, std::pair<FullMessageId, FileId>, FileIdHash>
|
||||
FlatHashMap<FileId, std::pair<MessageFullId, FileId>, FileIdHash>
|
||||
being_uploaded_files_; // file_id -> message, thumbnail_file_id
|
||||
struct UploadedThumbnailInfo {
|
||||
FullMessageId full_message_id;
|
||||
MessageFullId message_full_id;
|
||||
FileId file_id; // original file file_id
|
||||
tl_object_ptr<telegram_api::InputFile> input_file; // original file InputFile
|
||||
};
|
||||
FlatHashMap<FileId, UploadedThumbnailInfo, FileIdHash> being_uploaded_thumbnails_; // thumbnail_file_id -> ...
|
||||
struct UploadedSecretThumbnailInfo {
|
||||
FullMessageId full_message_id;
|
||||
MessageFullId message_full_id;
|
||||
FileId file_id; // original file file_id
|
||||
tl_object_ptr<telegram_api::InputEncryptedFile> input_file; // original file InputEncryptedFile
|
||||
};
|
||||
@ -3317,10 +3317,10 @@ class MessagesManager final : public Actor {
|
||||
class TtlNode final : private HeapNode {
|
||||
public:
|
||||
TtlNode(DialogId dialog_id, MessageId message_id, bool by_ttl_period)
|
||||
: full_message_id_(dialog_id, message_id), by_ttl_period_(by_ttl_period) {
|
||||
: message_full_id_(dialog_id, message_id), by_ttl_period_(by_ttl_period) {
|
||||
}
|
||||
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
bool by_ttl_period_;
|
||||
|
||||
HeapNode *as_heap_node() const {
|
||||
@ -3331,12 +3331,12 @@ class MessagesManager final : public Actor {
|
||||
}
|
||||
|
||||
bool operator==(const TtlNode &other) const {
|
||||
return full_message_id_ == other.full_message_id_;
|
||||
return message_full_id_ == other.message_full_id_;
|
||||
}
|
||||
};
|
||||
struct TtlNodeHash {
|
||||
uint32 operator()(const TtlNode &ttl_node) const {
|
||||
return FullMessageIdHash()(ttl_node.full_message_id_) * 2 + static_cast<uint32>(ttl_node.by_ttl_period_);
|
||||
return MessageFullIdHash()(ttl_node.message_full_id_) * 2 + static_cast<uint32>(ttl_node.by_ttl_period_);
|
||||
}
|
||||
};
|
||||
std::unordered_set<TtlNode, TtlNodeHash> ttl_nodes_;
|
||||
@ -3349,9 +3349,9 @@ class MessagesManager final : public Actor {
|
||||
bool ttl_db_has_query_ = false;
|
||||
Slot ttl_db_slot_;
|
||||
|
||||
FlatHashMap<int64, FullMessageId> being_sent_messages_; // message_random_id -> message
|
||||
FlatHashMap<int64, MessageFullId> being_sent_messages_; // message_random_id -> message
|
||||
|
||||
FlatHashMap<FullMessageId, MessageId, FullMessageIdHash> update_message_ids_; // new_message_id -> temporary_id
|
||||
FlatHashMap<MessageFullId, MessageId, MessageFullIdHash> update_message_ids_; // new_message_id -> temporary_id
|
||||
FlatHashMap<DialogId, FlatHashMap<ScheduledServerMessageId, MessageId, ScheduledServerMessageIdHash>,
|
||||
DialogIdHash>
|
||||
update_scheduled_message_ids_; // new_message_id -> temporary_id
|
||||
@ -3454,7 +3454,7 @@ class MessagesManager final : public Actor {
|
||||
};
|
||||
FlatHashMap<UserId, CommonDialogs, UserIdHash> found_common_dialogs_;
|
||||
|
||||
FlatHashMap<int64, FullMessageId> get_dialog_message_by_date_results_;
|
||||
FlatHashMap<int64, MessageFullId> get_dialog_message_by_date_results_;
|
||||
|
||||
FlatHashMap<int64, td_api::object_ptr<td_api::messageCalendar>> found_dialog_message_calendars_;
|
||||
FlatHashMap<int64, FoundDialogMessages> found_dialog_messages_; // random_id -> FoundDialogMessages
|
||||
@ -3472,15 +3472,15 @@ class MessagesManager final : public Actor {
|
||||
FlatHashMap<DialogId, vector<Promise<Unit>>, DialogIdHash> get_dialog_queries_;
|
||||
FlatHashMap<DialogId, uint64, DialogIdHash> get_dialog_query_log_event_id_;
|
||||
|
||||
FlatHashMap<FullMessageId, int32, FullMessageIdHash> replied_by_yet_unsent_messages_;
|
||||
FlatHashMap<FullMessageId, FlatHashSet<MessageId, MessageIdHash>, FullMessageIdHash> replied_yet_unsent_messages_;
|
||||
FlatHashMap<MessageFullId, int32, MessageFullIdHash> replied_by_yet_unsent_messages_;
|
||||
FlatHashMap<MessageFullId, FlatHashSet<MessageId, MessageIdHash>, MessageFullIdHash> replied_yet_unsent_messages_;
|
||||
|
||||
// full_message_id -> replies with media timestamps
|
||||
FlatHashMap<FullMessageId, FlatHashSet<FullMessageId, FullMessageIdHash>, FullMessageIdHash>
|
||||
// message_full_id -> replies with media timestamps
|
||||
FlatHashMap<MessageFullId, FlatHashSet<MessageFullId, MessageFullIdHash>, MessageFullIdHash>
|
||||
message_to_replied_media_timestamp_messages_;
|
||||
|
||||
// story_full_id -> replies with media timestamps
|
||||
FlatHashMap<StoryFullId, FlatHashSet<FullMessageId, FullMessageIdHash>, StoryFullIdHash>
|
||||
FlatHashMap<StoryFullId, FlatHashSet<MessageFullId, MessageFullIdHash>, StoryFullIdHash>
|
||||
story_to_replied_media_timestamp_messages_;
|
||||
|
||||
struct ActiveDialogAction {
|
||||
@ -3560,7 +3560,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
Hints dialogs_hints_; // search dialogs by title and usernames
|
||||
|
||||
FlatHashSet<FullMessageId, FullMessageIdHash> active_live_location_full_message_ids_;
|
||||
FlatHashSet<MessageFullId, MessageFullIdHash> active_live_location_message_full_ids_;
|
||||
bool are_active_live_location_messages_loaded_ = false;
|
||||
vector<Promise<Unit>> load_active_live_location_messages_queries_;
|
||||
|
||||
@ -3637,7 +3637,7 @@ class MessagesManager final : public Actor {
|
||||
CallsDbState calls_db_state_;
|
||||
|
||||
int64 viewed_live_location_task_id_ = 0;
|
||||
FlatHashMap<int64, FullMessageId> viewed_live_location_tasks_; // task_id -> task
|
||||
FlatHashMap<int64, MessageFullId> viewed_live_location_tasks_; // task_id -> task
|
||||
FlatHashMap<DialogId, FlatHashMap<MessageId, int64, MessageIdHash>, DialogIdHash>
|
||||
pending_viewed_live_locations_; // ... -> task_id
|
||||
|
||||
@ -3649,7 +3649,7 @@ class MessagesManager final : public Actor {
|
||||
|
||||
FlatHashMap<DialogId, NetQueryRef, DialogIdHash> set_typing_query_;
|
||||
|
||||
WaitFreeHashMap<FullMessageId, FileSourceId, FullMessageIdHash> full_message_id_to_file_source_id_;
|
||||
WaitFreeHashMap<MessageFullId, FileSourceId, MessageFullIdHash> message_full_id_to_file_source_id_;
|
||||
|
||||
FlatHashMap<DialogId, int32, DialogIdHash> last_outgoing_forwarded_message_date_;
|
||||
|
||||
@ -3679,8 +3679,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
FlatHashMap<DialogId, MessageId, DialogIdHash> previous_repaired_read_inbox_max_message_id_;
|
||||
|
||||
FlatHashMap<FullMessageId, MessageId, FullMessageIdHash> yet_unsent_full_message_id_to_persistent_message_id_;
|
||||
FlatHashMap<FullMessageId, std::set<MessageId>, FullMessageIdHash>
|
||||
FlatHashMap<MessageFullId, MessageId, MessageFullIdHash> yet_unsent_message_full_id_to_persistent_message_id_;
|
||||
FlatHashMap<MessageFullId, std::set<MessageId>, MessageFullIdHash>
|
||||
yet_unsent_thread_message_ids_; // {dialog_id, top_thread_message_id} -> yet unsent message IDs
|
||||
|
||||
FlatHashMap<DialogId, unique_ptr<SuffixLoadQueries>, DialogIdHash> dialog_suffix_load_queries_;
|
||||
@ -3700,9 +3700,9 @@ class MessagesManager final : public Actor {
|
||||
int32 query_count = 0;
|
||||
bool was_updated = false;
|
||||
};
|
||||
FlatHashMap<FullMessageId, PendingReaction, FullMessageIdHash> pending_reactions_;
|
||||
FlatHashMap<MessageFullId, PendingReaction, MessageFullIdHash> pending_reactions_;
|
||||
|
||||
FlatHashMap<FullMessageId, int32, FullMessageIdHash> pending_read_reactions_;
|
||||
FlatHashMap<MessageFullId, int32, MessageFullIdHash> pending_read_reactions_;
|
||||
|
||||
vector<ReactionType> active_reaction_types_;
|
||||
FlatHashMap<ReactionType, size_t, ReactionTypeHash> active_reaction_pos_;
|
||||
@ -3717,7 +3717,7 @@ class MessagesManager final : public Actor {
|
||||
DialogId sponsored_dialog_id_;
|
||||
DialogSource sponsored_dialog_source_;
|
||||
|
||||
FullMessageId being_readded_message_id_;
|
||||
MessageFullId being_readded_message_id_;
|
||||
|
||||
DialogId being_added_dialog_id_;
|
||||
DialogId being_added_by_new_message_dialog_id_;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "td/telegram/DialogNotificationSettings.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/NotificationSettingsScope.h"
|
||||
#include "td/telegram/ScopeNotificationSettings.h"
|
||||
@ -225,7 +225,7 @@ class NotificationSettingsManager final : public Actor {
|
||||
vector<Promise<Unit>> reload_saved_ringtones_queries_;
|
||||
vector<Promise<Unit>> repair_saved_ringtones_queries_;
|
||||
|
||||
FlatHashMap<FullMessageId, vector<Promise<Unit>>, FullMessageIdHash> get_dialog_notification_settings_queries_;
|
||||
FlatHashMap<MessageFullId, vector<Promise<Unit>>, MessageFullIdHash> get_dialog_notification_settings_queries_;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
@ -863,12 +863,12 @@ void send_payment_form(Td *td, td_api::object_ptr<td_api::InputInvoice> &&input_
|
||||
std::move(input_credentials), tip_amount);
|
||||
}
|
||||
|
||||
void get_payment_receipt(Td *td, FullMessageId full_message_id,
|
||||
void get_payment_receipt(Td *td, MessageFullId message_full_id,
|
||||
Promise<tl_object_ptr<td_api::paymentReceipt>> &&promise) {
|
||||
TRY_RESULT_PROMISE(promise, server_message_id,
|
||||
td->messages_manager_->get_payment_successful_message_id(full_message_id));
|
||||
td->messages_manager_->get_payment_successful_message_id(message_full_id));
|
||||
td->create_handler<GetPaymentReceiptQuery>(std::move(promise))
|
||||
->send(full_message_id.get_dialog_id(), server_message_id);
|
||||
->send(message_full_id.get_dialog_id(), server_message_id);
|
||||
}
|
||||
|
||||
void get_saved_order_info(Td *td, Promise<tl_object_ptr<td_api::orderInfo>> &&promise) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
@ -37,7 +37,7 @@ void send_payment_form(Td *td, td_api::object_ptr<td_api::InputInvoice> &&input_
|
||||
const td_api::object_ptr<td_api::InputCredentials> &credentials, int64 tip_amount,
|
||||
Promise<td_api::object_ptr<td_api::paymentResult>> &&promise);
|
||||
|
||||
void get_payment_receipt(Td *td, FullMessageId full_message_id,
|
||||
void get_payment_receipt(Td *td, MessageFullId message_full_id,
|
||||
Promise<tl_object_ptr<td_api::paymentReceipt>> &&promise);
|
||||
|
||||
void get_saved_order_info(Td *td, Promise<tl_object_ptr<td_api::orderInfo>> &&promise);
|
||||
|
@ -57,10 +57,10 @@ class GetPollResultsQuery final : public Td::ResultHandler {
|
||||
explicit GetPollResultsQuery(Promise<tl_object_ptr<telegram_api::Updates>> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(PollId poll_id, FullMessageId full_message_id) {
|
||||
void send(PollId poll_id, MessageFullId message_full_id) {
|
||||
poll_id_ = poll_id;
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
message_id_ = full_message_id.get_message_id();
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
message_id_ = message_full_id.get_message_id();
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
if (input_peer == nullptr) {
|
||||
LOG(INFO) << "Can't reget poll, because have no read access to " << dialog_id_;
|
||||
@ -105,9 +105,9 @@ class GetPollVotersQuery final : public Td::ResultHandler {
|
||||
: promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(PollId poll_id, FullMessageId full_message_id, BufferSlice &&option, const string &offset, int32 limit) {
|
||||
void send(PollId poll_id, MessageFullId message_full_id, BufferSlice &&option, const string &offset, int32 limit) {
|
||||
poll_id_ = poll_id;
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
if (input_peer == nullptr) {
|
||||
LOG(INFO) << "Can't get poll, because have no read access to " << dialog_id_;
|
||||
@ -120,7 +120,7 @@ class GetPollVotersQuery final : public Td::ResultHandler {
|
||||
flags |= telegram_api::messages_getPollVotes::OFFSET_MASK;
|
||||
}
|
||||
|
||||
auto message_id = full_message_id.get_message_id().get_server_message_id().get();
|
||||
auto message_id = message_full_id.get_message_id().get_server_message_id().get();
|
||||
send_query(G()->net_query_creator().create(telegram_api::messages_getPollVotes(
|
||||
flags, std::move(input_peer), message_id, std::move(option), offset, limit)));
|
||||
}
|
||||
@ -151,16 +151,16 @@ class SendVoteQuery final : public Td::ResultHandler {
|
||||
explicit SendVoteQuery(Promise<tl_object_ptr<telegram_api::Updates>> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, vector<BufferSlice> &&options, PollId poll_id, uint64 generation,
|
||||
void send(MessageFullId message_full_id, vector<BufferSlice> &&options, PollId poll_id, uint64 generation,
|
||||
NetQueryRef *query_ref) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
if (input_peer == nullptr) {
|
||||
LOG(INFO) << "Can't set poll answer, because have no read access to " << dialog_id_;
|
||||
return on_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
|
||||
auto message_id = full_message_id.get_message_id().get_server_message_id().get();
|
||||
auto message_id = message_full_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}, {dialog_id_}});
|
||||
@ -193,8 +193,8 @@ class StopPollQuery final : public Td::ResultHandler {
|
||||
explicit StopPollQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, unique_ptr<ReplyMarkup> &&reply_markup, PollId poll_id) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
void send(MessageFullId message_full_id, unique_ptr<ReplyMarkup> &&reply_markup, PollId poll_id) {
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Edit);
|
||||
if (input_peer == nullptr) {
|
||||
LOG(INFO) << "Can't close poll, because have no edit access to " << dialog_id_;
|
||||
@ -207,7 +207,7 @@ class StopPollQuery final : public Td::ResultHandler {
|
||||
flags |= telegram_api::messages_editMessage::REPLY_MARKUP_MASK;
|
||||
}
|
||||
|
||||
auto message_id = full_message_id.get_message_id().get_server_message_id().get();
|
||||
auto message_id = message_full_id.get_message_id().get_server_message_id().get();
|
||||
auto poll = telegram_api::make_object<telegram_api::poll>();
|
||||
poll->flags_ |= telegram_api::poll::CLOSED_MASK;
|
||||
auto input_media = telegram_api::make_object<telegram_api::inputMediaPoll>(0, std::move(poll),
|
||||
@ -338,14 +338,14 @@ void PollManager::notify_on_poll_update(PollId poll_id) {
|
||||
}
|
||||
|
||||
if (server_poll_messages_.count(poll_id) > 0) {
|
||||
server_poll_messages_[poll_id].foreach([&](const FullMessageId &full_message_id) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
server_poll_messages_[poll_id].foreach([&](const MessageFullId &message_full_id) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
});
|
||||
}
|
||||
|
||||
if (other_poll_messages_.count(poll_id) > 0) {
|
||||
other_poll_messages_[poll_id].foreach([&](const FullMessageId &full_message_id) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
other_poll_messages_[poll_id].foreach([&](const MessageFullId &message_full_id) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -668,17 +668,17 @@ PollId PollManager::create_poll(string &&question, vector<string> &&options, boo
|
||||
return poll_id;
|
||||
}
|
||||
|
||||
void PollManager::register_poll(PollId poll_id, FullMessageId full_message_id, const char *source) {
|
||||
void PollManager::register_poll(PollId poll_id, MessageFullId message_full_id, const char *source) {
|
||||
CHECK(have_poll(poll_id));
|
||||
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server()) {
|
||||
other_poll_messages_[poll_id].insert(full_message_id);
|
||||
if (message_full_id.get_message_id().is_scheduled() || !message_full_id.get_message_id().is_server()) {
|
||||
other_poll_messages_[poll_id].insert(message_full_id);
|
||||
if (!G()->close_flag()) {
|
||||
unload_poll_timeout_.cancel_timeout(poll_id.get());
|
||||
}
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "Register " << poll_id << " from " << full_message_id << " from " << source;
|
||||
server_poll_messages_[poll_id].insert(full_message_id);
|
||||
LOG(INFO) << "Register " << poll_id << " from " << message_full_id << " from " << source;
|
||||
server_poll_messages_[poll_id].insert(message_full_id);
|
||||
auto poll = get_poll(poll_id);
|
||||
CHECK(poll != nullptr);
|
||||
if (!td_->auth_manager_->is_bot() && !is_local_poll_id(poll_id) &&
|
||||
@ -690,12 +690,12 @@ void PollManager::register_poll(PollId poll_id, FullMessageId full_message_id, c
|
||||
}
|
||||
}
|
||||
|
||||
void PollManager::unregister_poll(PollId poll_id, FullMessageId full_message_id, const char *source) {
|
||||
void PollManager::unregister_poll(PollId poll_id, MessageFullId message_full_id, const char *source) {
|
||||
CHECK(have_poll(poll_id));
|
||||
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server()) {
|
||||
if (message_full_id.get_message_id().is_scheduled() || !message_full_id.get_message_id().is_server()) {
|
||||
auto &message_ids = other_poll_messages_[poll_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << poll_id << ' ' << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << poll_id << ' ' << message_full_id;
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
CHECK(message_ids.empty());
|
||||
forget_local_poll(poll_id);
|
||||
@ -707,10 +707,10 @@ void PollManager::unregister_poll(PollId poll_id, FullMessageId full_message_id,
|
||||
}
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "Unregister " << poll_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Unregister " << poll_id << " from " << message_full_id << " from " << source;
|
||||
auto &message_ids = server_poll_messages_[poll_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << poll_id << ' ' << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << poll_id << ' ' << message_full_id;
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
CHECK(message_ids.empty());
|
||||
forget_local_poll(poll_id);
|
||||
@ -777,7 +777,7 @@ string PollManager::get_poll_search_text(PollId poll_id) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
void PollManager::set_poll_answer(PollId poll_id, FullMessageId full_message_id, vector<int32> &&option_ids,
|
||||
void PollManager::set_poll_answer(PollId poll_id, MessageFullId message_full_id, vector<int32> &&option_ids,
|
||||
Promise<Unit> &&promise) {
|
||||
td::unique(option_ids);
|
||||
|
||||
@ -825,35 +825,35 @@ void PollManager::set_poll_answer(PollId poll_id, FullMessageId full_message_id,
|
||||
}
|
||||
}
|
||||
|
||||
do_set_poll_answer(poll_id, full_message_id, std::move(options), 0, std::move(promise));
|
||||
do_set_poll_answer(poll_id, message_full_id, std::move(options), 0, std::move(promise));
|
||||
}
|
||||
|
||||
class PollManager::SetPollAnswerLogEvent {
|
||||
public:
|
||||
PollId poll_id_;
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
vector<string> options_;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const {
|
||||
td::store(poll_id_, storer);
|
||||
td::store(full_message_id_, storer);
|
||||
td::store(message_full_id_, storer);
|
||||
td::store(options_, storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void parse(ParserT &parser) {
|
||||
td::parse(poll_id_, parser);
|
||||
td::parse(full_message_id_, parser);
|
||||
td::parse(message_full_id_, parser);
|
||||
td::parse(options_, parser);
|
||||
}
|
||||
};
|
||||
|
||||
void PollManager::do_set_poll_answer(PollId poll_id, FullMessageId full_message_id, vector<string> &&options,
|
||||
void PollManager::do_set_poll_answer(PollId poll_id, MessageFullId message_full_id, vector<string> &&options,
|
||||
uint64 log_event_id, Promise<Unit> &&promise) {
|
||||
LOG(INFO) << "Set answer in " << poll_id << " from " << full_message_id;
|
||||
if (!poll_id.is_valid() || !full_message_id.get_dialog_id().is_valid() ||
|
||||
!full_message_id.get_message_id().is_valid()) {
|
||||
LOG(INFO) << "Set answer in " << poll_id << " from " << message_full_id;
|
||||
if (!poll_id.is_valid() || !message_full_id.get_dialog_id().is_valid() ||
|
||||
!message_full_id.get_message_id().is_valid()) {
|
||||
CHECK(log_event_id != 0);
|
||||
LOG(ERROR) << "Invalid SetPollAnswer log event";
|
||||
binlog_erase(G()->td_db()->get_binlog(), log_event_id);
|
||||
@ -877,7 +877,7 @@ void PollManager::do_set_poll_answer(PollId poll_id, FullMessageId full_message_
|
||||
if (log_event_id == 0 && G()->use_message_database()) {
|
||||
SetPollAnswerLogEvent log_event;
|
||||
log_event.poll_id_ = poll_id;
|
||||
log_event.full_message_id_ = full_message_id;
|
||||
log_event.message_full_id_ = message_full_id;
|
||||
log_event.options_ = options;
|
||||
auto storer = get_log_event_storer(log_event);
|
||||
if (pending_answer.generation_ == 0) {
|
||||
@ -925,7 +925,7 @@ void PollManager::do_set_poll_answer(PollId poll_id, FullMessageId full_message_
|
||||
send_closure(actor_id, &PollManager::on_set_poll_answer, poll_id, generation, std::move(result));
|
||||
});
|
||||
td_->create_handler<SendVoteQuery>(std::move(query_promise))
|
||||
->send(full_message_id, std::move(sent_options), poll_id, generation, &pending_answer.query_ref_);
|
||||
->send(message_full_id, std::move(sent_options), poll_id, generation, &pending_answer.query_ref_);
|
||||
}
|
||||
|
||||
void PollManager::on_set_poll_answer(PollId poll_id, uint64 generation,
|
||||
@ -1063,7 +1063,7 @@ td_api::object_ptr<td_api::messageSenders> PollManager::get_poll_voters_object(
|
||||
return result;
|
||||
}
|
||||
|
||||
void PollManager::get_poll_voters(PollId poll_id, FullMessageId full_message_id, int32 option_id, int32 offset,
|
||||
void PollManager::get_poll_voters(PollId poll_id, MessageFullId message_full_id, int32 option_id, int32 offset,
|
||||
int32 limit, Promise<td_api::object_ptr<td_api::messageSenders>> &&promise) {
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
return promise.set_error(Status::Error(400, "Poll results can't be received"));
|
||||
@ -1126,7 +1126,7 @@ void PollManager::get_poll_voters(PollId poll_id, FullMessageId full_message_id,
|
||||
std::move(result));
|
||||
});
|
||||
td_->create_handler<GetPollVotersQuery>(std::move(query_promise))
|
||||
->send(poll_id, full_message_id, BufferSlice(poll->options_[option_id].data_), voters.next_offset_,
|
||||
->send(poll_id, message_full_id, BufferSlice(poll->options_[option_id].data_), voters.next_offset_,
|
||||
max(limit, 10));
|
||||
}
|
||||
|
||||
@ -1223,10 +1223,10 @@ void PollManager::on_get_poll_voters(PollId poll_id, int32 option_id, string off
|
||||
}
|
||||
}
|
||||
|
||||
void PollManager::stop_poll(PollId poll_id, FullMessageId full_message_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
void PollManager::stop_poll(PollId poll_id, MessageFullId message_full_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
Promise<Unit> &&promise) {
|
||||
if (is_local_poll_id(poll_id)) {
|
||||
LOG(ERROR) << "Receive local " << poll_id << " from " << full_message_id << " in stop_poll";
|
||||
LOG(ERROR) << "Receive local " << poll_id << " from " << message_full_id << " in stop_poll";
|
||||
stop_local_poll(poll_id);
|
||||
promise.set_value(Unit());
|
||||
return;
|
||||
@ -1244,34 +1244,34 @@ void PollManager::stop_poll(PollId poll_id, FullMessageId full_message_id, uniqu
|
||||
save_poll(poll, poll_id);
|
||||
notify_on_poll_update(poll_id);
|
||||
|
||||
do_stop_poll(poll_id, full_message_id, std::move(reply_markup), 0, std::move(promise));
|
||||
do_stop_poll(poll_id, message_full_id, std::move(reply_markup), 0, std::move(promise));
|
||||
}
|
||||
|
||||
class PollManager::StopPollLogEvent {
|
||||
public:
|
||||
PollId poll_id_;
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
|
||||
template <class StorerT>
|
||||
void store(StorerT &storer) const {
|
||||
td::store(poll_id_, storer);
|
||||
td::store(full_message_id_, storer);
|
||||
td::store(message_full_id_, storer);
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
void parse(ParserT &parser) {
|
||||
td::parse(poll_id_, parser);
|
||||
td::parse(full_message_id_, parser);
|
||||
td::parse(message_full_id_, parser);
|
||||
}
|
||||
};
|
||||
|
||||
void PollManager::do_stop_poll(PollId poll_id, FullMessageId full_message_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
void PollManager::do_stop_poll(PollId poll_id, MessageFullId message_full_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
uint64 log_event_id, Promise<Unit> &&promise) {
|
||||
LOG(INFO) << "Stop " << poll_id << " from " << full_message_id;
|
||||
LOG(INFO) << "Stop " << poll_id << " from " << message_full_id;
|
||||
CHECK(poll_id.is_valid());
|
||||
|
||||
if (log_event_id == 0 && G()->use_message_database() && reply_markup == nullptr) {
|
||||
StopPollLogEvent log_event{poll_id, full_message_id};
|
||||
StopPollLogEvent log_event{poll_id, message_full_id};
|
||||
log_event_id =
|
||||
binlog_add(G()->td_db()->get_binlog(), LogEvent::HandlerType::StopPoll, get_log_event_storer(log_event));
|
||||
}
|
||||
@ -1280,16 +1280,16 @@ void PollManager::do_stop_poll(PollId poll_id, FullMessageId full_message_id, un
|
||||
|
||||
bool is_inserted = being_closed_polls_.insert(poll_id).second;
|
||||
CHECK(is_inserted);
|
||||
auto new_promise = PromiseCreator::lambda([actor_id = actor_id(this), poll_id, full_message_id, log_event_id,
|
||||
auto new_promise = PromiseCreator::lambda([actor_id = actor_id(this), poll_id, message_full_id, log_event_id,
|
||||
promise = std::move(promise)](Result<Unit> result) mutable {
|
||||
send_closure(actor_id, &PollManager::on_stop_poll_finished, poll_id, full_message_id, log_event_id,
|
||||
send_closure(actor_id, &PollManager::on_stop_poll_finished, poll_id, message_full_id, log_event_id,
|
||||
std::move(result), std::move(promise));
|
||||
});
|
||||
|
||||
td_->create_handler<StopPollQuery>(std::move(new_promise))->send(full_message_id, std::move(reply_markup), poll_id);
|
||||
td_->create_handler<StopPollQuery>(std::move(new_promise))->send(message_full_id, std::move(reply_markup), poll_id);
|
||||
}
|
||||
|
||||
void PollManager::on_stop_poll_finished(PollId poll_id, FullMessageId full_message_id, uint64 log_event_id,
|
||||
void PollManager::on_stop_poll_finished(PollId poll_id, MessageFullId message_full_id, uint64 log_event_id,
|
||||
Result<Unit> &&result, Promise<Unit> &&promise) {
|
||||
being_closed_polls_.erase(poll_id);
|
||||
|
||||
@ -1298,9 +1298,9 @@ void PollManager::on_stop_poll_finished(PollId poll_id, FullMessageId full_messa
|
||||
}
|
||||
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
if ((server_poll_messages_.count(poll_id) > 0 && server_poll_messages_[poll_id].count(full_message_id) > 0) ||
|
||||
(other_poll_messages_.count(poll_id) > 0 && other_poll_messages_[poll_id].count(full_message_id) > 0)) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
if ((server_poll_messages_.count(poll_id) > 0 && server_poll_messages_[poll_id].count(message_full_id) > 0) ||
|
||||
(other_poll_messages_.count(poll_id) > 0 && other_poll_messages_[poll_id].count(message_full_id) > 0)) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1344,13 +1344,13 @@ void PollManager::on_update_poll_timeout(PollId poll_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto full_message_id = server_poll_messages_[poll_id].get_random();
|
||||
LOG(INFO) << "Fetching results of " << poll_id << " from " << full_message_id;
|
||||
auto message_full_id = server_poll_messages_[poll_id].get_random();
|
||||
LOG(INFO) << "Fetching results of " << poll_id << " from " << message_full_id;
|
||||
auto query_promise = PromiseCreator::lambda([actor_id = actor_id(this), poll_id, generation = current_generation_](
|
||||
Result<tl_object_ptr<telegram_api::Updates>> &&result) {
|
||||
send_closure(actor_id, &PollManager::on_get_poll_results, poll_id, generation, std::move(result));
|
||||
});
|
||||
td_->create_handler<GetPollResultsQuery>(std::move(query_promise))->send(poll_id, full_message_id);
|
||||
td_->create_handler<GetPollResultsQuery>(std::move(query_promise))->send(poll_id, message_full_id);
|
||||
}
|
||||
|
||||
void PollManager::on_close_poll_timeout(PollId poll_id) {
|
||||
@ -1458,7 +1458,7 @@ void PollManager::on_online() {
|
||||
return;
|
||||
}
|
||||
|
||||
server_poll_messages_.foreach([&](const PollId &poll_id, WaitFreeHashSet<FullMessageId, FullMessageIdHash> &) {
|
||||
server_poll_messages_.foreach([&](const PollId &poll_id, WaitFreeHashSet<MessageFullId, MessageFullIdHash> &) {
|
||||
if (update_poll_timeout_.has_timeout(poll_id.get())) {
|
||||
auto timeout = Random::fast(3, 30);
|
||||
LOG(INFO) << "Schedule updating of " << poll_id << " in " << timeout;
|
||||
@ -1911,13 +1911,13 @@ void PollManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
||||
SetPollAnswerLogEvent log_event;
|
||||
log_event_parse(log_event, event.get_data()).ensure();
|
||||
|
||||
auto dialog_id = log_event.full_message_id_.get_dialog_id();
|
||||
auto dialog_id = log_event.message_full_id_.get_dialog_id();
|
||||
|
||||
Dependencies dependencies;
|
||||
dependencies.add_dialog_dependencies(dialog_id); // do not load the dialog itself
|
||||
dependencies.resolve_force(td_, "SetPollAnswerLogEvent");
|
||||
|
||||
do_set_poll_answer(log_event.poll_id_, log_event.full_message_id_, std::move(log_event.options_), event.id_,
|
||||
do_set_poll_answer(log_event.poll_id_, log_event.message_full_id_, std::move(log_event.options_), event.id_,
|
||||
Auto());
|
||||
break;
|
||||
}
|
||||
@ -1930,13 +1930,13 @@ void PollManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
||||
StopPollLogEvent log_event;
|
||||
log_event_parse(log_event, event.get_data()).ensure();
|
||||
|
||||
auto dialog_id = log_event.full_message_id_.get_dialog_id();
|
||||
auto dialog_id = log_event.message_full_id_.get_dialog_id();
|
||||
|
||||
Dependencies dependencies;
|
||||
dependencies.add_dialog_dependencies(dialog_id); // do not load the dialog itself
|
||||
dependencies.resolve_force(td_, "StopPollLogEvent");
|
||||
|
||||
do_stop_poll(log_event.poll_id_, log_event.full_message_id_, nullptr, event.id_, Auto());
|
||||
do_stop_poll(log_event.poll_id_, log_event.message_full_id_, nullptr, event.id_, Auto());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
#include "td/telegram/ChannelId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MinChannel.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
#include "td/telegram/PollId.h"
|
||||
@ -53,9 +53,9 @@ class PollManager final : public Actor {
|
||||
bool is_quiz, int32 correct_option_id, FormattedText &&explanation, int32 open_period,
|
||||
int32 close_date, bool is_closed);
|
||||
|
||||
void register_poll(PollId poll_id, FullMessageId full_message_id, const char *source);
|
||||
void register_poll(PollId poll_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_poll(PollId poll_id, FullMessageId full_message_id, const char *source);
|
||||
void unregister_poll(PollId poll_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
bool get_poll_is_closed(PollId poll_id) const;
|
||||
|
||||
@ -63,13 +63,13 @@ class PollManager final : public Actor {
|
||||
|
||||
string get_poll_search_text(PollId poll_id) const;
|
||||
|
||||
void set_poll_answer(PollId poll_id, FullMessageId full_message_id, vector<int32> &&option_ids,
|
||||
void set_poll_answer(PollId poll_id, MessageFullId message_full_id, vector<int32> &&option_ids,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void get_poll_voters(PollId poll_id, FullMessageId full_message_id, int32 option_id, int32 offset, int32 limit,
|
||||
void get_poll_voters(PollId poll_id, MessageFullId message_full_id, int32 option_id, int32 offset, int32 limit,
|
||||
Promise<td_api::object_ptr<td_api::messageSenders>> &&promise);
|
||||
|
||||
void stop_poll(PollId poll_id, FullMessageId full_message_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
void stop_poll(PollId poll_id, MessageFullId message_full_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void stop_local_poll(PollId poll_id);
|
||||
@ -199,7 +199,7 @@ class PollManager final : public Actor {
|
||||
|
||||
void on_get_poll_results(PollId poll_id, uint64 generation, Result<tl_object_ptr<telegram_api::Updates>> result);
|
||||
|
||||
void do_set_poll_answer(PollId poll_id, FullMessageId full_message_id, vector<string> &&options, uint64 log_event_id,
|
||||
void do_set_poll_answer(PollId poll_id, MessageFullId message_full_id, vector<string> &&options, uint64 log_event_id,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void on_set_poll_answer(PollId poll_id, uint64 generation, Result<tl_object_ptr<telegram_api::Updates>> &&result);
|
||||
@ -218,10 +218,10 @@ class PollManager final : public Actor {
|
||||
void on_get_poll_voters(PollId poll_id, int32 option_id, string offset, int32 limit,
|
||||
Result<tl_object_ptr<telegram_api::messages_votesList>> &&result);
|
||||
|
||||
void do_stop_poll(PollId poll_id, FullMessageId full_message_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
void do_stop_poll(PollId poll_id, MessageFullId message_full_id, unique_ptr<ReplyMarkup> &&reply_markup,
|
||||
uint64 log_event_id, Promise<Unit> &&promise);
|
||||
|
||||
void on_stop_poll_finished(PollId poll_id, FullMessageId full_message_id, uint64 log_event_id, Result<Unit> &&result,
|
||||
void on_stop_poll_finished(PollId poll_id, MessageFullId message_full_id, uint64 log_event_id, Result<Unit> &&result,
|
||||
Promise<Unit> &&promise);
|
||||
|
||||
void forget_local_poll(PollId poll_id);
|
||||
@ -232,8 +232,8 @@ class PollManager final : public Actor {
|
||||
|
||||
WaitFreeHashMap<PollId, unique_ptr<Poll>, PollIdHash> polls_;
|
||||
|
||||
WaitFreeHashMap<PollId, WaitFreeHashSet<FullMessageId, FullMessageIdHash>, PollIdHash> server_poll_messages_;
|
||||
WaitFreeHashMap<PollId, WaitFreeHashSet<FullMessageId, FullMessageIdHash>, PollIdHash> other_poll_messages_;
|
||||
WaitFreeHashMap<PollId, WaitFreeHashSet<MessageFullId, MessageFullIdHash>, PollIdHash> server_poll_messages_;
|
||||
WaitFreeHashMap<PollId, WaitFreeHashSet<MessageFullId, MessageFullIdHash>, PollIdHash> other_poll_messages_;
|
||||
|
||||
struct PendingPollAnswer {
|
||||
vector<string> options_;
|
||||
|
@ -330,34 +330,34 @@ void StatisticsManager::send_get_channel_stats_query(DcId dc_id, ChannelId chann
|
||||
}
|
||||
|
||||
void StatisticsManager::get_channel_message_statistics(
|
||||
FullMessageId full_message_id, bool is_dark, Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise) {
|
||||
auto dc_id_promise = PromiseCreator::lambda([actor_id = actor_id(this), full_message_id, is_dark,
|
||||
MessageFullId message_full_id, bool is_dark, Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise) {
|
||||
auto dc_id_promise = PromiseCreator::lambda([actor_id = actor_id(this), message_full_id, is_dark,
|
||||
promise = std::move(promise)](Result<DcId> r_dc_id) mutable {
|
||||
if (r_dc_id.is_error()) {
|
||||
return promise.set_error(r_dc_id.move_as_error());
|
||||
}
|
||||
send_closure(actor_id, &StatisticsManager::send_get_channel_message_stats_query, r_dc_id.move_as_ok(),
|
||||
full_message_id, is_dark, std::move(promise));
|
||||
message_full_id, is_dark, std::move(promise));
|
||||
});
|
||||
td_->contacts_manager_->get_channel_statistics_dc_id(full_message_id.get_dialog_id(), false,
|
||||
td_->contacts_manager_->get_channel_statistics_dc_id(message_full_id.get_dialog_id(), false,
|
||||
std::move(dc_id_promise));
|
||||
}
|
||||
|
||||
void StatisticsManager::send_get_channel_message_stats_query(
|
||||
DcId dc_id, FullMessageId full_message_id, bool is_dark,
|
||||
DcId dc_id, MessageFullId message_full_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise) {
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_message_force(full_message_id, "send_get_channel_message_stats_query")) {
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_message_force(message_full_id, "send_get_channel_message_stats_query")) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
if (!td_->messages_manager_->can_get_message_statistics(full_message_id)) {
|
||||
if (!td_->messages_manager_->can_get_message_statistics(message_full_id)) {
|
||||
return promise.set_error(Status::Error(400, "Message statistics is inaccessible"));
|
||||
}
|
||||
CHECK(dialog_id.get_type() == DialogType::Channel);
|
||||
td_->create_handler<GetMessageStatsQuery>(std::move(promise))
|
||||
->send(dialog_id.get_channel_id(), full_message_id.get_message_id(), is_dark, dc_id);
|
||||
->send(dialog_id.get_channel_id(), message_full_id.get_message_id(), is_dark, dc_id);
|
||||
}
|
||||
|
||||
void StatisticsManager::load_statistics_graph(DialogId dialog_id, string token, int64 x,
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "td/telegram/ChannelId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/net/DcId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
|
||||
@ -28,7 +28,7 @@ class StatisticsManager final : public Actor {
|
||||
void get_channel_statistics(DialogId dialog_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::ChatStatistics>> &&promise);
|
||||
|
||||
void get_channel_message_statistics(FullMessageId full_message_id, bool is_dark,
|
||||
void get_channel_message_statistics(MessageFullId message_full_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise);
|
||||
|
||||
void load_statistics_graph(DialogId dialog_id, string token, int64 x,
|
||||
@ -40,7 +40,7 @@ class StatisticsManager final : public Actor {
|
||||
void send_get_channel_stats_query(DcId dc_id, ChannelId channel_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::ChatStatistics>> &&promise);
|
||||
|
||||
void send_get_channel_message_stats_query(DcId dc_id, FullMessageId full_message_id, bool is_dark,
|
||||
void send_get_channel_message_stats_query(DcId dc_id, MessageFullId message_full_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise);
|
||||
|
||||
void send_load_async_graph_query(DcId dc_id, string token, int64 x,
|
||||
|
@ -1904,13 +1904,13 @@ void StickersManager::on_load_special_sticker_set(const SpecialStickerSetType &t
|
||||
reset_to_empty(pending_get_animated_emoji_click_stickers_);
|
||||
for (auto &pending_request : pending_get_requests) {
|
||||
choose_animated_emoji_click_sticker(sticker_set, std::move(pending_request.message_text_),
|
||||
pending_request.full_message_id_, pending_request.start_time_,
|
||||
pending_request.message_full_id_, pending_request.start_time_,
|
||||
std::move(pending_request.promise_));
|
||||
}
|
||||
auto pending_click_requests = std::move(pending_on_animated_emoji_message_clicked_);
|
||||
reset_to_empty(pending_on_animated_emoji_message_clicked_);
|
||||
for (auto &pending_request : pending_click_requests) {
|
||||
schedule_update_animated_emoji_clicked(sticker_set, pending_request.emoji_, pending_request.full_message_id_,
|
||||
schedule_update_animated_emoji_clicked(sticker_set, pending_request.emoji_, pending_request.message_full_id_,
|
||||
std::move(pending_request.clicks_));
|
||||
}
|
||||
return;
|
||||
@ -1924,11 +1924,11 @@ void StickersManager::on_load_special_sticker_set(const SpecialStickerSetType &t
|
||||
return;
|
||||
}
|
||||
|
||||
vector<FullMessageId> full_message_ids;
|
||||
it->second.foreach([&](const FullMessageId &full_message_id) { full_message_ids.push_back(full_message_id); });
|
||||
CHECK(!full_message_ids.empty());
|
||||
for (const auto &full_message_id : full_message_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
vector<MessageFullId> message_full_ids;
|
||||
it->second.foreach([&](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
|
||||
CHECK(!message_full_ids.empty());
|
||||
for (const auto &message_full_id : message_full_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5602,7 +5602,7 @@ void StickersManager::on_update_sticker_sets(StickerType sticker_type) {
|
||||
|
||||
void StickersManager::try_update_animated_emoji_messages() {
|
||||
auto sticker_set = get_animated_emoji_sticker_set();
|
||||
vector<FullMessageId> full_message_ids;
|
||||
vector<MessageFullId> message_full_ids;
|
||||
for (auto &it : emoji_messages_) {
|
||||
auto new_animated_sticker = get_animated_emoji_sticker(sticker_set, it.first);
|
||||
auto new_sound_file_id = get_animated_emoji_sound_file_id(it.first);
|
||||
@ -5610,12 +5610,12 @@ void StickersManager::try_update_animated_emoji_messages() {
|
||||
(new_animated_sticker.first.is_valid() && new_sound_file_id != it.second->sound_file_id_)) {
|
||||
it.second->animated_emoji_sticker_ = new_animated_sticker;
|
||||
it.second->sound_file_id_ = new_sound_file_id;
|
||||
it.second->full_message_ids_.foreach(
|
||||
[&](const FullMessageId &full_message_id) { full_message_ids.push_back(full_message_id); });
|
||||
it.second->message_full_ids_.foreach(
|
||||
[&](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
|
||||
}
|
||||
}
|
||||
for (const auto &full_message_id : full_message_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : message_full_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5625,86 +5625,86 @@ void StickersManager::try_update_custom_emoji_messages(CustomEmojiId custom_emoj
|
||||
return;
|
||||
}
|
||||
|
||||
vector<FullMessageId> full_message_ids;
|
||||
vector<MessageFullId> message_full_ids;
|
||||
auto new_sticker_id = get_custom_animated_emoji_sticker_id(custom_emoji_id);
|
||||
if (new_sticker_id != it->second->sticker_id_) {
|
||||
it->second->sticker_id_ = new_sticker_id;
|
||||
it->second->full_message_ids_.foreach(
|
||||
[&](const FullMessageId &full_message_id) { full_message_ids.push_back(full_message_id); });
|
||||
it->second->message_full_ids_.foreach(
|
||||
[&](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
|
||||
}
|
||||
for (const auto &full_message_id : full_message_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : message_full_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
|
||||
void StickersManager::try_update_premium_gift_messages() {
|
||||
auto sticker_set = get_premium_gift_sticker_set();
|
||||
vector<FullMessageId> full_message_ids;
|
||||
vector<MessageFullId> message_full_ids;
|
||||
for (auto &it : premium_gift_messages_) {
|
||||
auto new_sticker_id = get_premium_gift_option_sticker_id(sticker_set, it.first);
|
||||
if (new_sticker_id != it.second->sticker_id_) {
|
||||
it.second->sticker_id_ = new_sticker_id;
|
||||
for (const auto &full_message_id : it.second->full_message_ids_) {
|
||||
full_message_ids.push_back(full_message_id);
|
||||
for (const auto &message_full_id : it.second->message_full_ids_) {
|
||||
message_full_ids.push_back(message_full_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const auto &full_message_id : full_message_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : message_full_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
|
||||
void StickersManager::register_premium_gift(int32 months, FullMessageId full_message_id, const char *source) {
|
||||
void StickersManager::register_premium_gift(int32 months, MessageFullId message_full_id, const char *source) {
|
||||
if (td_->auth_manager_->is_bot() || months == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Register premium gift for " << months << " months from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Register premium gift for " << months << " months from " << message_full_id << " from " << source;
|
||||
auto &premium_gift_messages_ptr = premium_gift_messages_[months];
|
||||
if (premium_gift_messages_ptr == nullptr) {
|
||||
premium_gift_messages_ptr = make_unique<GiftPremiumMessages>();
|
||||
}
|
||||
auto &premium_gift_messages = *premium_gift_messages_ptr;
|
||||
|
||||
if (premium_gift_messages.full_message_ids_.empty()) {
|
||||
if (premium_gift_messages.message_full_ids_.empty()) {
|
||||
premium_gift_messages.sticker_id_ = get_premium_gift_option_sticker_id(months);
|
||||
}
|
||||
|
||||
bool is_inserted = premium_gift_messages.full_message_ids_.insert(full_message_id).second;
|
||||
LOG_CHECK(is_inserted) << source << " " << months << " " << full_message_id;
|
||||
bool is_inserted = premium_gift_messages.message_full_ids_.insert(message_full_id).second;
|
||||
LOG_CHECK(is_inserted) << source << " " << months << " " << message_full_id;
|
||||
}
|
||||
|
||||
void StickersManager::unregister_premium_gift(int32 months, FullMessageId full_message_id, const char *source) {
|
||||
void StickersManager::unregister_premium_gift(int32 months, MessageFullId message_full_id, const char *source) {
|
||||
if (td_->auth_manager_->is_bot() || months == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Unregister premium gift for " << months << " months from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Unregister premium gift for " << months << " months from " << message_full_id << " from " << source;
|
||||
auto it = premium_gift_messages_.find(months);
|
||||
CHECK(it != premium_gift_messages_.end());
|
||||
auto &message_ids = it->second->full_message_ids_;
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << months << " " << full_message_id;
|
||||
auto &message_ids = it->second->message_full_ids_;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << months << " " << message_full_id;
|
||||
|
||||
if (message_ids.empty()) {
|
||||
premium_gift_messages_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void StickersManager::register_dice(const string &emoji, int32 value, FullMessageId full_message_id,
|
||||
void StickersManager::register_dice(const string &emoji, int32 value, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
CHECK(!emoji.empty());
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Register dice " << emoji << " with value " << value << " from " << full_message_id << " from "
|
||||
LOG(INFO) << "Register dice " << emoji << " with value " << value << " from " << message_full_id << " from "
|
||||
<< source;
|
||||
dice_messages_[emoji].insert(full_message_id);
|
||||
dice_messages_[emoji].insert(message_full_id);
|
||||
|
||||
if (!td::contains(dice_emojis_, emoji)) {
|
||||
if (full_message_id.get_message_id().is_any_server() &&
|
||||
full_message_id.get_dialog_id().get_type() != DialogType::SecretChat) {
|
||||
if (message_full_id.get_message_id().is_any_server() &&
|
||||
message_full_id.get_dialog_id().get_type() != DialogType::SecretChat) {
|
||||
send_closure(G()->config_manager(), &ConfigManager::reget_app_config, Promise<Unit>());
|
||||
}
|
||||
return;
|
||||
@ -5722,7 +5722,7 @@ void StickersManager::register_dice(const string &emoji, int32 value, FullMessag
|
||||
}
|
||||
|
||||
if (need_load) {
|
||||
LOG(INFO) << "Waiting for a dice sticker set needed in " << full_message_id;
|
||||
LOG(INFO) << "Waiting for a dice sticker set needed in " << message_full_id;
|
||||
load_special_sticker_set(special_sticker_set);
|
||||
} else {
|
||||
// TODO reload once in a while
|
||||
@ -5730,32 +5730,32 @@ void StickersManager::register_dice(const string &emoji, int32 value, FullMessag
|
||||
}
|
||||
}
|
||||
|
||||
void StickersManager::unregister_dice(const string &emoji, int32 value, FullMessageId full_message_id,
|
||||
void StickersManager::unregister_dice(const string &emoji, int32 value, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
CHECK(!emoji.empty());
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Unregister dice " << emoji << " with value " << value << " from " << full_message_id << " from "
|
||||
LOG(INFO) << "Unregister dice " << emoji << " with value " << value << " from " << message_full_id << " from "
|
||||
<< source;
|
||||
auto &message_ids = dice_messages_[emoji];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << emoji << " " << value << " " << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << emoji << " " << value << " " << message_full_id;
|
||||
|
||||
if (message_ids.empty()) {
|
||||
dice_messages_.erase(emoji);
|
||||
}
|
||||
}
|
||||
|
||||
void StickersManager::register_emoji(const string &emoji, CustomEmojiId custom_emoji_id, FullMessageId full_message_id,
|
||||
void StickersManager::register_emoji(const string &emoji, CustomEmojiId custom_emoji_id, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
CHECK(!emoji.empty());
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Register emoji " << emoji << " with " << custom_emoji_id << " from " << full_message_id << " from "
|
||||
LOG(INFO) << "Register emoji " << emoji << " with " << custom_emoji_id << " from " << message_full_id << " from "
|
||||
<< source;
|
||||
if (custom_emoji_id.is_valid()) {
|
||||
auto &emoji_messages_ptr = custom_emoji_messages_[custom_emoji_id];
|
||||
@ -5763,7 +5763,7 @@ void StickersManager::register_emoji(const string &emoji, CustomEmojiId custom_e
|
||||
emoji_messages_ptr = make_unique<CustomEmojiMessages>();
|
||||
}
|
||||
auto &emoji_messages = *emoji_messages_ptr;
|
||||
if (emoji_messages.full_message_ids_.empty()) {
|
||||
if (emoji_messages.message_full_ids_.empty()) {
|
||||
if (!disable_animated_emojis_ && custom_emoji_to_sticker_id_.count(custom_emoji_id) == 0) {
|
||||
load_custom_emoji_sticker_from_database_force(custom_emoji_id);
|
||||
if (custom_emoji_to_sticker_id_.count(custom_emoji_id) == 0) {
|
||||
@ -5772,7 +5772,7 @@ void StickersManager::register_emoji(const string &emoji, CustomEmojiId custom_e
|
||||
}
|
||||
emoji_messages.sticker_id_ = get_custom_animated_emoji_sticker_id(custom_emoji_id);
|
||||
}
|
||||
emoji_messages.full_message_ids_.insert(full_message_id);
|
||||
emoji_messages.message_full_ids_.insert(message_full_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5781,30 +5781,30 @@ void StickersManager::register_emoji(const string &emoji, CustomEmojiId custom_e
|
||||
emoji_messages_ptr = make_unique<EmojiMessages>();
|
||||
}
|
||||
auto &emoji_messages = *emoji_messages_ptr;
|
||||
if (emoji_messages.full_message_ids_.empty()) {
|
||||
if (emoji_messages.message_full_ids_.empty()) {
|
||||
emoji_messages.animated_emoji_sticker_ = get_animated_emoji_sticker(emoji);
|
||||
emoji_messages.sound_file_id_ = get_animated_emoji_sound_file_id(emoji);
|
||||
}
|
||||
emoji_messages.full_message_ids_.insert(full_message_id);
|
||||
emoji_messages.message_full_ids_.insert(message_full_id);
|
||||
}
|
||||
|
||||
void StickersManager::unregister_emoji(const string &emoji, CustomEmojiId custom_emoji_id,
|
||||
FullMessageId full_message_id, const char *source) {
|
||||
MessageFullId message_full_id, const char *source) {
|
||||
CHECK(!emoji.empty());
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Unregister emoji " << emoji << " with " << custom_emoji_id << " from " << full_message_id << " from "
|
||||
LOG(INFO) << "Unregister emoji " << emoji << " with " << custom_emoji_id << " from " << message_full_id << " from "
|
||||
<< source;
|
||||
if (custom_emoji_id.is_valid()) {
|
||||
auto it = custom_emoji_messages_.find(custom_emoji_id);
|
||||
CHECK(it != custom_emoji_messages_.end());
|
||||
auto &full_message_ids = it->second->full_message_ids_;
|
||||
auto is_deleted = full_message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << custom_emoji_id << ' ' << full_message_id;
|
||||
auto &message_full_ids = it->second->message_full_ids_;
|
||||
auto is_deleted = message_full_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << custom_emoji_id << ' ' << message_full_id;
|
||||
|
||||
if (full_message_ids.empty()) {
|
||||
if (message_full_ids.empty()) {
|
||||
custom_emoji_messages_.erase(it);
|
||||
}
|
||||
return;
|
||||
@ -5812,11 +5812,11 @@ void StickersManager::unregister_emoji(const string &emoji, CustomEmojiId custom
|
||||
|
||||
auto it = emoji_messages_.find(emoji);
|
||||
CHECK(it != emoji_messages_.end());
|
||||
auto &full_message_ids = it->second->full_message_ids_;
|
||||
auto is_deleted = full_message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << emoji << ' ' << full_message_id;
|
||||
auto &message_full_ids = it->second->message_full_ids_;
|
||||
auto is_deleted = message_full_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << emoji << ' ' << message_full_id;
|
||||
|
||||
if (full_message_ids.empty()) {
|
||||
if (message_full_ids.empty()) {
|
||||
emoji_messages_.erase(it);
|
||||
}
|
||||
}
|
||||
@ -6411,7 +6411,7 @@ void StickersManager::get_premium_gift_option_sticker(int32 month_count, bool is
|
||||
promise.set_value(get_sticker_object(get_premium_gift_option_sticker_id(sticker_set, month_count)));
|
||||
}
|
||||
|
||||
void StickersManager::get_animated_emoji_click_sticker(const string &message_text, FullMessageId full_message_id,
|
||||
void StickersManager::get_animated_emoji_click_sticker(const string &message_text, MessageFullId message_full_id,
|
||||
Promise<td_api::object_ptr<td_api::sticker>> &&promise) {
|
||||
if (disable_animated_emojis_ || td_->auth_manager_->is_bot()) {
|
||||
return promise.set_value(nullptr);
|
||||
@ -6427,16 +6427,16 @@ void StickersManager::get_animated_emoji_click_sticker(const string &message_tex
|
||||
auto sticker_set = get_sticker_set(special_sticker_set.id_);
|
||||
CHECK(sticker_set != nullptr);
|
||||
if (sticker_set->was_loaded_) {
|
||||
return choose_animated_emoji_click_sticker(sticker_set, message_text, full_message_id, Time::now(),
|
||||
return choose_animated_emoji_click_sticker(sticker_set, message_text, message_full_id, Time::now(),
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
LOG(INFO) << "Waiting for an emoji click sticker set needed in " << full_message_id;
|
||||
LOG(INFO) << "Waiting for an emoji click sticker set needed in " << message_full_id;
|
||||
load_special_sticker_set(special_sticker_set);
|
||||
|
||||
PendingGetAnimatedEmojiClickSticker pending_request;
|
||||
pending_request.message_text_ = message_text;
|
||||
pending_request.full_message_id_ = full_message_id;
|
||||
pending_request.message_full_id_ = message_full_id;
|
||||
pending_request.start_time_ = Time::now();
|
||||
pending_request.promise_ = std::move(promise);
|
||||
pending_get_animated_emoji_click_stickers_.push_back(std::move(pending_request));
|
||||
@ -6470,7 +6470,7 @@ vector<FileId> StickersManager::get_animated_emoji_click_stickers(const StickerS
|
||||
}
|
||||
|
||||
void StickersManager::choose_animated_emoji_click_sticker(const StickerSet *sticker_set, string message_text,
|
||||
FullMessageId full_message_id, double start_time,
|
||||
MessageFullId message_full_id, double start_time,
|
||||
Promise<td_api::object_ptr<td_api::sticker>> &&promise) {
|
||||
CHECK(sticker_set->was_loaded_);
|
||||
remove_emoji_modifiers_in_place(message_text);
|
||||
@ -6483,7 +6483,7 @@ void StickersManager::choose_animated_emoji_click_sticker(const StickerSet *stic
|
||||
}
|
||||
|
||||
auto now = Time::now();
|
||||
if (last_clicked_animated_emoji_ == message_text && last_clicked_animated_emoji_full_message_id_ == full_message_id &&
|
||||
if (last_clicked_animated_emoji_ == message_text && last_clicked_animated_emoji_message_full_id_ == message_full_id &&
|
||||
next_click_animated_emoji_message_time_ >= now + 2 * MIN_ANIMATED_EMOJI_CLICK_DELAY) {
|
||||
return promise.set_value(nullptr);
|
||||
}
|
||||
@ -6502,13 +6502,13 @@ void StickersManager::choose_animated_emoji_click_sticker(const StickerSet *stic
|
||||
}
|
||||
}
|
||||
if (found_stickers.empty()) {
|
||||
LOG(INFO) << "There is no click effect for " << message_text << " from " << full_message_id;
|
||||
LOG(INFO) << "There is no click effect for " << message_text << " from " << message_full_id;
|
||||
return promise.set_value(nullptr);
|
||||
}
|
||||
|
||||
if (last_clicked_animated_emoji_full_message_id_ != full_message_id) {
|
||||
if (last_clicked_animated_emoji_message_full_id_ != message_full_id) {
|
||||
flush_pending_animated_emoji_clicks();
|
||||
last_clicked_animated_emoji_full_message_id_ = full_message_id;
|
||||
last_clicked_animated_emoji_message_full_id_ = message_full_id;
|
||||
}
|
||||
if (last_clicked_animated_emoji_ != message_text) {
|
||||
pending_animated_emoji_clicks_.clear();
|
||||
@ -6567,16 +6567,16 @@ void StickersManager::flush_pending_animated_emoji_clicks() {
|
||||
}
|
||||
auto clicks = std::move(pending_animated_emoji_clicks_);
|
||||
pending_animated_emoji_clicks_.clear();
|
||||
auto full_message_id = last_clicked_animated_emoji_full_message_id_;
|
||||
last_clicked_animated_emoji_full_message_id_ = FullMessageId();
|
||||
auto message_full_id = last_clicked_animated_emoji_message_full_id_;
|
||||
last_clicked_animated_emoji_message_full_id_ = MessageFullId();
|
||||
auto emoji = std::move(last_clicked_animated_emoji_);
|
||||
last_clicked_animated_emoji_.clear();
|
||||
|
||||
if (td_->messages_manager_->is_message_edited_recently(full_message_id, 1)) {
|
||||
// includes deleted full_message_id
|
||||
if (td_->messages_manager_->is_message_edited_recently(message_full_id, 1)) {
|
||||
// includes deleted message_full_id
|
||||
return;
|
||||
}
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Write);
|
||||
if (input_peer == nullptr) {
|
||||
return;
|
||||
@ -6597,7 +6597,7 @@ void StickersManager::flush_pending_animated_emoji_clicks() {
|
||||
td_->create_handler<SendAnimatedEmojiClicksQuery>()->send(
|
||||
dialog_id, std::move(input_peer),
|
||||
make_tl_object<telegram_api::sendMessageEmojiInteraction>(
|
||||
emoji, full_message_id.get_message_id().get_server_message_id().get(),
|
||||
emoji, message_full_id.get_message_id().get_server_message_id().get(),
|
||||
make_tl_object<telegram_api::dataJSON>(data)));
|
||||
|
||||
on_send_animated_emoji_clicks(dialog_id, emoji);
|
||||
@ -6641,7 +6641,7 @@ bool StickersManager::is_sent_animated_emoji_click(DialogId dialog_id, const str
|
||||
return false;
|
||||
}
|
||||
|
||||
Status StickersManager::on_animated_emoji_message_clicked(string &&emoji, FullMessageId full_message_id, string data) {
|
||||
Status StickersManager::on_animated_emoji_message_clicked(string &&emoji, MessageFullId message_full_id, string data) {
|
||||
if (td_->auth_manager_->is_bot() || disable_animated_emojis_) {
|
||||
return Status::OK();
|
||||
}
|
||||
@ -6695,33 +6695,33 @@ Status StickersManager::on_animated_emoji_message_clicked(string &&emoji, FullMe
|
||||
auto sticker_set = get_sticker_set(special_sticker_set.id_);
|
||||
CHECK(sticker_set != nullptr);
|
||||
if (sticker_set->was_loaded_) {
|
||||
schedule_update_animated_emoji_clicked(sticker_set, emoji, full_message_id, std::move(clicks));
|
||||
schedule_update_animated_emoji_clicked(sticker_set, emoji, message_full_id, std::move(clicks));
|
||||
return Status::OK();
|
||||
}
|
||||
}
|
||||
|
||||
LOG(INFO) << "Waiting for an emoji click sticker set needed in " << full_message_id;
|
||||
LOG(INFO) << "Waiting for an emoji click sticker set needed in " << message_full_id;
|
||||
load_special_sticker_set(special_sticker_set);
|
||||
|
||||
PendingOnAnimatedEmojiClicked pending_request;
|
||||
pending_request.emoji_ = std::move(emoji);
|
||||
pending_request.full_message_id_ = full_message_id;
|
||||
pending_request.message_full_id_ = message_full_id;
|
||||
pending_request.clicks_ = std::move(clicks);
|
||||
pending_on_animated_emoji_message_clicked_.push_back(std::move(pending_request));
|
||||
return Status::OK();
|
||||
}
|
||||
|
||||
void StickersManager::schedule_update_animated_emoji_clicked(const StickerSet *sticker_set, Slice emoji,
|
||||
FullMessageId full_message_id,
|
||||
MessageFullId message_full_id,
|
||||
vector<std::pair<int, double>> clicks) {
|
||||
if (clicks.empty()) {
|
||||
return;
|
||||
}
|
||||
if (td_->messages_manager_->is_message_edited_recently(full_message_id, 2)) {
|
||||
// includes deleted full_message_id
|
||||
if (td_->messages_manager_->is_message_edited_recently(message_full_id, 2)) {
|
||||
// includes deleted message_full_id
|
||||
return;
|
||||
}
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Write)) {
|
||||
return;
|
||||
}
|
||||
@ -6754,23 +6754,23 @@ void StickersManager::schedule_update_animated_emoji_clicked(const StickerSet *s
|
||||
}
|
||||
create_actor<SleepActor>(
|
||||
"SendUpdateAnimatedEmojiClicked", start_time + click.second - now,
|
||||
PromiseCreator::lambda([actor_id = actor_id(this), full_message_id, sticker_id](Result<Unit> result) {
|
||||
send_closure(actor_id, &StickersManager::send_update_animated_emoji_clicked, full_message_id, sticker_id);
|
||||
PromiseCreator::lambda([actor_id = actor_id(this), message_full_id, sticker_id](Result<Unit> result) {
|
||||
send_closure(actor_id, &StickersManager::send_update_animated_emoji_clicked, message_full_id, sticker_id);
|
||||
}))
|
||||
.release();
|
||||
}
|
||||
next_update_animated_emoji_clicked_time_ = start_time + clicks.back().second + MIN_ANIMATED_EMOJI_CLICK_DELAY;
|
||||
}
|
||||
|
||||
void StickersManager::send_update_animated_emoji_clicked(FullMessageId full_message_id, FileId sticker_id) {
|
||||
void StickersManager::send_update_animated_emoji_clicked(MessageFullId message_full_id, FileId sticker_id) {
|
||||
if (G()->close_flag() || disable_animated_emojis_ || td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
if (td_->messages_manager_->is_message_edited_recently(full_message_id, 2)) {
|
||||
// includes deleted full_message_id
|
||||
if (td_->messages_manager_->is_message_edited_recently(message_full_id, 2)) {
|
||||
// includes deleted message_full_id
|
||||
return;
|
||||
}
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Write)) {
|
||||
return;
|
||||
}
|
||||
@ -6778,7 +6778,7 @@ void StickersManager::send_update_animated_emoji_clicked(FullMessageId full_mess
|
||||
send_closure(G()->td(), &Td::send_update,
|
||||
td_api::make_object<td_api::updateAnimatedEmojiMessageClicked>(
|
||||
td_->messages_manager_->get_chat_id_object(dialog_id, "updateAnimatedEmojiMessageClicked"),
|
||||
full_message_id.get_message_id().get(), get_sticker_object(sticker_id, false, true)));
|
||||
message_full_id.get_message_id().get(), get_sticker_object(sticker_id, false, true)));
|
||||
}
|
||||
|
||||
void StickersManager::view_featured_sticker_sets(const vector<StickerSetId> &sticker_set_ids) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "td/telegram/EmojiGroupType.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/PhotoFormat.h"
|
||||
#include "td/telegram/PhotoSize.h"
|
||||
#include "td/telegram/SecretInputMedia.h"
|
||||
@ -103,18 +103,18 @@ class StickersManager final : public Actor {
|
||||
|
||||
tl_object_ptr<telegram_api::InputStickerSet> get_input_sticker_set(StickerSetId sticker_set_id) const;
|
||||
|
||||
void register_premium_gift(int32 months, FullMessageId full_message_id, const char *source);
|
||||
void register_premium_gift(int32 months, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_premium_gift(int32 months, FullMessageId full_message_id, const char *source);
|
||||
void unregister_premium_gift(int32 months, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void register_dice(const string &emoji, int32 value, FullMessageId full_message_id, const char *source);
|
||||
void register_dice(const string &emoji, int32 value, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_dice(const string &emoji, int32 value, FullMessageId full_message_id, const char *source);
|
||||
void unregister_dice(const string &emoji, int32 value, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void register_emoji(const string &emoji, CustomEmojiId custom_emoji_id, FullMessageId full_message_id,
|
||||
void register_emoji(const string &emoji, CustomEmojiId custom_emoji_id, MessageFullId message_full_id,
|
||||
const char *source);
|
||||
|
||||
void unregister_emoji(const string &emoji, CustomEmojiId custom_emoji_id, FullMessageId full_message_id,
|
||||
void unregister_emoji(const string &emoji, CustomEmojiId custom_emoji_id, MessageFullId message_full_id,
|
||||
const char *source);
|
||||
|
||||
void get_animated_emoji(string emoji, bool is_recursive,
|
||||
@ -140,14 +140,14 @@ class StickersManager final : public Actor {
|
||||
void get_premium_gift_option_sticker(int32 month_count, bool is_recursive,
|
||||
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
||||
|
||||
void get_animated_emoji_click_sticker(const string &message_text, FullMessageId full_message_id,
|
||||
void get_animated_emoji_click_sticker(const string &message_text, MessageFullId message_full_id,
|
||||
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
||||
|
||||
void on_send_animated_emoji_clicks(DialogId dialog_id, const string &emoji);
|
||||
|
||||
bool is_sent_animated_emoji_click(DialogId dialog_id, const string &emoji);
|
||||
|
||||
Status on_animated_emoji_message_clicked(string &&emoji, FullMessageId full_message_id, string data);
|
||||
Status on_animated_emoji_message_clicked(string &&emoji, MessageFullId message_full_id, string data);
|
||||
|
||||
void create_sticker(FileId file_id, FileId premium_animation_file_id, string minithumbnail, PhotoSize thumbnail,
|
||||
Dimensions dimensions, tl_object_ptr<telegram_api::documentAttributeSticker> sticker,
|
||||
@ -531,14 +531,14 @@ class StickersManager final : public Actor {
|
||||
|
||||
struct PendingGetAnimatedEmojiClickSticker {
|
||||
string message_text_;
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
double start_time_ = 0;
|
||||
Promise<td_api::object_ptr<td_api::sticker>> promise_;
|
||||
};
|
||||
|
||||
struct PendingOnAnimatedEmojiClicked {
|
||||
string emoji_;
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
vector<std::pair<int, double>> clicks_;
|
||||
};
|
||||
|
||||
@ -849,7 +849,7 @@ class StickersManager final : public Actor {
|
||||
vector<FileId> get_animated_emoji_click_stickers(const StickerSet *sticker_set, Slice emoji) const;
|
||||
|
||||
void choose_animated_emoji_click_sticker(const StickerSet *sticker_set, string message_text,
|
||||
FullMessageId full_message_id, double start_time,
|
||||
MessageFullId message_full_id, double start_time,
|
||||
Promise<td_api::object_ptr<td_api::sticker>> &&promise);
|
||||
|
||||
void send_click_animated_emoji_message_response(FileId sticker_id,
|
||||
@ -859,10 +859,10 @@ class StickersManager final : public Actor {
|
||||
|
||||
void flush_pending_animated_emoji_clicks();
|
||||
|
||||
void schedule_update_animated_emoji_clicked(const StickerSet *sticker_set, Slice emoji, FullMessageId full_message_id,
|
||||
void schedule_update_animated_emoji_clicked(const StickerSet *sticker_set, Slice emoji, MessageFullId message_full_id,
|
||||
vector<std::pair<int, double>> clicks);
|
||||
|
||||
void send_update_animated_emoji_clicked(FullMessageId full_message_id, FileId sticker_id);
|
||||
void send_update_animated_emoji_clicked(MessageFullId message_full_id, FileId sticker_id);
|
||||
|
||||
td_api::object_ptr<td_api::updateDiceEmojis> get_update_dice_emojis_object() const;
|
||||
|
||||
@ -1067,7 +1067,7 @@ class StickersManager final : public Actor {
|
||||
vector<PendingOnAnimatedEmojiClicked> pending_on_animated_emoji_message_clicked_;
|
||||
|
||||
string last_clicked_animated_emoji_;
|
||||
FullMessageId last_clicked_animated_emoji_full_message_id_;
|
||||
MessageFullId last_clicked_animated_emoji_message_full_id_;
|
||||
std::vector<std::pair<int, double>> pending_animated_emoji_clicks_;
|
||||
|
||||
struct SentAnimatedEmojiClicks {
|
||||
@ -1090,22 +1090,22 @@ class StickersManager final : public Actor {
|
||||
FlatHashMap<int64, string> emoji_suggestions_urls_;
|
||||
|
||||
struct GiftPremiumMessages {
|
||||
FlatHashSet<FullMessageId, FullMessageIdHash> full_message_ids_;
|
||||
FlatHashSet<MessageFullId, MessageFullIdHash> message_full_ids_;
|
||||
FileId sticker_id_;
|
||||
};
|
||||
FlatHashMap<int32, unique_ptr<GiftPremiumMessages>> premium_gift_messages_;
|
||||
|
||||
FlatHashMap<string, WaitFreeHashSet<FullMessageId, FullMessageIdHash>> dice_messages_;
|
||||
FlatHashMap<string, WaitFreeHashSet<MessageFullId, MessageFullIdHash>> dice_messages_;
|
||||
|
||||
struct EmojiMessages {
|
||||
WaitFreeHashSet<FullMessageId, FullMessageIdHash> full_message_ids_;
|
||||
WaitFreeHashSet<MessageFullId, MessageFullIdHash> message_full_ids_;
|
||||
std::pair<FileId, int> animated_emoji_sticker_;
|
||||
FileId sound_file_id_;
|
||||
};
|
||||
FlatHashMap<string, unique_ptr<EmojiMessages>> emoji_messages_;
|
||||
|
||||
struct CustomEmojiMessages {
|
||||
WaitFreeHashSet<FullMessageId, FullMessageIdHash> full_message_ids_;
|
||||
WaitFreeHashSet<MessageFullId, MessageFullIdHash> message_full_ids_;
|
||||
FileId sticker_id_;
|
||||
};
|
||||
FlatHashMap<CustomEmojiId, unique_ptr<CustomEmojiMessages>, CustomEmojiIdHash> custom_emoji_messages_;
|
||||
|
@ -3174,25 +3174,25 @@ int32 StoryManager::get_story_duration(StoryFullId story_full_id) const {
|
||||
return get_story_content_duration(td_, content);
|
||||
}
|
||||
|
||||
void StoryManager::register_story(StoryFullId story_full_id, FullMessageId full_message_id, const char *source) {
|
||||
void StoryManager::register_story(StoryFullId story_full_id, MessageFullId message_full_id, const char *source) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
CHECK(story_full_id.is_server());
|
||||
|
||||
LOG(INFO) << "Register " << story_full_id << " from " << full_message_id << " from " << source;
|
||||
story_messages_[story_full_id].insert(full_message_id);
|
||||
LOG(INFO) << "Register " << story_full_id << " from " << message_full_id << " from " << source;
|
||||
story_messages_[story_full_id].insert(message_full_id);
|
||||
}
|
||||
|
||||
void StoryManager::unregister_story(StoryFullId story_full_id, FullMessageId full_message_id, const char *source) {
|
||||
void StoryManager::unregister_story(StoryFullId story_full_id, MessageFullId message_full_id, const char *source) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
CHECK(story_full_id.is_server());
|
||||
LOG(INFO) << "Unregister " << story_full_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Unregister " << story_full_id << " from " << message_full_id << " from " << source;
|
||||
auto &message_ids = story_messages_[story_full_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << story_full_id << ' ' << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << story_full_id << ' ' << message_full_id;
|
||||
if (message_ids.empty()) {
|
||||
story_messages_.erase(story_full_id);
|
||||
}
|
||||
@ -3785,12 +3785,12 @@ void StoryManager::on_story_changed(StoryFullId story_full_id, const Story *stor
|
||||
send_closure_later(G()->web_pages_manager(), &WebPagesManager::on_story_changed, story_full_id);
|
||||
|
||||
if (story_messages_.count(story_full_id) != 0) {
|
||||
vector<FullMessageId> full_message_ids;
|
||||
vector<MessageFullId> message_full_ids;
|
||||
story_messages_[story_full_id].foreach(
|
||||
[&full_message_ids](const FullMessageId &full_message_id) { full_message_ids.push_back(full_message_id); });
|
||||
CHECK(!full_message_ids.empty());
|
||||
for (const auto &full_message_id : full_message_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
[&message_full_ids](const MessageFullId &message_full_id) { message_full_ids.push_back(message_full_id); });
|
||||
CHECK(!message_full_ids.empty());
|
||||
for (const auto &message_full_id : message_full_ids) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MediaArea.h"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/ReactionType.h"
|
||||
#include "td/telegram/StoryDb.h"
|
||||
#include "td/telegram/StoryFullId.h"
|
||||
@ -326,9 +326,9 @@ class StoryManager final : public Actor {
|
||||
|
||||
int32 get_story_duration(StoryFullId story_full_id) const;
|
||||
|
||||
void register_story(StoryFullId story_full_id, FullMessageId full_message_id, const char *source);
|
||||
void register_story(StoryFullId story_full_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_story(StoryFullId story_full_id, FullMessageId full_message_id, const char *source);
|
||||
void unregister_story(StoryFullId story_full_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
td_api::object_ptr<td_api::story> get_story_object(StoryFullId story_full_id) const;
|
||||
|
||||
@ -630,7 +630,7 @@ class StoryManager final : public Actor {
|
||||
|
||||
WaitFreeHashSet<StoryFullId, StoryFullIdHash> failed_to_load_story_full_ids_;
|
||||
|
||||
WaitFreeHashMap<StoryFullId, WaitFreeHashSet<FullMessageId, FullMessageIdHash>, StoryFullIdHash> story_messages_;
|
||||
WaitFreeHashMap<StoryFullId, WaitFreeHashSet<MessageFullId, MessageFullIdHash>, StoryFullIdHash> story_messages_;
|
||||
|
||||
WaitFreeHashMap<DialogId, unique_ptr<ActiveStories>, DialogIdHash> active_stories_;
|
||||
|
||||
|
@ -58,7 +58,6 @@
|
||||
#include "td/telegram/files/FileType.h"
|
||||
#include "td/telegram/FolderId.h"
|
||||
#include "td/telegram/ForumTopicManager.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/GameManager.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/GlobalPrivacySettings.h"
|
||||
@ -73,6 +72,7 @@
|
||||
#include "td/telegram/Logging.h"
|
||||
#include "td/telegram/MessageCopyOptions.h"
|
||||
#include "td/telegram/MessageEntity.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/MessageLinkInfo.h"
|
||||
#include "td/telegram/MessageReaction.h"
|
||||
@ -949,19 +949,19 @@ class GetRecentlyOpenedChatsRequest final : public RequestActor<> {
|
||||
};
|
||||
|
||||
class GetMessageRequest final : public RequestOnceActor {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
td_->messages_manager_->get_message(full_message_id_, std::move(promise));
|
||||
td_->messages_manager_->get_message(message_full_id_, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_message_object(full_message_id_, "GetMessageRequest"));
|
||||
send_result(td_->messages_manager_->get_message_object(message_full_id_, "GetMessageRequest"));
|
||||
}
|
||||
|
||||
public:
|
||||
GetMessageRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id)
|
||||
: RequestOnceActor(std::move(td), request_id), full_message_id_(DialogId(dialog_id), MessageId(message_id)) {
|
||||
: RequestOnceActor(std::move(td), request_id), message_full_id_(DialogId(dialog_id), MessageId(message_id)) {
|
||||
}
|
||||
};
|
||||
|
||||
@ -969,7 +969,7 @@ class GetRepliedMessageRequest final : public RequestOnceActor {
|
||||
DialogId dialog_id_;
|
||||
MessageId message_id_;
|
||||
|
||||
FullMessageId replied_message_id_;
|
||||
MessageFullId replied_message_id_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
replied_message_id_ =
|
||||
@ -1081,13 +1081,13 @@ class GetMessagesRequest final : public RequestOnceActor {
|
||||
};
|
||||
|
||||
class GetMessageEmbeddingCodeRequest final : public RequestActor<> {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
bool for_group_;
|
||||
|
||||
string html_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
html_ = td_->messages_manager_->get_message_embedding_code(full_message_id_, for_group_, std::move(promise));
|
||||
html_ = td_->messages_manager_->get_message_embedding_code(message_full_id_, for_group_, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
@ -1098,7 +1098,7 @@ class GetMessageEmbeddingCodeRequest final : public RequestActor<> {
|
||||
GetMessageEmbeddingCodeRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id,
|
||||
bool for_group)
|
||||
: RequestActor(std::move(td), request_id)
|
||||
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, message_full_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, for_group_(for_group) {
|
||||
}
|
||||
};
|
||||
@ -1158,17 +1158,17 @@ class GetDialogBoostLinkInfoRequest final : public RequestActor<DialogBoostLinkI
|
||||
};
|
||||
|
||||
class EditMessageTextRequest final : public RequestOnceActor {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
|
||||
tl_object_ptr<td_api::InputMessageContent> input_message_content_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
td_->messages_manager_->edit_message_text(full_message_id_, std::move(reply_markup_),
|
||||
td_->messages_manager_->edit_message_text(message_full_id_, std::move(reply_markup_),
|
||||
std::move(input_message_content_), std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_message_object(full_message_id_, "EditMessageTextRequest"));
|
||||
send_result(td_->messages_manager_->get_message_object(message_full_id_, "EditMessageTextRequest"));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -1176,26 +1176,26 @@ class EditMessageTextRequest final : public RequestOnceActor {
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup,
|
||||
tl_object_ptr<td_api::InputMessageContent> input_message_content)
|
||||
: RequestOnceActor(std::move(td), request_id)
|
||||
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, message_full_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, reply_markup_(std::move(reply_markup))
|
||||
, input_message_content_(std::move(input_message_content)) {
|
||||
}
|
||||
};
|
||||
|
||||
class EditMessageLiveLocationRequest final : public RequestOnceActor {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
|
||||
tl_object_ptr<td_api::location> location_;
|
||||
int32 heading_;
|
||||
int32 proximity_alert_radius_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
td_->messages_manager_->edit_message_live_location(full_message_id_, std::move(reply_markup_), std::move(location_),
|
||||
td_->messages_manager_->edit_message_live_location(message_full_id_, std::move(reply_markup_), std::move(location_),
|
||||
heading_, proximity_alert_radius_, std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_message_object(full_message_id_, "EditMessageLiveLocationRequest"));
|
||||
send_result(td_->messages_manager_->get_message_object(message_full_id_, "EditMessageLiveLocationRequest"));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -1203,7 +1203,7 @@ class EditMessageLiveLocationRequest final : public RequestOnceActor {
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup,
|
||||
tl_object_ptr<td_api::location> location, int32 heading, int32 proximity_alert_radius)
|
||||
: RequestOnceActor(std::move(td), request_id)
|
||||
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, message_full_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, reply_markup_(std::move(reply_markup))
|
||||
, location_(std::move(location))
|
||||
, heading_(heading)
|
||||
@ -1212,17 +1212,17 @@ class EditMessageLiveLocationRequest final : public RequestOnceActor {
|
||||
};
|
||||
|
||||
class EditMessageMediaRequest final : public RequestOnceActor {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
|
||||
tl_object_ptr<td_api::InputMessageContent> input_message_content_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
td_->messages_manager_->edit_message_media(full_message_id_, std::move(reply_markup_),
|
||||
td_->messages_manager_->edit_message_media(message_full_id_, std::move(reply_markup_),
|
||||
std::move(input_message_content_), std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_message_object(full_message_id_, "EditMessageMediaRequest"));
|
||||
send_result(td_->messages_manager_->get_message_object(message_full_id_, "EditMessageMediaRequest"));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -1230,24 +1230,24 @@ class EditMessageMediaRequest final : public RequestOnceActor {
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup,
|
||||
tl_object_ptr<td_api::InputMessageContent> input_message_content)
|
||||
: RequestOnceActor(std::move(td), request_id)
|
||||
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, message_full_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, reply_markup_(std::move(reply_markup))
|
||||
, input_message_content_(std::move(input_message_content)) {
|
||||
}
|
||||
};
|
||||
|
||||
class EditMessageCaptionRequest final : public RequestOnceActor {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
|
||||
tl_object_ptr<td_api::formattedText> caption_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
td_->messages_manager_->edit_message_caption(full_message_id_, std::move(reply_markup_), std::move(caption_),
|
||||
td_->messages_manager_->edit_message_caption(message_full_id_, std::move(reply_markup_), std::move(caption_),
|
||||
std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_message_object(full_message_id_, "EditMessageCaptionRequest"));
|
||||
send_result(td_->messages_manager_->get_message_object(message_full_id_, "EditMessageCaptionRequest"));
|
||||
}
|
||||
|
||||
public:
|
||||
@ -1255,29 +1255,29 @@ class EditMessageCaptionRequest final : public RequestOnceActor {
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup,
|
||||
tl_object_ptr<td_api::formattedText> caption)
|
||||
: RequestOnceActor(std::move(td), request_id)
|
||||
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, message_full_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, reply_markup_(std::move(reply_markup))
|
||||
, caption_(std::move(caption)) {
|
||||
}
|
||||
};
|
||||
|
||||
class EditMessageReplyMarkupRequest final : public RequestOnceActor {
|
||||
FullMessageId full_message_id_;
|
||||
MessageFullId message_full_id_;
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
td_->messages_manager_->edit_message_reply_markup(full_message_id_, std::move(reply_markup_), std::move(promise));
|
||||
td_->messages_manager_->edit_message_reply_markup(message_full_id_, std::move(reply_markup_), std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_message_object(full_message_id_, "EditMessageReplyMarkupRequest"));
|
||||
send_result(td_->messages_manager_->get_message_object(message_full_id_, "EditMessageReplyMarkupRequest"));
|
||||
}
|
||||
|
||||
public:
|
||||
EditMessageReplyMarkupRequest(ActorShared<Td> td, uint64 request_id, int64 dialog_id, int64 message_id,
|
||||
tl_object_ptr<td_api::ReplyMarkup> reply_markup)
|
||||
: RequestOnceActor(std::move(td), request_id)
|
||||
, full_message_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, message_full_id_(DialogId(dialog_id), MessageId(message_id))
|
||||
, reply_markup_(std::move(reply_markup)) {
|
||||
}
|
||||
};
|
||||
@ -1536,14 +1536,14 @@ class SearchCallMessagesRequest final : public RequestActor<> {
|
||||
};
|
||||
|
||||
class GetActiveLiveLocationMessagesRequest final : public RequestActor<> {
|
||||
vector<FullMessageId> full_message_ids_;
|
||||
vector<MessageFullId> message_full_ids_;
|
||||
|
||||
void do_run(Promise<Unit> &&promise) final {
|
||||
full_message_ids_ = td_->messages_manager_->get_active_live_location_messages(std::move(promise));
|
||||
message_full_ids_ = td_->messages_manager_->get_active_live_location_messages(std::move(promise));
|
||||
}
|
||||
|
||||
void do_send_result() final {
|
||||
send_result(td_->messages_manager_->get_messages_object(-1, full_message_ids_, true,
|
||||
send_result(td_->messages_manager_->get_messages_object(-1, message_full_ids_, true,
|
||||
"GetActiveLiveLocationMessagesRequest"));
|
||||
}
|
||||
|
||||
@ -4772,9 +4772,9 @@ void Td::on_request(uint64 id, const td_api::getMessage &request) {
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getMessageLocally &request) {
|
||||
FullMessageId full_message_id(DialogId(request.chat_id_), MessageId(request.message_id_));
|
||||
MessageFullId message_full_id(DialogId(request.chat_id_), MessageId(request.message_id_));
|
||||
send_closure(actor_id(this), &Td::send_result, id,
|
||||
messages_manager_->get_message_object(full_message_id, "getMessageLocally"));
|
||||
messages_manager_->get_message_object(message_full_id, "getMessageLocally"));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::getRepliedMessage &request) {
|
||||
@ -7140,7 +7140,7 @@ void Td::on_request(uint64 id, const td_api::addFileToDownloads &request) {
|
||||
}
|
||||
CREATE_REQUEST_PROMISE();
|
||||
messages_manager_->add_message_file_to_downloads(
|
||||
FullMessageId(DialogId(request.chat_id_), MessageId(request.message_id_)), FileId(request.file_id_, 0),
|
||||
MessageFullId(DialogId(request.chat_id_), MessageId(request.message_id_)), FileId(request.file_id_, 0),
|
||||
request.priority_, std::move(promise));
|
||||
}
|
||||
|
||||
|
@ -23,16 +23,16 @@ class TranscribeAudioQuery final : public Td::ResultHandler {
|
||||
std::function<void(Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>>)> handler_;
|
||||
|
||||
public:
|
||||
void send(FullMessageId full_message_id,
|
||||
void send(MessageFullId message_full_id,
|
||||
std::function<void(Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>>)> &&handler) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
handler_ = std::move(handler);
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
if (input_peer == nullptr) {
|
||||
return on_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::messages_transcribeAudio(
|
||||
std::move(input_peer), full_message_id.get_message_id().get_server_message_id().get())));
|
||||
std::move(input_peer), message_full_id.get_message_id().get_server_message_id().get())));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
@ -67,14 +67,14 @@ class RateTranscribedAudioQuery final : public Td::ResultHandler {
|
||||
explicit RateTranscribedAudioQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(FullMessageId full_message_id, int64 transcription_id, bool is_good) {
|
||||
dialog_id_ = full_message_id.get_dialog_id();
|
||||
void send(MessageFullId message_full_id, int64 transcription_id, bool is_good) {
|
||||
dialog_id_ = message_full_id.get_dialog_id();
|
||||
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id_, AccessRights::Read);
|
||||
if (input_peer == nullptr) {
|
||||
return on_error(Status::Error(400, "Can't access the chat"));
|
||||
}
|
||||
send_query(G()->net_query_creator().create(telegram_api::messages_rateTranscribedAudio(
|
||||
std::move(input_peer), full_message_id.get_message_id().get_server_message_id().get(), transcription_id,
|
||||
std::move(input_peer), message_full_id.get_message_id().get_server_message_id().get(), transcription_id,
|
||||
is_good)));
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ class RateTranscribedAudioQuery final : public Td::ResultHandler {
|
||||
};
|
||||
|
||||
bool TranscriptionInfo::recognize_speech(
|
||||
Td *td, FullMessageId full_message_id, Promise<Unit> &&promise,
|
||||
Td *td, MessageFullId message_full_id, Promise<Unit> &&promise,
|
||||
std::function<void(Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>>)> &&handler) {
|
||||
if (is_transcribed_) {
|
||||
promise.set_value(Unit());
|
||||
@ -105,7 +105,7 @@ bool TranscriptionInfo::recognize_speech(
|
||||
speech_recognition_queries_.push_back(std::move(promise));
|
||||
if (speech_recognition_queries_.size() == 1) {
|
||||
last_transcription_error_ = Status::OK();
|
||||
td->create_handler<TranscribeAudioQuery>()->send(full_message_id, std::move(handler));
|
||||
td->create_handler<TranscribeAudioQuery>()->send(message_full_id, std::move(handler));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -151,13 +151,13 @@ vector<Promise<Unit>> TranscriptionInfo::on_failed_transcription(Status &&error)
|
||||
return promises;
|
||||
}
|
||||
|
||||
void TranscriptionInfo::rate_speech_recognition(Td *td, FullMessageId full_message_id, bool is_good,
|
||||
void TranscriptionInfo::rate_speech_recognition(Td *td, MessageFullId message_full_id, bool is_good,
|
||||
Promise<Unit> &&promise) const {
|
||||
if (!is_transcribed_) {
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
CHECK(transcription_id_ != 0);
|
||||
td->create_handler<RateTranscribedAudioQuery>(std::move(promise))->send(full_message_id, transcription_id_, is_good);
|
||||
td->create_handler<RateTranscribedAudioQuery>(std::move(promise))->send(message_full_id, transcription_id_, is_good);
|
||||
}
|
||||
|
||||
unique_ptr<TranscriptionInfo> TranscriptionInfo::copy_if_transcribed(const unique_ptr<TranscriptionInfo> &info) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
@ -35,7 +35,7 @@ class TranscriptionInfo {
|
||||
}
|
||||
|
||||
bool recognize_speech(
|
||||
Td *td, FullMessageId full_message_id, Promise<Unit> &&promise,
|
||||
Td *td, MessageFullId message_full_id, Promise<Unit> &&promise,
|
||||
std::function<void(Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>>)> &&handler);
|
||||
|
||||
vector<Promise<Unit>> on_final_transcription(string &&text, int64 transcription_id);
|
||||
@ -44,7 +44,7 @@ class TranscriptionInfo {
|
||||
|
||||
vector<Promise<Unit>> on_failed_transcription(Status &&error);
|
||||
|
||||
void rate_speech_recognition(Td *td, FullMessageId full_message_id, bool is_good, Promise<Unit> &&promise) const;
|
||||
void rate_speech_recognition(Td *td, MessageFullId message_full_id, bool is_good, Promise<Unit> &&promise) const;
|
||||
|
||||
static unique_ptr<TranscriptionInfo> copy_if_transcribed(const unique_ptr<TranscriptionInfo> &info);
|
||||
|
||||
|
@ -1429,7 +1429,7 @@ const telegram_api::Message *UpdatesManager::get_message_by_random_id(const tele
|
||||
}
|
||||
|
||||
const telegram_api::Message *result = nullptr;
|
||||
FullMessageId full_message_id(dialog_id, MessageId(ServerMessageId(message_id)));
|
||||
MessageFullId message_full_id(dialog_id, MessageId(ServerMessageId(message_id)));
|
||||
for (auto &update : *updates) {
|
||||
auto constructor_id = update->get_id();
|
||||
const tl_object_ptr<telegram_api::Message> *message = nullptr;
|
||||
@ -1438,7 +1438,7 @@ const telegram_api::Message *UpdatesManager::get_message_by_random_id(const tele
|
||||
} else if (constructor_id == telegram_api::updateNewChannelMessage::ID) {
|
||||
message = &static_cast<const telegram_api::updateNewChannelMessage *>(update.get())->message_;
|
||||
}
|
||||
if (message != nullptr && FullMessageId::get_full_message_id(*message, false) == full_message_id) {
|
||||
if (message != nullptr && MessageFullId::get_message_full_id(*message, false) == message_full_id) {
|
||||
if (result != nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1619,7 +1619,7 @@ vector<DialogId> UpdatesManager::get_chat_dialog_ids(const telegram_api::Updates
|
||||
}
|
||||
|
||||
int32 UpdatesManager::get_update_edit_message_pts(const telegram_api::Updates *updates_ptr,
|
||||
FullMessageId full_message_id) {
|
||||
MessageFullId message_full_id) {
|
||||
int32 pts = 0;
|
||||
auto updates = get_updates(updates_ptr);
|
||||
if (updates != nullptr) {
|
||||
@ -1628,24 +1628,24 @@ int32 UpdatesManager::get_update_edit_message_pts(const telegram_api::Updates *u
|
||||
switch (update_ptr->get_id()) {
|
||||
case telegram_api::updateEditMessage::ID: {
|
||||
auto update = static_cast<const telegram_api::updateEditMessage *>(update_ptr.get());
|
||||
if (FullMessageId::get_full_message_id(update->message_, false) == full_message_id) {
|
||||
if (MessageFullId::get_message_full_id(update->message_, false) == message_full_id) {
|
||||
return update->pts_;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case telegram_api::updateEditChannelMessage::ID: {
|
||||
auto update = static_cast<const telegram_api::updateEditChannelMessage *>(update_ptr.get());
|
||||
if (FullMessageId::get_full_message_id(update->message_, false) == full_message_id) {
|
||||
if (MessageFullId::get_message_full_id(update->message_, false) == message_full_id) {
|
||||
return update->pts_;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case telegram_api::updateNewScheduledMessage::ID: {
|
||||
auto update = static_cast<const telegram_api::updateNewScheduledMessage *>(update_ptr.get());
|
||||
auto new_full_message_id = FullMessageId::get_full_message_id(update->message_, true);
|
||||
if (new_full_message_id.get_dialog_id() == full_message_id.get_dialog_id()) {
|
||||
auto new_message_id = new_full_message_id.get_message_id();
|
||||
auto old_message_id = full_message_id.get_message_id();
|
||||
auto new_message_full_id = MessageFullId::get_message_full_id(update->message_, true);
|
||||
if (new_message_full_id.get_dialog_id() == message_full_id.get_dialog_id()) {
|
||||
auto new_message_id = new_message_full_id.get_message_id();
|
||||
auto old_message_id = message_full_id.get_message_id();
|
||||
if (new_message_id.is_valid_scheduled() && new_message_id.is_scheduled_server() &&
|
||||
old_message_id.is_valid_scheduled() && old_message_id.is_scheduled_server() &&
|
||||
old_message_id.get_scheduled_server_message_id() ==
|
||||
@ -1672,7 +1672,7 @@ int32 UpdatesManager::get_update_edit_message_pts(const telegram_api::Updates *u
|
||||
LOG(ERROR) << "Receive multiple edit message updates in " << to_string(*updates_ptr);
|
||||
pts = 0;
|
||||
} else if (pts == 0) {
|
||||
LOG(ERROR) << "Receive no edit message updates for " << full_message_id << " in " << to_string(*updates_ptr);
|
||||
LOG(ERROR) << "Receive no edit message updates for " << message_full_id << " in " << to_string(*updates_ptr);
|
||||
}
|
||||
return pts;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "td/telegram/ChannelId.h"
|
||||
#include "td/telegram/ChatId.h"
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/InputGroupCallId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/MessageId.h"
|
||||
#include "td/telegram/PtsManager.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
@ -125,7 +125,7 @@ class UpdatesManager final : public Actor {
|
||||
|
||||
static vector<DialogId> get_chat_dialog_ids(const telegram_api::Updates *updates_ptr);
|
||||
|
||||
static int32 get_update_edit_message_pts(const telegram_api::Updates *updates_ptr, FullMessageId full_message_id);
|
||||
static int32 get_update_edit_message_pts(const telegram_api::Updates *updates_ptr, MessageFullId message_full_id);
|
||||
|
||||
using TranscribedAudioHandler =
|
||||
std::function<void(Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>>)>;
|
||||
|
@ -170,40 +170,40 @@ void VideoNotesManager::create_video_note(FileId file_id, string minithumbnail,
|
||||
on_get_video_note(std::move(v), replace);
|
||||
}
|
||||
|
||||
void VideoNotesManager::register_video_note(FileId video_note_file_id, FullMessageId full_message_id,
|
||||
void VideoNotesManager::register_video_note(FileId video_note_file_id, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
|
||||
if (message_full_id.get_message_id().is_scheduled() || !message_full_id.get_message_id().is_server() ||
|
||||
td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "Register video note " << video_note_file_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Register video note " << video_note_file_id << " from " << message_full_id << " from " << source;
|
||||
CHECK(video_note_file_id.is_valid());
|
||||
bool is_inserted = video_note_messages_[video_note_file_id].insert(full_message_id).second;
|
||||
LOG_CHECK(is_inserted) << source << ' ' << video_note_file_id << ' ' << full_message_id;
|
||||
is_inserted = message_video_notes_.emplace(full_message_id, video_note_file_id).second;
|
||||
bool is_inserted = video_note_messages_[video_note_file_id].insert(message_full_id).second;
|
||||
LOG_CHECK(is_inserted) << source << ' ' << video_note_file_id << ' ' << message_full_id;
|
||||
is_inserted = message_video_notes_.emplace(message_full_id, video_note_file_id).second;
|
||||
CHECK(is_inserted);
|
||||
}
|
||||
|
||||
void VideoNotesManager::unregister_video_note(FileId video_note_file_id, FullMessageId full_message_id,
|
||||
void VideoNotesManager::unregister_video_note(FileId video_note_file_id, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
|
||||
if (message_full_id.get_message_id().is_scheduled() || !message_full_id.get_message_id().is_server() ||
|
||||
td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "Unregister video note " << video_note_file_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Unregister video note " << video_note_file_id << " from " << message_full_id << " from " << source;
|
||||
CHECK(video_note_file_id.is_valid());
|
||||
auto &message_ids = video_note_messages_[video_note_file_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << video_note_file_id << ' ' << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << video_note_file_id << ' ' << message_full_id;
|
||||
if (message_ids.empty()) {
|
||||
video_note_messages_.erase(video_note_file_id);
|
||||
}
|
||||
is_deleted = message_video_notes_.erase(full_message_id) > 0;
|
||||
is_deleted = message_video_notes_.erase(message_full_id) > 0;
|
||||
CHECK(is_deleted);
|
||||
}
|
||||
|
||||
void VideoNotesManager::recognize_speech(FullMessageId full_message_id, Promise<Unit> &&promise) {
|
||||
auto it = message_video_notes_.find(full_message_id);
|
||||
void VideoNotesManager::recognize_speech(MessageFullId message_full_id, Promise<Unit> &&promise) {
|
||||
auto it = message_video_notes_.find(message_full_id);
|
||||
CHECK(it != message_video_notes_.end());
|
||||
|
||||
auto file_id = it->second;
|
||||
@ -217,7 +217,7 @@ void VideoNotesManager::recognize_speech(FullMessageId full_message_id, Promise<
|
||||
file_id](Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>> r_update) {
|
||||
send_closure(actor_id, &VideoNotesManager::on_transcribed_audio_update, file_id, true, std::move(r_update));
|
||||
};
|
||||
if (video_note->transcription_info->recognize_speech(td_, full_message_id, std::move(promise), std::move(handler))) {
|
||||
if (video_note->transcription_info->recognize_speech(td_, message_full_id, std::move(promise), std::move(handler))) {
|
||||
on_video_note_transcription_updated(file_id);
|
||||
}
|
||||
}
|
||||
@ -265,8 +265,8 @@ void VideoNotesManager::on_transcribed_audio_update(
|
||||
void VideoNotesManager::on_video_note_transcription_updated(FileId file_id) {
|
||||
auto it = video_note_messages_.find(file_id);
|
||||
if (it != video_note_messages_.end()) {
|
||||
for (const auto &full_message_id : it->second) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : it->second) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -274,14 +274,14 @@ void VideoNotesManager::on_video_note_transcription_updated(FileId file_id) {
|
||||
void VideoNotesManager::on_video_note_transcription_completed(FileId file_id) {
|
||||
auto it = video_note_messages_.find(file_id);
|
||||
if (it != video_note_messages_.end()) {
|
||||
for (const auto &full_message_id : it->second) {
|
||||
td_->messages_manager_->on_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : it->second) {
|
||||
td_->messages_manager_->on_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VideoNotesManager::rate_speech_recognition(FullMessageId full_message_id, bool is_good, Promise<Unit> &&promise) {
|
||||
auto it = message_video_notes_.find(full_message_id);
|
||||
void VideoNotesManager::rate_speech_recognition(MessageFullId message_full_id, bool is_good, Promise<Unit> &&promise) {
|
||||
auto it = message_video_notes_.find(message_full_id);
|
||||
CHECK(it != message_video_notes_.end());
|
||||
|
||||
auto file_id = it->second;
|
||||
@ -290,7 +290,7 @@ void VideoNotesManager::rate_speech_recognition(FullMessageId full_message_id, b
|
||||
if (video_note->transcription_info == nullptr) {
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
video_note->transcription_info->rate_speech_recognition(td_, full_message_id, is_good, std::move(promise));
|
||||
video_note->transcription_info->rate_speech_recognition(td_, message_full_id, is_good, std::move(promise));
|
||||
}
|
||||
|
||||
SecretInputMedia VideoNotesManager::get_secret_input_media(FileId video_note_file_id,
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "td/telegram/Dimensions.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/PhotoSize.h"
|
||||
#include "td/telegram/SecretInputMedia.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
@ -45,13 +45,13 @@ class VideoNotesManager final : public Actor {
|
||||
void create_video_note(FileId file_id, string minithumbnail, PhotoSize thumbnail, int32 duration,
|
||||
Dimensions dimensions, string waveform, bool replace);
|
||||
|
||||
void register_video_note(FileId video_note_file_id, FullMessageId full_message_id, const char *source);
|
||||
void register_video_note(FileId video_note_file_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_video_note(FileId video_note_file_id, FullMessageId full_message_id, const char *source);
|
||||
void unregister_video_note(FileId video_note_file_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void recognize_speech(FullMessageId full_message_id, Promise<Unit> &&promise);
|
||||
void recognize_speech(MessageFullId message_full_id, Promise<Unit> &&promise);
|
||||
|
||||
void rate_speech_recognition(FullMessageId full_message_id, bool is_good, Promise<Unit> &&promise);
|
||||
void rate_speech_recognition(MessageFullId message_full_id, bool is_good, Promise<Unit> &&promise);
|
||||
|
||||
tl_object_ptr<telegram_api::InputMedia> get_input_media(FileId file_id,
|
||||
tl_object_ptr<telegram_api::InputFile> input_file,
|
||||
@ -108,8 +108,8 @@ class VideoNotesManager final : public Actor {
|
||||
|
||||
WaitFreeHashMap<FileId, unique_ptr<VideoNote>, FileIdHash> video_notes_;
|
||||
|
||||
FlatHashMap<FileId, FlatHashSet<FullMessageId, FullMessageIdHash>, FileIdHash> video_note_messages_;
|
||||
FlatHashMap<FullMessageId, FileId, FullMessageIdHash> message_video_notes_;
|
||||
FlatHashMap<FileId, FlatHashSet<MessageFullId, MessageFullIdHash>, FileIdHash> video_note_messages_;
|
||||
FlatHashMap<MessageFullId, FileId, MessageFullIdHash> message_video_notes_;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
@ -134,40 +134,40 @@ void VoiceNotesManager::create_voice_note(FileId file_id, string mime_type, int3
|
||||
on_get_voice_note(std::move(v), replace);
|
||||
}
|
||||
|
||||
void VoiceNotesManager::register_voice_note(FileId voice_note_file_id, FullMessageId full_message_id,
|
||||
void VoiceNotesManager::register_voice_note(FileId voice_note_file_id, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
|
||||
if (message_full_id.get_message_id().is_scheduled() || !message_full_id.get_message_id().is_server() ||
|
||||
td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "Register voice note " << voice_note_file_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Register voice note " << voice_note_file_id << " from " << message_full_id << " from " << source;
|
||||
CHECK(voice_note_file_id.is_valid());
|
||||
bool is_inserted = voice_note_messages_[voice_note_file_id].insert(full_message_id).second;
|
||||
LOG_CHECK(is_inserted) << source << ' ' << voice_note_file_id << ' ' << full_message_id;
|
||||
is_inserted = message_voice_notes_.emplace(full_message_id, voice_note_file_id).second;
|
||||
bool is_inserted = voice_note_messages_[voice_note_file_id].insert(message_full_id).second;
|
||||
LOG_CHECK(is_inserted) << source << ' ' << voice_note_file_id << ' ' << message_full_id;
|
||||
is_inserted = message_voice_notes_.emplace(message_full_id, voice_note_file_id).second;
|
||||
CHECK(is_inserted);
|
||||
}
|
||||
|
||||
void VoiceNotesManager::unregister_voice_note(FileId voice_note_file_id, FullMessageId full_message_id,
|
||||
void VoiceNotesManager::unregister_voice_note(FileId voice_note_file_id, MessageFullId message_full_id,
|
||||
const char *source) {
|
||||
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
|
||||
if (message_full_id.get_message_id().is_scheduled() || !message_full_id.get_message_id().is_server() ||
|
||||
td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "Unregister voice note " << voice_note_file_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Unregister voice note " << voice_note_file_id << " from " << message_full_id << " from " << source;
|
||||
CHECK(voice_note_file_id.is_valid());
|
||||
auto &message_ids = voice_note_messages_[voice_note_file_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << voice_note_file_id << ' ' << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << ' ' << voice_note_file_id << ' ' << message_full_id;
|
||||
if (message_ids.empty()) {
|
||||
voice_note_messages_.erase(voice_note_file_id);
|
||||
}
|
||||
is_deleted = message_voice_notes_.erase(full_message_id) > 0;
|
||||
is_deleted = message_voice_notes_.erase(message_full_id) > 0;
|
||||
CHECK(is_deleted);
|
||||
}
|
||||
|
||||
void VoiceNotesManager::recognize_speech(FullMessageId full_message_id, Promise<Unit> &&promise) {
|
||||
auto it = message_voice_notes_.find(full_message_id);
|
||||
void VoiceNotesManager::recognize_speech(MessageFullId message_full_id, Promise<Unit> &&promise) {
|
||||
auto it = message_voice_notes_.find(message_full_id);
|
||||
CHECK(it != message_voice_notes_.end());
|
||||
|
||||
auto file_id = it->second;
|
||||
@ -181,7 +181,7 @@ void VoiceNotesManager::recognize_speech(FullMessageId full_message_id, Promise<
|
||||
file_id](Result<telegram_api::object_ptr<telegram_api::updateTranscribedAudio>> r_update) {
|
||||
send_closure(actor_id, &VoiceNotesManager::on_transcribed_audio_update, file_id, true, std::move(r_update));
|
||||
};
|
||||
if (voice_note->transcription_info->recognize_speech(td_, full_message_id, std::move(promise), std::move(handler))) {
|
||||
if (voice_note->transcription_info->recognize_speech(td_, message_full_id, std::move(promise), std::move(handler))) {
|
||||
on_voice_note_transcription_updated(file_id);
|
||||
}
|
||||
}
|
||||
@ -229,8 +229,8 @@ void VoiceNotesManager::on_transcribed_audio_update(
|
||||
void VoiceNotesManager::on_voice_note_transcription_updated(FileId file_id) {
|
||||
auto it = voice_note_messages_.find(file_id);
|
||||
if (it != voice_note_messages_.end()) {
|
||||
for (const auto &full_message_id : it->second) {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : it->second) {
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,14 +238,14 @@ void VoiceNotesManager::on_voice_note_transcription_updated(FileId file_id) {
|
||||
void VoiceNotesManager::on_voice_note_transcription_completed(FileId file_id) {
|
||||
auto it = voice_note_messages_.find(file_id);
|
||||
if (it != voice_note_messages_.end()) {
|
||||
for (const auto &full_message_id : it->second) {
|
||||
td_->messages_manager_->on_update_message_content(full_message_id);
|
||||
for (const auto &message_full_id : it->second) {
|
||||
td_->messages_manager_->on_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoiceNotesManager::rate_speech_recognition(FullMessageId full_message_id, bool is_good, Promise<Unit> &&promise) {
|
||||
auto it = message_voice_notes_.find(full_message_id);
|
||||
void VoiceNotesManager::rate_speech_recognition(MessageFullId message_full_id, bool is_good, Promise<Unit> &&promise) {
|
||||
auto it = message_voice_notes_.find(message_full_id);
|
||||
CHECK(it != message_voice_notes_.end());
|
||||
|
||||
auto file_id = it->second;
|
||||
@ -254,7 +254,7 @@ void VoiceNotesManager::rate_speech_recognition(FullMessageId full_message_id, b
|
||||
if (voice_note->transcription_info == nullptr) {
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
voice_note->transcription_info->rate_speech_recognition(td_, full_message_id, is_good, std::move(promise));
|
||||
voice_note->transcription_info->rate_speech_recognition(td_, message_full_id, is_good, std::move(promise));
|
||||
}
|
||||
|
||||
SecretInputMedia VoiceNotesManager::get_secret_input_media(FileId voice_note_file_id,
|
||||
|
@ -7,7 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/SecretInputMedia.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
@ -41,13 +41,13 @@ class VoiceNotesManager final : public Actor {
|
||||
|
||||
void create_voice_note(FileId file_id, string mime_type, int32 duration, string waveform, bool replace);
|
||||
|
||||
void register_voice_note(FileId voice_note_file_id, FullMessageId full_message_id, const char *source);
|
||||
void register_voice_note(FileId voice_note_file_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_voice_note(FileId voice_note_file_id, FullMessageId full_message_id, const char *source);
|
||||
void unregister_voice_note(FileId voice_note_file_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void recognize_speech(FullMessageId full_message_id, Promise<Unit> &&promise);
|
||||
void recognize_speech(MessageFullId message_full_id, Promise<Unit> &&promise);
|
||||
|
||||
void rate_speech_recognition(FullMessageId full_message_id, bool is_good, Promise<Unit> &&promise);
|
||||
void rate_speech_recognition(MessageFullId message_full_id, bool is_good, Promise<Unit> &&promise);
|
||||
|
||||
tl_object_ptr<telegram_api::InputMedia> get_input_media(FileId file_id,
|
||||
tl_object_ptr<telegram_api::InputFile> input_file) const;
|
||||
@ -97,8 +97,8 @@ class VoiceNotesManager final : public Actor {
|
||||
|
||||
WaitFreeHashMap<FileId, unique_ptr<VoiceNote>, FileIdHash> voice_notes_;
|
||||
|
||||
FlatHashMap<FileId, FlatHashSet<FullMessageId, FullMessageIdHash>, FileIdHash> voice_note_messages_;
|
||||
FlatHashMap<FullMessageId, FileId, FullMessageIdHash> message_voice_notes_;
|
||||
FlatHashMap<FileId, FlatHashSet<MessageFullId, MessageFullIdHash>, FileIdHash> voice_note_messages_;
|
||||
FlatHashMap<MessageFullId, FileId, MessageFullIdHash> message_voice_notes_;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
@ -769,30 +769,30 @@ void WebPagesManager::on_get_web_page_by_url(const string &url, WebPageId web_pa
|
||||
cached_web_page_id = web_page_id;
|
||||
}
|
||||
|
||||
void WebPagesManager::register_web_page(WebPageId web_page_id, FullMessageId full_message_id, const char *source) {
|
||||
void WebPagesManager::register_web_page(WebPageId web_page_id, MessageFullId message_full_id, const char *source) {
|
||||
if (!web_page_id.is_valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Register " << web_page_id << " from " << full_message_id << " from " << source;
|
||||
bool is_inserted = web_page_messages_[web_page_id].insert(full_message_id).second;
|
||||
LOG_CHECK(is_inserted) << source << " " << web_page_id << " " << full_message_id;
|
||||
LOG(INFO) << "Register " << web_page_id << " from " << message_full_id << " from " << source;
|
||||
bool is_inserted = web_page_messages_[web_page_id].insert(message_full_id).second;
|
||||
LOG_CHECK(is_inserted) << source << " " << web_page_id << " " << message_full_id;
|
||||
|
||||
if (!td_->auth_manager_->is_bot() && !have_web_page_force(web_page_id)) {
|
||||
LOG(INFO) << "Waiting for " << web_page_id << " needed in " << full_message_id;
|
||||
LOG(INFO) << "Waiting for " << web_page_id << " needed in " << message_full_id;
|
||||
pending_web_pages_timeout_.add_timeout_in(web_page_id.get(), 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
void WebPagesManager::unregister_web_page(WebPageId web_page_id, FullMessageId full_message_id, const char *source) {
|
||||
void WebPagesManager::unregister_web_page(WebPageId web_page_id, MessageFullId message_full_id, const char *source) {
|
||||
if (!web_page_id.is_valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Unregister " << web_page_id << " from " << full_message_id << " from " << source;
|
||||
LOG(INFO) << "Unregister " << web_page_id << " from " << message_full_id << " from " << source;
|
||||
auto &message_ids = web_page_messages_[web_page_id];
|
||||
auto is_deleted = message_ids.erase(full_message_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << web_page_id << " " << full_message_id;
|
||||
auto is_deleted = message_ids.erase(message_full_id) > 0;
|
||||
LOG_CHECK(is_deleted) << source << " " << web_page_id << " " << message_full_id;
|
||||
|
||||
if (message_ids.empty()) {
|
||||
web_page_messages_.erase(web_page_id);
|
||||
@ -1357,27 +1357,27 @@ void WebPagesManager::on_web_page_changed(WebPageId web_page_id, bool have_web_p
|
||||
LOG(INFO) << "Updated " << web_page_id;
|
||||
auto it = web_page_messages_.find(web_page_id);
|
||||
if (it != web_page_messages_.end()) {
|
||||
vector<FullMessageId> full_message_ids;
|
||||
for (const auto &full_message_id : it->second) {
|
||||
full_message_ids.push_back(full_message_id);
|
||||
vector<MessageFullId> message_full_ids;
|
||||
for (const auto &message_full_id : it->second) {
|
||||
message_full_ids.push_back(message_full_id);
|
||||
}
|
||||
CHECK(!full_message_ids.empty());
|
||||
for (const auto &full_message_id : full_message_ids) {
|
||||
CHECK(!message_full_ids.empty());
|
||||
for (const auto &message_full_id : message_full_ids) {
|
||||
if (!have_web_page) {
|
||||
td_->messages_manager_->delete_pending_message_web_page(full_message_id);
|
||||
td_->messages_manager_->delete_pending_message_web_page(message_full_id);
|
||||
} else {
|
||||
td_->messages_manager_->on_external_update_message_content(full_message_id);
|
||||
td_->messages_manager_->on_external_update_message_content(message_full_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool is_ok = (have_web_page ? web_page_messages_[web_page_id].size() == full_message_ids.size()
|
||||
bool is_ok = (have_web_page ? web_page_messages_[web_page_id].size() == message_full_ids.size()
|
||||
: web_page_messages_.count(web_page_id) == 0);
|
||||
if (!is_ok) {
|
||||
vector<FullMessageId> new_full_message_ids;
|
||||
for (const auto &full_message_id : web_page_messages_[web_page_id]) {
|
||||
new_full_message_ids.push_back(full_message_id);
|
||||
vector<MessageFullId> new_message_full_ids;
|
||||
for (const auto &message_full_id : web_page_messages_[web_page_id]) {
|
||||
new_message_full_ids.push_back(message_full_id);
|
||||
}
|
||||
LOG_CHECK(is_ok) << have_web_page << ' ' << full_message_ids << ' ' << new_full_message_ids;
|
||||
LOG_CHECK(is_ok) << have_web_page << ' ' << message_full_ids << ' ' << new_message_full_ids;
|
||||
}
|
||||
}
|
||||
auto get_it = pending_get_web_pages_.find(web_page_id);
|
||||
@ -1436,16 +1436,16 @@ void WebPagesManager::on_pending_web_page_timeout(WebPageId web_page_id) {
|
||||
int32 count = 0;
|
||||
auto it = web_page_messages_.find(web_page_id);
|
||||
if (it != web_page_messages_.end()) {
|
||||
vector<FullMessageId> full_message_ids;
|
||||
for (const auto &full_message_id : it->second) {
|
||||
if (full_message_id.get_dialog_id().get_type() != DialogType::SecretChat) {
|
||||
full_message_ids.push_back(full_message_id);
|
||||
vector<MessageFullId> message_full_ids;
|
||||
for (const auto &message_full_id : it->second) {
|
||||
if (message_full_id.get_dialog_id().get_type() != DialogType::SecretChat) {
|
||||
message_full_ids.push_back(message_full_id);
|
||||
}
|
||||
count++;
|
||||
}
|
||||
if (!full_message_ids.empty()) {
|
||||
if (!message_full_ids.empty()) {
|
||||
send_closure_later(G()->messages_manager(), &MessagesManager::get_messages_from_server,
|
||||
std::move(full_message_ids), Promise<Unit>(), "on_pending_web_page_timeout", nullptr);
|
||||
std::move(message_full_ids), Promise<Unit>(), "on_pending_web_page_timeout", nullptr);
|
||||
}
|
||||
}
|
||||
auto get_it = pending_get_web_pages_.find(web_page_id);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "td/telegram/DialogId.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileSourceId.h"
|
||||
#include "td/telegram/FullMessageId.h"
|
||||
#include "td/telegram/MessageFullId.h"
|
||||
#include "td/telegram/SecretInputMedia.h"
|
||||
#include "td/telegram/StoryFullId.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
@ -52,9 +52,9 @@ class WebPagesManager final : public Actor {
|
||||
|
||||
void on_get_web_page_instant_view_view_count(WebPageId web_page_id, int32 view_count);
|
||||
|
||||
void register_web_page(WebPageId web_page_id, FullMessageId full_message_id, const char *source);
|
||||
void register_web_page(WebPageId web_page_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
void unregister_web_page(WebPageId web_page_id, FullMessageId full_message_id, const char *source);
|
||||
void unregister_web_page(WebPageId web_page_id, MessageFullId message_full_id, const char *source);
|
||||
|
||||
bool have_web_page(WebPageId web_page_id) const;
|
||||
|
||||
@ -183,7 +183,7 @@ class WebPagesManager final : public Actor {
|
||||
};
|
||||
FlatHashMap<WebPageId, PendingWebPageInstantViewQueries, WebPageIdHash> load_web_page_instant_view_queries_;
|
||||
|
||||
FlatHashMap<WebPageId, FlatHashSet<FullMessageId, FullMessageIdHash>, WebPageIdHash> web_page_messages_;
|
||||
FlatHashMap<WebPageId, FlatHashSet<MessageFullId, MessageFullIdHash>, WebPageIdHash> web_page_messages_;
|
||||
|
||||
FlatHashMap<WebPageId, vector<std::pair<string, Promise<td_api::object_ptr<td_api::webPage>>>>, WebPageIdHash>
|
||||
pending_get_web_pages_;
|
||||
|
Loading…
Reference in New Issue
Block a user