More fixes.

GitOrigin-RevId: 587cca0a2e3a87c117fa78d59c81d61815e2756d
This commit is contained in:
levlam 2018-04-07 02:38:28 +03:00
parent 775c2eea25
commit baa334544b
10 changed files with 34 additions and 11 deletions

View File

@ -14,11 +14,12 @@ namespace td {
void DelayDispatcher::send_with_callback(NetQueryPtr query, ActorShared<NetQueryCallback> callback) {
send_with_callback_and_delay(std::move(query), std::move(callback), default_delay_);
}
void DelayDispatcher::send_with_callback_and_delay(NetQueryPtr query, ActorShared<NetQueryCallback> callback,
double delay) {
queue_.push({std::move(query), std::move(callback), delay});
loop();
} // namespace td
}
void DelayDispatcher::loop() {
if (!wakeup_at_.is_in_past()) {

View File

@ -12,6 +12,13 @@
#include "td/telegram/PasswordManager.h"
#include "td/telegram/Td.h"
#include "td/utils/buffer.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include <mutex>
namespace td {
GetSecureValue::GetSecureValue(ActorShared<> parent, std::string password, SecureValueType type,
@ -207,7 +214,7 @@ void SetSecureValue::start_up() {
PromiseCreator::lambda([actor_id = actor_id(this)](Result<secure_storage::Secret> r_secret) {
send_closure(actor_id, &SetSecureValue::on_secret, std::move(r_secret), true);
}));
auto *file_manager = G()->file_manager().get_actor_unsafe();
auto *file_manager = G()->td().get_actor_unsafe()->file_manager_.get();
// Remove duplicated files
for (auto it = secure_value_.files.begin(); it != secure_value_.files.end();) {

View File

@ -8,14 +8,21 @@
#include "td/actor/actor.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/net/NetQuery.h"
#include "td/telegram/SecureValue.h"
#include "td/telegram/UserId.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
#include "td/utils/Container.h"
#include "td/utils/optional.h"
#include "td/utils/Status.h"
#include <map>
#include <memory>
namespace td {

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/SecureStorage.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Random.h"

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/SecureValue.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/td_api.h"
@ -13,7 +14,10 @@
#include "td/telegram/telegram_api.hpp"
#include "td/utils/base64.h"
#include "td/utils/buffer.h"
#include "td/utils/crypto.h"
#include "td/utils/JsonBuilder.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/overloaded.h"
@ -398,13 +402,13 @@ Result<SecureValue> get_secure_value(FileManager *file_manager,
res.type = get_secure_value_type_td_api(std::move(input_passport_data->type_));
res.data = std::move(input_passport_data->data_);
for (auto &file : input_passport_data->files_) {
TRY_RESULT(file_id, file_manager->get_input_file_id(FileType::Secure, std::move(file), DialogId{}, false, false,
TRY_RESULT(file_id, file_manager->get_input_file_id(FileType::Secure, std::move(file), DialogId(), false, false,
false, true));
res.files.push_back(file_id);
}
if (input_passport_data->selfie_) {
TRY_RESULT(file_id, file_manager->get_input_file_id(FileType::Secure, std::move(input_passport_data->selfie_),
DialogId{}, false, false, false, true));
DialogId(), false, false, false, true));
res.selfie = file_id;
}
return res;

View File

@ -14,8 +14,11 @@
#include "td/utils/common.h"
#include "td/utils/optional.h"
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include <utility>
namespace td {
class FileManager;

View File

@ -45,10 +45,10 @@
#include "td/telegram/PasswordManager.h"
#include "td/telegram/Photo.h"
#include "td/telegram/PrivacyManager.h"
#include "td/telegram/SecureManager.h"
#include "td/telegram/SecureValue.h"
#include "td/telegram/SecretChatId.h"
#include "td/telegram/SecretChatsManager.h"
#include "td/telegram/SecureManager.h"
#include "td/telegram/SecureValue.h"
#include "td/telegram/StateManager.h"
#include "td/telegram/StickersManager.h"
#include "td/telegram/StorageManager.h"
@ -74,11 +74,10 @@
#include "td/utils/format.h"
#include "td/utils/MimeType.h"
#include "td/utils/misc.h"
#include "td/utils/optional.h"
#include "td/utils/overloaded.h"
#include "td/utils/PathView.h"
#include "td/utils/port/path.h"
#include "td/utils/Random.h"
#include "td/utils/overloaded.h"
#include "td/utils/Slice.h"
#include "td/utils/Status.h"
#include "td/utils/Timer.h"

View File

@ -15,6 +15,7 @@
#include "memprof/memprof.h"
#include "td/net/HttpQuery.h"
#include "td/net/HttpReader.h"
#include "td/utils/buffer.h"

View File

@ -18,6 +18,7 @@
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/port/Stat.h"
#include "td/utils/ScopeGuard.h"
#include "td/utils/Slice.h"

View File

@ -10,8 +10,8 @@
#include "td/telegram/telegram_api.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/SecureStorage.h"
#include "td/telegram/net/DcId.h"
#include "td/telegram/SecureStorage.h"
#include "td/utils/buffer.h"
#include "td/utils/common.h"
@ -26,7 +26,6 @@
#include "td/utils/tl_storers.h"
#include "td/utils/Variant.h"
#include <cstring>
#include <tuple>
namespace td {
@ -171,7 +170,7 @@ struct FileEncryptionKey {
MutableSlice(key_iv_).remove_suffix(key.size()).copy_from(iv);
}
FileEncryptionKey(const secure_storage::Secret &secret) : type_(Type::Secure) {
explicit FileEncryptionKey(const secure_storage::Secret &secret) : type_(Type::Secure) {
key_iv_ = secret.as_slice().str();
}