Merge remote-tracking branch 'td/master'

This commit is contained in:
Andrea Cavalli 2021-08-02 10:47:33 +02:00
commit 4286622a5a
25 changed files with 248 additions and 203 deletions

View File

@ -487,6 +487,7 @@ set(TDLIB_SOURCE
td/telegram/Document.h
td/telegram/DocumentsManager.h
td/telegram/DraftMessage.h
td/telegram/EncryptedFile.h
td/telegram/FileReferenceManager.h
td/telegram/files/FileBitmask.h
td/telegram/files/FileData.h

View File

@ -51,7 +51,19 @@ bool TD_TL_writer::is_combinator_supported(const tl::tl_combinator *constructor)
bool TD_TL_writer::is_default_constructor_generated(const tl::tl_combinator *t, bool can_be_parsed,
bool can_be_stored) const {
return tl_name == "td_api" || tl_name == "TdApi" || (t->var_count > 0 && can_be_parsed);
return tl_name == "td_api" || tl_name == "TdApi" || (t->var_count > 0 && can_be_parsed) || t->name == "updates";
}
bool TD_TL_writer::is_full_constructor_generated(const tl::tl_combinator *t, bool can_be_parsed,
bool can_be_stored) const {
return tl_name == "td_api" || tl_name == "TdApi" || can_be_stored || t->name == "phone.groupParticipants" ||
t->name == "user" || t->name == "userProfilePhoto" || t->name == "channelForbidden" ||
t->name == "photoSizeEmpty" || t->name == "photoSize" || t->name == "photoCachedSize" ||
t->name == "document" || t->name == "updateDeleteMessages" || t->name == "updateEditChannelMessage" ||
t->name == "encryptedChatWaiting" || t->name == "encryptedChatRequested" || t->name == "encryptedChat" ||
t->name == "langPackString" || t->name == "langPackStringPluralized" || t->name == "langPackStringDeleted" ||
t->name == "peerUser" || t->name == "peerChat" || t->name == "updateServiceNotification" ||
t->name == "updateNewMessage" || t->name == "message" || t->name == "updateChannelTooLong";
}
int TD_TL_writer::get_storer_type(const tl::tl_combinator *t, const std::string &storer_name) const {

View File

@ -37,6 +37,7 @@ class TD_TL_writer : public tl::TL_writer {
bool is_combinator_supported(const tl::tl_combinator *constructor) const override;
bool is_default_constructor_generated(const tl::tl_combinator *t, bool can_be_parsed,
bool can_be_stored) const override;
bool is_full_constructor_generated(const tl::tl_combinator *t, bool can_be_parsed, bool can_be_stored) const override;
int get_storer_type(const tl::tl_combinator *t, const std::string &storer_name) const override;
Mode get_parser_mode(int type) const override;

View File

@ -1502,8 +1502,7 @@ class DeleteChatQuery final : public Td::ResultHandler {
LOG(INFO) << "Receive result for DeleteChatQuery: " << result_ptr.ok();
td->updates_manager_->get_difference("DeleteChatQuery");
td->updates_manager_->on_get_updates(make_tl_object<telegram_api::updates>(Auto(), Auto(), Auto(), 0, 0),
std::move(promise_));
td->updates_manager_->on_get_updates(make_tl_object<telegram_api::updates>(), std::move(promise_));
}
void on_error(uint64 id, Status status) final {
@ -9365,7 +9364,7 @@ void ContactsManager::on_load_user_full_from_database(UserId user_id, string val
if (is_user_deleted(user_id)) {
drop_user_full(user_id);
} else if (user_full->expires_at == 0.0) {
load_user_full(user_id, true, Auto());
load_user_full(user_id, true, Auto(), "on_load_user_full_from_database");
}
}
@ -9606,7 +9605,7 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s
update_channel_full(channel_full, channel_id, true);
if (channel_full->expires_at == 0.0) {
load_channel_full(channel_id, true, Auto());
load_channel_full(channel_id, true, Auto(), "on_load_channel_full_from_database");
}
}
@ -11272,7 +11271,7 @@ bool ContactsManager::delete_profile_photo_from_cache(UserId user_id, int64 prof
user_full->photo = Photo();
user_full->is_changed = true;
load_user_full(user_id, true, Auto());
load_user_full(user_id, true, Auto(), "delete_profile_photo_from_cache");
}
if (send_updates) {
update_user_full(user_full, user_id);
@ -11332,7 +11331,7 @@ void ContactsManager::drop_user_photos(UserId user_id, bool is_empty, bool drop_
user_full->expires_at = 0.0;
user_full->need_save_to_database = true;
}
load_user_full(user_id, true, Auto());
load_user_full(user_id, true, Auto(), "drop_user_photos");
}
update_user_full(user_full, user_id);
}
@ -13744,7 +13743,7 @@ void ContactsManager::reload_user(UserId user_id, Promise<Unit> &&promise) {
td_->create_handler<GetUsersQuery>(std::move(promise))->send(std::move(users));
}
bool ContactsManager::load_user_full(UserId user_id, bool force, Promise<Unit> &&promise) {
bool ContactsManager::load_user_full(UserId user_id, bool force, Promise<Unit> &&promise, const char *source) {
auto u = get_user(user_id);
if (u == nullptr) {
promise.set_error(Status::Error(6, "User not found"));
@ -13759,7 +13758,7 @@ bool ContactsManager::load_user_full(UserId user_id, bool force, Promise<Unit> &
return false;
}
send_get_user_full_query(user_id, std::move(input_user), std::move(promise), "load_user_full");
send_get_user_full_query(user_id, std::move(input_user), std::move(promise), source);
return false;
}
if (user_full->is_expired()) {
@ -14373,10 +14372,10 @@ ContactsManager::ChannelFull *ContactsManager::add_channel_full(ChannelId channe
return channel_full_ptr.get();
}
bool ContactsManager::load_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise) {
auto channel_full = get_channel_full_force(channel_id, "load_channel_full");
bool ContactsManager::load_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise, const char *source) {
auto channel_full = get_channel_full_force(channel_id, source);
if (channel_full == nullptr) {
send_get_channel_full_query(channel_full, channel_id, std::move(promise), "load_channel_full");
send_get_channel_full_query(channel_full, channel_id, std::move(promise), source);
return false;
}
if (channel_full->is_expired()) {
@ -14402,7 +14401,11 @@ void ContactsManager::send_get_channel_full_query(ChannelFull *channel_full, Cha
Promise<Unit> &&promise, const char *source) {
auto input_channel = get_input_channel(channel_id);
if (input_channel == nullptr) {
return promise.set_error(Status::Error(6, "Supergroup not found"));
return promise.set_error(Status::Error(400, "Supergroup not found"));
}
if (!have_input_peer_channel(channel_id, AccessRights::Read)) {
return promise.set_error(Status::Error(400, "Can't access the chat"));
}
if (channel_full != nullptr) {

View File

@ -463,7 +463,7 @@ class ContactsManager final : public Actor {
UserId get_me(Promise<Unit> &&promise);
bool get_user(UserId user_id, int left_tries, Promise<Unit> &&promise);
void reload_user(UserId user_id, Promise<Unit> &&promise);
bool load_user_full(UserId user_id, bool force, Promise<Unit> &&promise);
bool load_user_full(UserId user_id, bool force, Promise<Unit> &&promise, const char *source);
void reload_user_full(UserId user_id);
std::pair<int32, vector<const Photo *>> get_user_profile_photos(UserId user_id, int32 offset, int32 limit,
@ -490,7 +490,7 @@ class ContactsManager final : public Actor {
bool have_channel_force(ChannelId channel_id);
bool get_channel(ChannelId channel_id, int left_tries, Promise<Unit> &&promise);
void reload_channel(ChannelId chnanel_id, Promise<Unit> &&promise);
bool load_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise);
bool load_channel_full(ChannelId channel_id, bool force, Promise<Unit> &&promise, const char *source);
FileSourceId get_channel_full_file_source_id(ChannelId channel_id);
void reload_channel_full(ChannelId channel_id, Promise<Unit> &&promise, const char *source);

View File

@ -122,11 +122,16 @@ Document DocumentsManager::on_get_document(RemoteDocument remote_document, Dialo
}
if (animated != nullptr) {
// video animation
type_attributes--;
if ((video->flags_ & telegram_api::documentAttributeVideo::ROUND_MESSAGE_MASK) != 0) {
// video note without sound
animated = nullptr;
} else {
// video animation
video = nullptr;
}
}
}
if (animated != nullptr && audio != nullptr) {
// animation send as audio
type_attributes--;

View File

@ -12,6 +12,7 @@
#include "td/telegram/DialogId.h"
#include "td/telegram/Document.h"
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/Photo.h"
#include "td/telegram/SecretInputMedia.h"
@ -35,7 +36,7 @@ class DocumentsManager {
public:
tl_object_ptr<telegram_api::document> document;
// or
tl_object_ptr<telegram_api::encryptedFile> secret_file;
unique_ptr<EncryptedFile> secret_file;
tl_object_ptr<secret_api::decryptedMessageMediaDocument> secret_document;
// or
tl_object_ptr<telegram_api::WebDocument> web_document;
@ -62,7 +63,7 @@ class DocumentsManager {
, attributes(std::move(attributes)) {
}
RemoteDocument(tl_object_ptr<telegram_api::encryptedFile> &&secret_file,
RemoteDocument(unique_ptr<EncryptedFile> &&secret_file,
tl_object_ptr<secret_api::decryptedMessageMediaDocument> &&secret_document,
vector<tl_object_ptr<telegram_api::DocumentAttribute>> &&attributes)
: document(nullptr)

View File

@ -0,0 +1,73 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/telegram_api.h"
#include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/StringBuilder.h"
#include "td/utils/tl_helpers.h"
namespace td {
struct EncryptedFile {
static constexpr int32 MAGIC = 0x473d738a;
int64 id_ = 0;
int64 access_hash_ = 0;
int32 size_ = 0;
int32 dc_id_ = 0;
int32 key_fingerprint_ = 0;
EncryptedFile() = default;
EncryptedFile(int64 id, int64 access_hash, int32 size, int32 dc_id, int32 key_fingerprint)
: id_(id), access_hash_(access_hash), size_(size), dc_id_(dc_id), key_fingerprint_(key_fingerprint) {
}
static unique_ptr<EncryptedFile> get_encrypted_file(tl_object_ptr<telegram_api::EncryptedFile> file_ptr) {
if (file_ptr == nullptr || file_ptr->get_id() != telegram_api::encryptedFile::ID) {
return nullptr;
}
auto file = move_tl_object_as<telegram_api::encryptedFile>(file_ptr);
return make_unique<EncryptedFile>(file->id_, file->access_hash_, file->size_, file->dc_id_, file->key_fingerprint_);
}
template <class StorerT>
void store(StorerT &storer) const {
using td::store;
store(MAGIC, storer);
store(id_, storer);
store(access_hash_, storer);
store(size_, storer);
store(dc_id_, storer);
store(key_fingerprint_, storer);
}
template <class ParserT>
void parse(ParserT &parser) {
using td::parse;
int32 got_magic;
parse(got_magic, parser);
parse(id_, parser);
parse(access_hash_, parser);
parse(size_, parser);
parse(dc_id_, parser);
parse(key_fingerprint_, parser);
if (got_magic != MAGIC) {
parser.set_error("EncryptedFile magic mismatch");
}
}
};
inline StringBuilder &operator<<(StringBuilder &sb, const EncryptedFile &file) {
return sb << "[" << tag("id", file.id_) << tag("access_hash", file.access_hash_) << tag("size", file.size_)
<< tag("dc_id", file.dc_id_) << tag("key_fingerprint", file.key_fingerprint_) << "]";
}
} // namespace td

View File

@ -3789,7 +3789,7 @@ static unique_ptr<MessageContent> get_document_message_content(Td *td, tl_object
}
unique_ptr<MessageContent> get_secret_message_content(
Td *td, string message_text, tl_object_ptr<telegram_api::encryptedFile> file,
Td *td, string message_text, unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::DecryptedMessageMedia> &&media,
vector<tl_object_ptr<secret_api::MessageEntity>> &&secret_entities, DialogId owner_dialog_id,
MultiPromiseActor &load_data_multipromise) {

View File

@ -7,6 +7,7 @@
#pragma once
#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"
@ -176,7 +177,7 @@ void unregister_message_content(Td *td, const MessageContent *content, FullMessa
const char *source);
unique_ptr<MessageContent> get_secret_message_content(
Td *td, string message_text, tl_object_ptr<telegram_api::encryptedFile> file,
Td *td, string message_text, unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::DecryptedMessageMedia> &&media,
vector<tl_object_ptr<secret_api::MessageEntity>> &&secret_entities, DialogId owner_dialog_id,
MultiPromiseActor &load_data_multipromise);

View File

@ -1737,7 +1737,7 @@ class ToggleDialogIsBlockedQuery final : public Td::ResultHandler {
}
if (!G()->close_flag()) {
td->messages_manager_->on_update_dialog_is_blocked(dialog_id_, !is_blocked_);
td->messages_manager_->get_dialog_info_full(dialog_id_, Auto());
td->messages_manager_->get_dialog_info_full(dialog_id_, Auto(), "ToggleDialogIsBlockedQuery");
td->messages_manager_->reget_dialog_action_bar(dialog_id_, "ToggleDialogIsBlockedQuery");
}
promise_.set_error(std::move(status));
@ -4374,12 +4374,7 @@ class UpdatePeerSettingsQuery final : public Td::ResultHandler {
return on_error(id, result_ptr.move_as_error());
}
td->messages_manager_->on_get_peer_settings(
dialog_id_,
make_tl_object<telegram_api::peerSettings>(0, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, 0),
true);
td->messages_manager_->on_get_peer_settings(dialog_id_, make_tl_object<telegram_api::peerSettings>(), true);
promise_.set_value(Unit());
}
@ -4416,12 +4411,7 @@ class ReportEncryptedSpamQuery final : public Td::ResultHandler {
return on_error(id, result_ptr.move_as_error());
}
td->messages_manager_->on_get_peer_settings(
dialog_id_,
make_tl_object<telegram_api::peerSettings>(0, false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, false /*ignored*/,
false /*ignored*/, false /*ignored*/, 0),
true);
td->messages_manager_->on_get_peer_settings(dialog_id_, make_tl_object<telegram_api::peerSettings>(), true);
promise_.set_value(Unit());
}
@ -4586,7 +4576,7 @@ class EditPeerFoldersQuery final : public Td::ResultHandler {
}
// trying to repair folder ID for this dialog
td->messages_manager_->get_dialog_info_full(dialog_id_, Auto());
td->messages_manager_->get_dialog_info_full(dialog_id_, Auto(), "EditPeerFoldersQuery");
promise_.set_error(std::move(status));
}
@ -6959,8 +6949,8 @@ bool MessagesManager::is_active_message_reply_info(DialogId dialog_id, const Mes
auto linked_channel_id = td_->contacts_manager_->get_channel_linked_channel_id(channel_id);
if (!linked_channel_id.is_valid()) {
// keep the comment button while linked channel is unknown
send_closure_later(G()->contacts_manager(), &ContactsManager::load_channel_full, channel_id, false,
Promise<Unit>());
send_closure_later(G()->contacts_manager(), &ContactsManager::load_channel_full, channel_id, false, Promise<Unit>(),
"is_active_message_reply_info");
return true;
}
@ -7507,7 +7497,7 @@ void MessagesManager::add_pending_channel_update(DialogId dialog_id, tl_object_p
// if there is no dialog, it can be created by the update
LOG(INFO) << "Receive pending update from " << source << " about unknown " << dialog_id;
if (running_get_channel_difference(dialog_id)) {
promise.set_value(Unit());
add_postponed_channel_update(dialog_id, std::move(update), new_pts, pts_count, std::move(promise));
return;
}
} else {
@ -11548,7 +11538,7 @@ void MessagesManager::repair_channel_server_unread_count(Dialog *d) {
}
LOG(INFO) << "Reload ChannelFull for " << d->dialog_id << " to repair unread message counts";
get_dialog_info_full(d->dialog_id, Auto());
get_dialog_info_full(d->dialog_id, Auto(), "repair_channel_server_unread_count");
}
void MessagesManager::read_history_inbox(DialogId dialog_id, MessageId max_message_id, int32 unread_count,
@ -12997,15 +12987,13 @@ void MessagesManager::on_send_secret_message_error(int64 random_id, Status error
}
void MessagesManager::on_send_secret_message_success(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file_ptr,
Promise<> promise) {
unique_ptr<EncryptedFile> file, Promise<> promise) {
promise.set_value(Unit()); // TODO: set after message is saved
FileId new_file_id;
if (file_ptr != nullptr && file_ptr->get_id() == telegram_api::encryptedFile::ID) {
auto file = move_tl_object_as<telegram_api::encryptedFile>(file_ptr);
if (file != nullptr) {
if (!DcId::is_valid(file->dc_id_)) {
LOG(ERROR) << "Wrong dc_id = " << file->dc_id_ << " in file " << to_string(file);
LOG(ERROR) << "Wrong dc_id = " << file->dc_id_ << " in file " << *file;
} else {
DialogId owner_dialog_id;
auto it = being_sent_messages_.find(random_id);
@ -13198,7 +13186,7 @@ void MessagesManager::on_update_secret_chat_state(SecretChatId secret_chat_id, S
}
void MessagesManager::on_get_secret_message(SecretChatId secret_chat_id, UserId user_id, MessageId message_id,
int32 date, tl_object_ptr<telegram_api::encryptedFile> file,
int32 date, unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) {
LOG(DEBUG) << "On get " << to_string(message);
CHECK(message != nullptr);
@ -13902,7 +13890,8 @@ FullMessageId MessagesManager::on_get_message(MessageInfo &&message_info, bool f
need_update = false;
if (old_message_id.is_valid() && message_id.is_valid() && message_id < old_message_id) {
if (old_message_id.is_valid() && message_id.is_valid() && message_id < old_message_id &&
!can_overflow_message_id(dialog_id)) {
LOG(ERROR) << "Sent " << old_message_id << " to " << dialog_id << " as " << message_id;
}
@ -14716,14 +14705,12 @@ void MessagesManager::on_get_dialogs(FolderId folder_id, vector<tl_object_ptr<te
if (!d->is_is_blocked_inited && !td_->auth_manager_->is_bot()) {
// asynchronously get is_blocked from the server
// TODO add is_blocked to telegram_api::dialog
get_dialog_info_full(dialog_id, Auto());
}
if (!d->is_has_bots_inited && !td_->auth_manager_->is_bot()) {
get_dialog_info_full(dialog_id, Auto(), "on_get_dialogs init is_blocked");
} else if (!d->is_has_bots_inited && !td_->auth_manager_->is_bot()) {
// asynchronously get has_bots from the server
// TODO add has_bots to telegram_api::dialog
get_dialog_info_full(dialog_id, Auto());
}
if (!d->is_last_pinned_message_id_inited && !td_->auth_manager_->is_bot()) {
get_dialog_info_full(dialog_id, Auto(), "on_get_dialogs init has_bots");
} else if (!d->is_last_pinned_message_id_inited && !td_->auth_manager_->is_bot()) {
// asynchronously get dialog pinned message from the server
get_dialog_pinned_message(dialog_id, Auto());
}
@ -17364,19 +17351,19 @@ td_api::object_ptr<td_api::messageThreadInfo> MessagesManager::get_message_threa
std::move(draft_message));
}
void MessagesManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise) {
void MessagesManager::get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise, const char *source) {
switch (dialog_id.get_type()) {
case DialogType::User:
send_closure_later(G()->contacts_manager(), &ContactsManager::load_user_full, dialog_id.get_user_id(), false,
std::move(promise));
std::move(promise), source);
return;
case DialogType::Chat:
send_closure_later(G()->contacts_manager(), &ContactsManager::load_chat_full, dialog_id.get_chat_id(), false,
std::move(promise), "get_dialog_info_full");
std::move(promise), source);
return;
case DialogType::Channel:
send_closure_later(G()->contacts_manager(), &ContactsManager::load_channel_full, dialog_id.get_channel_id(),
false, std::move(promise));
false, std::move(promise), source);
return;
case DialogType::SecretChat:
return promise.set_value(Unit());
@ -17420,11 +17407,12 @@ MessageId MessagesManager::get_dialog_pinned_message(DialogId dialog_id, Promise
<< (d->is_last_pinned_message_id_inited ? "inited" : "unknown") << " pinned " << d->last_pinned_message_id;
if (!d->is_last_pinned_message_id_inited) {
get_dialog_info_full(dialog_id, std::move(promise));
// must call get_dialog_info_full as expected in fix_new_dialog
get_dialog_info_full(dialog_id, std::move(promise), "get_dialog_pinned_message 1");
return MessageId();
}
get_dialog_info_full(dialog_id, Auto());
get_dialog_info_full(dialog_id, Auto(), "get_dialog_pinned_message 2");
if (d->last_pinned_message_id.is_valid()) {
tl_object_ptr<telegram_api::InputMessage> input_message;
@ -19441,8 +19429,8 @@ DialogId MessagesManager::create_new_group_chat(const vector<UserId> &user_ids,
created_dialogs_.erase(it);
// set default notification settings to newly created chat
on_update_dialog_notify_settings(
dialog_id, make_tl_object<telegram_api::peerNotifySettings>(0, false, false, 0, ""), "create_new_group_chat");
on_update_dialog_notify_settings(dialog_id, make_tl_object<telegram_api::peerNotifySettings>(),
"create_new_group_chat");
promise.set_value(Unit());
return dialog_id;
@ -19495,8 +19483,8 @@ DialogId MessagesManager::create_new_channel_chat(const string &title, bool is_m
created_dialogs_.erase(it);
// set default notification settings to newly created chat
on_update_dialog_notify_settings(
dialog_id, make_tl_object<telegram_api::peerNotifySettings>(0, false, false, 0, ""), "create_new_channel_chat");
on_update_dialog_notify_settings(dialog_id, make_tl_object<telegram_api::peerNotifySettings>(),
"create_new_channel_chat");
promise.set_value(Unit());
return dialog_id;
@ -22682,6 +22670,10 @@ void MessagesManager::get_history_from_the_end_impl(const Dialog *d, bool from_d
promise.set_value(Unit());
return;
}
if (!promise && !G()->parameters().use_message_db) {
// repair last message ID
limit = 10;
}
LOG(INFO) << "Get history from the end of " << dialog_id << " from server";
td_->create_handler<GetHistoryQuery>(std::move(promise))
@ -23455,8 +23447,7 @@ void MessagesManager::fix_server_reply_to_message_id(DialogId dialog_id, Message
}
if (!message_id.is_scheduled() && !reply_in_dialog_id.is_valid() && reply_to_message_id >= message_id) {
if (reply_to_message_id.get() - message_id.get() <= MessageId(ServerMessageId(1000000)).get() ||
dialog_id.get_type() == DialogType::Channel) {
if (!can_overflow_message_id(dialog_id)) {
LOG(ERROR) << "Receive reply to wrong " << reply_to_message_id << " in " << message_id << " in " << dialog_id;
}
reply_to_message_id = MessageId();
@ -24811,6 +24802,21 @@ void MessagesManager::do_send_inline_query_result_message(DialogId dialog_id, co
flags, dialog_id, m->reply_to_message_id, get_message_schedule_date(m), random_id, query_id, result_id);
}
bool MessagesManager::can_overflow_message_id(DialogId dialog_id) {
switch (dialog_id.get_type()) {
case DialogType::User:
case DialogType::Chat:
return G()->shared_config().get_option_integer("session_count") > 1;
case DialogType::Channel:
case DialogType::SecretChat:
return false;
case DialogType::None:
default:
UNREACHABLE();
return false;
}
}
bool MessagesManager::can_edit_message(DialogId dialog_id, const Message *m, bool is_editing,
bool only_reply_markup) const {
if (m == nullptr) {
@ -29013,7 +29019,7 @@ FullMessageId MessagesManager::on_send_message_success(int64 random_id, MessageI
send_update_message_content(dialog_id, sent_message.get(), source);
}
if (old_message_id.is_valid() && new_message_id < old_message_id) {
if (old_message_id.is_valid() && new_message_id < old_message_id && !can_overflow_message_id(dialog_id)) {
LOG(ERROR) << "Sent " << old_message_id << " to " << dialog_id << " as " << new_message_id;
}
@ -34311,24 +34317,22 @@ void MessagesManager::fix_new_dialog(Dialog *d, unique_ptr<Message> &&last_datab
if (being_added_dialog_id_ != dialog_id && !d->is_is_blocked_inited && !td_->auth_manager_->is_bot()) {
// asynchronously get is_blocked from the server
get_dialog_info_full(dialog_id, Auto());
}
if (being_added_dialog_id_ != dialog_id && !d->is_has_bots_inited && !td_->auth_manager_->is_bot()) {
get_dialog_info_full(dialog_id, Auto(), "fix_new_dialog init is_blocked");
} else if (being_added_dialog_id_ != dialog_id && !d->is_has_bots_inited && !td_->auth_manager_->is_bot()) {
// asynchronously get has_bots from the server
get_dialog_info_full(dialog_id, Auto());
}
if (being_added_dialog_id_ != dialog_id && !d->is_last_pinned_message_id_inited && !td_->auth_manager_->is_bot()) {
get_dialog_info_full(dialog_id, Auto(), "fix_new_dialog init has_bots");
} else if (being_added_dialog_id_ != dialog_id && !d->is_last_pinned_message_id_inited &&
!td_->auth_manager_->is_bot()) {
// asynchronously get dialog pinned message from the server
get_dialog_pinned_message(dialog_id, Auto());
}
if (being_added_dialog_id_ != dialog_id && !d->is_folder_id_inited && !td_->auth_manager_->is_bot() &&
} else if (being_added_dialog_id_ != dialog_id && !d->is_folder_id_inited && !td_->auth_manager_->is_bot() &&
order != DEFAULT_ORDER) {
// asynchronously get dialog folder identifier from the server
get_dialog_info_full(dialog_id, Auto());
}
if (!d->is_message_ttl_setting_inited && !td_->auth_manager_->is_bot() && order != DEFAULT_ORDER) {
get_dialog_info_full(dialog_id, Auto(), "fix_new_dialog init folder_id");
} else if (!d->is_message_ttl_setting_inited && !td_->auth_manager_->is_bot() &&
have_input_peer(dialog_id, AccessRights::Write)) {
// asynchronously get dialog message TTL setting from the server
get_dialog_info_full(dialog_id, Auto());
get_dialog_info_full(dialog_id, Auto(), "fix_new_dialog init message_ttl_setting");
}
if (!d->know_action_bar && !td_->auth_manager_->is_bot() && dialog_type != DialogType::SecretChat &&
dialog_id != get_my_dialog_id() && have_input_peer(dialog_id, AccessRights::Read)) {
@ -36472,11 +36476,6 @@ void MessagesManager::after_get_channel_difference(DialogId dialog_id, bool succ
send_closure_later(G()->notification_manager(), &NotificationManager::after_get_chat_difference,
d->mention_notification_group.group_id);
}
if (!td_->auth_manager_->is_bot() && have_access && !d->last_message_id.is_valid() && !d->is_empty &&
(d->order != DEFAULT_ORDER || is_dialog_sponsored(d))) {
get_history_from_the_end_impl(d, true, false, Auto());
}
} else {
is_channel_difference_finished_.insert(dialog_id);
}
@ -36504,6 +36503,11 @@ void MessagesManager::after_get_channel_difference(DialogId dialog_id, bool succ
on_get_dialogs(res.folder_id, std::move(res.dialogs), res.total_count, std::move(res.messages),
std::move(res.promise));
}
if (d != nullptr && !td_->auth_manager_->is_bot() && have_access && !d->last_message_id.is_valid() && !d->is_empty &&
(d->order != DEFAULT_ORDER || is_dialog_sponsored(d))) {
get_history_from_the_end_impl(d, true, false, Auto());
}
}
void MessagesManager::reget_message_from_server_if_needed(DialogId dialog_id, const Message *m) {

View File

@ -17,6 +17,7 @@
#include "td/telegram/DialogLocation.h"
#include "td/telegram/DialogParticipant.h"
#include "td/telegram/DialogSource.h"
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileSourceId.h"
#include "td/telegram/FolderId.h"
@ -234,8 +235,8 @@ class MessagesManager final : public Actor {
void open_secret_message(SecretChatId secret_chat_id, int64 random_id, Promise<>);
void on_send_secret_message_success(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file_ptr, Promise<> promise);
void on_send_secret_message_success(int64 random_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
Promise<> promise);
void on_send_secret_message_error(int64 random_id, Status error, Promise<> promise);
void delete_secret_messages(SecretChatId secret_chat_id, std::vector<int64> random_ids, Promise<> promise);
@ -248,8 +249,8 @@ class MessagesManager final : public Actor {
void on_update_secret_chat_state(SecretChatId secret_chat_id, SecretChatState state);
void on_get_secret_message(SecretChatId secret_chat_id, UserId user_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::encryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise);
unique_ptr<EncryptedFile> file, tl_object_ptr<secret_api::decryptedMessage> message,
Promise<> promise);
void on_secret_chat_screenshot_taken(SecretChatId secret_chat_id, UserId user_id, MessageId message_id, int32 date,
int64 random_id, Promise<> promise);
@ -494,7 +495,7 @@ class MessagesManager final : public Actor {
void unpin_all_dialog_messages(DialogId dialog_id, Promise<Unit> &&promise);
void get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise);
void get_dialog_info_full(DialogId dialog_id, Promise<Unit> &&promise, const char *source);
int64 get_dialog_event_log(DialogId dialog_id, const string &query, int64 from_event_id, int32 limit,
const tl_object_ptr<td_api::chatEventLogFilters> &filters, const vector<UserId> &user_ids,
@ -1774,6 +1775,8 @@ class MessagesManager final : public Actor {
bool can_edit_message(DialogId dialog_id, const Message *m, bool is_editing, bool only_reply_markup = false) const;
static bool can_overflow_message_id(DialogId dialog_id);
bool can_report_dialog(DialogId dialog_id) const;
Status can_pin_messages(DialogId dialog_id) const;

View File

@ -676,7 +676,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const AnimationSize &an
<< animation_size.main_frame_timestamp;
}
Photo get_encrypted_file_photo(FileManager *file_manager, tl_object_ptr<telegram_api::encryptedFile> &&file,
Photo get_encrypted_file_photo(FileManager *file_manager, unique_ptr<EncryptedFile> &&file,
tl_object_ptr<secret_api::decryptedMessageMediaPhoto> &&photo,
DialogId owner_dialog_id) {
FileId file_id = file_manager->register_remote(

View File

@ -7,6 +7,7 @@
#pragma once
#include "td/telegram/DialogId.h"
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/net/DcId.h"
@ -137,7 +138,7 @@ StringBuilder &operator<<(StringBuilder &string_builder, const AnimationSize &an
Photo get_photo(FileManager *file_manager, tl_object_ptr<telegram_api::Photo> &&photo, DialogId owner_dialog_id);
Photo get_photo(FileManager *file_manager, tl_object_ptr<telegram_api::photo> &&photo, DialogId owner_dialog_id);
Photo get_encrypted_file_photo(FileManager *file_manager, tl_object_ptr<telegram_api::encryptedFile> &&file,
Photo get_encrypted_file_photo(FileManager *file_manager, unique_ptr<EncryptedFile> &&file,
tl_object_ptr<secret_api::decryptedMessageMediaPhoto> &&photo, DialogId owner_dialog_id);
Photo get_web_document_photo(FileManager *file_manager, tl_object_ptr<telegram_api::WebDocument> web_document,
DialogId owner_dialog_id);

View File

@ -18,12 +18,12 @@ QueryCombiner::QueryCombiner(Slice name, double min_delay) : next_query_time_(Ti
}
void QueryCombiner::add_query(int64 query_id, Promise<Promise<Unit>> &&send_query, Promise<Unit> &&promise) {
LOG(INFO) << "Add query " << query_id;
LOG(INFO) << "Add query " << query_id << " with" << (promise ? "" : "out") << " promise";
auto &query = queries_[query_id];
if (promise) {
query.promises.push_back(std::move(promise));
} else if (min_delay_ > 0 && !query.is_sent) {
// if there is no promise, than no one waits for response
// if there is no promise, then noone waits for response
// we can delay query to not exceed any flood limit
if (query.send_query) {
// the query is already delayed

View File

@ -1238,11 +1238,6 @@ Status SecretChatActor::do_inbound_message_decrypted(unique_ptr<log_event::Inbou
auto qts_promise = std::move(message->promise);
// process message
tl_object_ptr<telegram_api::encryptedFile> file;
if (message->has_encrypted_file) {
file = message->file.as_encrypted_file();
}
if (message->decrypted_message_layer->message_->get_id() == secret_api::decryptedMessage46::ID) {
auto old = move_tl_object_as<secret_api::decryptedMessage46>(message->decrypted_message_layer->message_);
old->flags_ &= ~secret_api::decryptedMessage::GROUPED_ID_MASK; // just in case
@ -1266,7 +1261,8 @@ Status SecretChatActor::do_inbound_message_decrypted(unique_ptr<log_event::Inbou
auto decrypted_message =
move_tl_object_as<secret_api::decryptedMessage>(message->decrypted_message_layer->message_);
context_->on_inbound_message(get_user_id(), MessageId(ServerMessageId(message->message_id)), message->date,
std::move(file), std::move(decrypted_message), std::move(save_message_finish));
std::move(message->file), std::move(decrypted_message),
std::move(save_message_finish));
} else if (message->decrypted_message_layer->message_->get_id() == secret_api::decryptedMessageService::ID) {
auto decrypted_message_service =
move_tl_object_as<secret_api::decryptedMessageService>(message->decrypted_message_layer->message_);
@ -1618,31 +1614,24 @@ void SecretChatActor::on_outbound_send_message_result(NetQueryPtr query, Promise
}
case telegram_api::messages_sentEncryptedFile::ID: {
auto sent = move_tl_object_as<telegram_api::messages_sentEncryptedFile>(result);
std::function<telegram_api::object_ptr<telegram_api::EncryptedFile>()> get_file;
telegram_api::downcast_call(
*sent->file_, overloaded(
[&](telegram_api::encryptedFileEmpty &) {
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(
telegram_api::inputEncryptedFileEmpty());
get_file = [] {
return telegram_api::make_object<telegram_api::encryptedFileEmpty>();
};
},
[&](telegram_api::encryptedFile &file) {
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(
telegram_api::inputEncryptedFile(file.id_, file.access_hash_));
get_file = [id = file.id_, access_hash = file.access_hash_, size = file.size_,
dc_id = file.dc_id_, key_fingerprint = file.key_fingerprint_] {
return telegram_api::make_object<telegram_api::encryptedFile>(id, access_hash, size,
dc_id, key_fingerprint);
};
}));
auto file = EncryptedFile::get_encrypted_file(std::move(sent->file_));
if (file == nullptr) {
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(nullptr);
state->send_result_ = [this, random_id = state->message->random_id,
message_id = MessageId(ServerMessageId(state->message->message_id)), date = sent->date_,
get_file = std::move(get_file)](Promise<> promise) {
this->context_->on_send_message_ok(random_id, message_id, date, get_file(), std::move(promise));
message_id = MessageId(ServerMessageId(state->message->message_id)),
date = sent->date_](Promise<> promise) {
this->context_->on_send_message_ok(random_id, message_id, date, nullptr, std::move(promise));
};
} else {
state->message->file = log_event::EncryptedInputFile::from_input_encrypted_file(
make_tl_object<telegram_api::inputEncryptedFile>(file->id_, file->access_hash_));
state->send_result_ = [this, random_id = state->message->random_id,
message_id = MessageId(ServerMessageId(state->message->message_id)),
date = sent->date_, file = *file](Promise<> promise) {
this->context_->on_send_message_ok(random_id, message_id, date, make_unique<EncryptedFile>(file),
std::move(promise));
};
}
state->send_result_(std::move(send_message_finish_promise));
return;
}

View File

@ -7,6 +7,7 @@
#pragma once
#include "td/telegram/DhConfig.h"
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/logevent/SecretChatEvent.h"
#include "td/telegram/MessageId.h"
@ -84,8 +85,7 @@ class SecretChatActor final : public NetQueryCallback {
// this update through binlog too. So it wouldn't be deleted before update is saved.
// inbound messages
virtual void on_inbound_message(UserId user_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::encryptedFile> file,
virtual void on_inbound_message(UserId user_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) = 0;
virtual void on_delete_messages(std::vector<int64> random_id, Promise<> promise) = 0;
virtual void on_flush_history(bool remove_from_dialog_list, MessageId message_id, Promise<> promise) = 0;
@ -97,8 +97,8 @@ class SecretChatActor final : public NetQueryCallback {
// outbound messages
virtual void on_send_message_ack(int64 random_id) = 0;
virtual void on_send_message_ok(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<> promise) = 0;
virtual void on_send_message_ok(int64 random_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
Promise<> promise) = 0;
virtual void on_send_message_error(int64 random_id, Status error, Promise<> promise) = 0;
};

View File

@ -9,6 +9,7 @@
#include "td/telegram/ConfigShared.h"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DhCache.h"
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/Global.h"
#include "td/telegram/logevent/SecretChatEvent.h"
@ -198,17 +199,7 @@ void SecretChatsManager::on_new_message(tl_object_ptr<telegram_api::EncryptedMes
});
if (message_ptr->get_id() == telegram_api::encryptedMessage::ID) {
auto message = move_tl_object_as<telegram_api::encryptedMessage>(message_ptr);
if (message->file_->get_id() == telegram_api::encryptedFile::ID) {
auto file = move_tl_object_as<telegram_api::encryptedFile>(message->file_);
event->file.id = file->id_;
event->file.access_hash = file->access_hash_;
event->file.size = file->size_;
event->file.dc_id = file->dc_id_;
event->file.key_fingerprint = file->key_fingerprint_;
event->has_encrypted_file = true;
}
event->file = EncryptedFile::get_encrypted_file(std::move(message->file_));
}
add_inbound_message(std::move(event));
}
@ -350,8 +341,7 @@ unique_ptr<SecretChatActor::Context> SecretChatsManager::make_secret_chat_contex
user_id, state, is_outbound, ttl, date, key_hash, layer, initial_folder_id);
}
void on_inbound_message(UserId user_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::encryptedFile> file,
void on_inbound_message(UserId user_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_get_secret_message, secret_chat_id_, user_id,
message_id, date, std::move(file), std::move(message), std::move(promise));
@ -365,8 +355,8 @@ unique_ptr<SecretChatActor::Context> SecretChatsManager::make_secret_chat_contex
void on_send_message_ack(int64 random_id) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_message_get_quick_ack, random_id);
}
void on_send_message_ok(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<> promise) final {
void on_send_message_ok(int64 random_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
Promise<> promise) final {
send_closure_later(G()->messages_manager(), &MessagesManager::on_send_secret_message_success, random_id,
message_id, date, std::move(file), std::move(promise));
}

View File

@ -706,7 +706,7 @@ class GetUserFullInfoRequest final : public RequestActor<> {
UserId user_id_;
void do_run(Promise<Unit> &&promise) final {
td->contacts_manager_->load_user_full(user_id_, get_tries() < 2, std::move(promise));
td->contacts_manager_->load_user_full(user_id_, get_tries() < 2, std::move(promise), "GetUserFullInfoRequest");
}
void do_send_result() final {
@ -776,7 +776,8 @@ class GetSupergroupFullInfoRequest final : public RequestActor<> {
ChannelId channel_id_;
void do_run(Promise<Unit> &&promise) final {
td->contacts_manager_->load_channel_full(channel_id_, get_tries() < 2, std::move(promise));
td->contacts_manager_->load_channel_full(channel_id_, get_tries() < 2, std::move(promise),
"GetSupergroupFullInfoRequest");
}
void do_send_result() final {

View File

@ -235,7 +235,7 @@ tl_object_ptr<telegram_api::InputMedia> VideoNotesManager::get_input_media(
telegram_api::documentAttributeVideo::ROUND_MESSAGE_MASK, false /*ignored*/, false /*ignored*/,
video_note->duration, video_note->dimensions.width ? video_note->dimensions.width : 240,
video_note->dimensions.height ? video_note->dimensions.height : 240));
int32 flags = 0;
int32 flags = telegram_api::inputMediaUploadedDocument::NOSOUND_VIDEO_MASK;
if (input_thumbnail != nullptr) {
flags |= telegram_api::inputMediaUploadedDocument::THUMB_MASK;
}

View File

@ -6,6 +6,7 @@
//
#pragma once
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/Global.h"
#include "td/telegram/logevent/LogEvent.h"
#include "td/telegram/secret_api.h"
@ -218,53 +219,6 @@ inline StringBuilder &operator<<(StringBuilder &sb, const EncryptedInputFile &fi
return sb << to_string(file.as_input_encrypted_file());
}
// encryptedFile#4a70994c id:long access_hash:long size:int dc_id:int key_fingerprint:int = EncryptedFile;
struct EncryptedFileLocation {
static constexpr int32 MAGIC = 0x473d738a;
int64 id = 0;
int64 access_hash = 0;
int32 size = 0;
int32 dc_id = 0;
int32 key_fingerprint = 0;
tl_object_ptr<telegram_api::encryptedFile> as_encrypted_file() {
return make_tl_object<telegram_api::encryptedFile>(id, access_hash, size, dc_id, key_fingerprint);
}
template <class StorerT>
void store(StorerT &storer) const {
using td::store;
store(MAGIC, storer);
store(id, storer);
store(access_hash, storer);
store(size, storer);
store(dc_id, storer);
store(key_fingerprint, storer);
}
template <class ParserT>
void parse(ParserT &parser) {
using td::parse;
int32 got_magic;
parse(got_magic, parser);
parse(id, parser);
parse(access_hash, parser);
parse(size, parser);
parse(dc_id, parser);
parse(key_fingerprint, parser);
if (got_magic != MAGIC) {
parser.set_error("EncryptedFileLocation magic mismatch");
return;
}
}
};
inline StringBuilder &operator<<(StringBuilder &sb, const EncryptedFileLocation &file) {
return sb << "[" << tag("id", file.id) << tag("access_hash", file.access_hash) << tag("size", file.size)
<< tag("dc_id", file.dc_id) << tag("key_fingerprint", file.key_fingerprint) << "]";
}
// LogEvents
// TODO: Qts and SeqNoState could be just Logevents that are updated during regenerate
class InboundSecretMessage final : public SecretChatLogEventBase<InboundSecretMessage> {
@ -291,15 +245,15 @@ class InboundSecretMessage final : public SecretChatLogEventBase<InboundSecretMe
return decrypted_message_layer->layer_;
}
EncryptedFileLocation file;
unique_ptr<EncryptedFile> file;
bool has_encrypted_file = false;
bool is_pending = false;
template <class StorerT>
void store(StorerT &storer) const {
using td::store;
bool has_encrypted_file = file != nullptr;
BEGIN_STORE_FLAGS();
STORE_FLAG(has_encrypted_file);
STORE_FLAG(is_pending);
@ -328,6 +282,7 @@ class InboundSecretMessage final : public SecretChatLogEventBase<InboundSecretMe
void parse(ParserT &parser) {
using td::parse;
bool has_encrypted_file;
bool no_qts;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(has_encrypted_file);
@ -364,7 +319,7 @@ class InboundSecretMessage final : public SecretChatLogEventBase<InboundSecretMe
<< tag("date", date) << tag("auth_key_id", format::as_hex(auth_key_id)) << tag("message_id", message_id)
<< tag("my_in_seq_no", my_in_seq_no) << tag("my_out_seq_no", my_out_seq_no)
<< tag("his_in_seq_no", his_in_seq_no) << tag("message", to_string(decrypted_message_layer))
<< tag("is_pending", is_pending) << format::cond(has_encrypted_file, tag("file", file)) << "]";
<< tag("is_pending", is_pending) << format::cond(file != nullptr, tag("file", *file)) << "]";
}
};

View File

@ -256,7 +256,7 @@ static void write_function(tl_outputer &out, const tl_combinator *t, const std::
if (w.is_default_constructor_generated(t, false, true)) {
write_class_constructor(out, t, class_name, true, w);
}
if (required_args) {
if (required_args && w.is_full_constructor_generated(t, false, true)) {
write_class_constructor(out, t, class_name, false, w);
}
@ -337,7 +337,7 @@ static void write_constructor(tl_outputer &out, const tl_combinator *t, const st
if (w.is_default_constructor_generated(t, can_be_parsed, can_be_stored)) {
write_class_constructor(out, t, class_name, true, w);
}
if (required_args) {
if (required_args && w.is_full_constructor_generated(t, can_be_parsed, can_be_stored)) {
write_class_constructor(out, t, class_name, false, w);
}

View File

@ -139,6 +139,10 @@ bool TL_writer::is_default_constructor_generated(const tl_combinator *t, bool ca
return true;
}
bool TL_writer::is_full_constructor_generated(const tl_combinator *t, bool can_be_parsed, bool can_be_stored) const {
return true;
}
std::string TL_writer::gen_main_class_name(const tl_type *t) const {
if (t->simple_constructors == 1) {
for (std::size_t i = 0; i < t->constructors_num; i++) {

View File

@ -57,6 +57,7 @@ class TL_writer {
virtual bool is_combinator_supported(const tl_combinator *constructor) const;
virtual bool is_documentation_generated() const;
virtual bool is_default_constructor_generated(const tl_combinator *t, bool can_be_parsed, bool can_be_stored) const;
virtual bool is_full_constructor_generated(const tl_combinator *t, bool can_be_parsed, bool can_be_stored) const;
virtual int get_parser_type(const tl_combinator *t, const std::string &parser_name) const;
virtual int get_storer_type(const tl_combinator *t, const std::string &storer_name) const;

View File

@ -4,6 +4,7 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/EncryptedFile.h"
#include "td/telegram/FolderId.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessageId.h"
@ -535,14 +536,13 @@ class FakeSecretChatContext final : public SecretChatActor::Context {
int32 date, string key_hash, int32 layer, FolderId initial_folder_id) final {
}
void on_inbound_message(UserId user_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::encryptedFile> file,
void on_inbound_message(UserId user_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<>) final;
void on_send_message_error(int64 random_id, Status error, Promise<>) final;
void on_send_message_ack(int64 random_id) final;
void on_send_message_ok(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<>) final;
void on_send_message_ok(int64 random_id, MessageId message_id, int32 date, unique_ptr<EncryptedFile> file,
Promise<>) final;
void on_delete_messages(std::vector<int64> random_id, Promise<>) final;
void on_flush_history(bool, MessageId, Promise<>) final;
void on_read_message(int64, Promise<>) final;
@ -974,7 +974,7 @@ void FakeSecretChatContext::send_net_query(NetQueryPtr query, ActorShared<NetQue
send_closure(master_, &Master::send_net_query, std::move(query), std::move(callback), ordered);
}
void FakeSecretChatContext::on_inbound_message(UserId user_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::encryptedFile> file,
unique_ptr<EncryptedFile> file,
tl_object_ptr<secret_api::decryptedMessage> message, Promise<> promise) {
send_closure(master_, &Master::on_inbound_message, message->message_, std::move(promise));
}
@ -984,7 +984,7 @@ void FakeSecretChatContext::on_send_message_error(int64 random_id, Status error,
void FakeSecretChatContext::on_send_message_ack(int64 random_id) {
}
void FakeSecretChatContext::on_send_message_ok(int64 random_id, MessageId message_id, int32 date,
tl_object_ptr<telegram_api::EncryptedFile> file, Promise<> promise) {
unique_ptr<EncryptedFile> file, Promise<> promise) {
send_closure(master_, &Master::on_send_message_ok, random_id, std::move(promise));
}
void FakeSecretChatContext::on_delete_messages(std::vector<int64> random_id, Promise<> promise) {