Move static functions from Td.cpp to Td::.

GitOrigin-RevId: f1388a1fa9e43165228eb5efc524401b9065f15f
This commit is contained in:
levlam 2018-10-01 23:18:05 +03:00
parent b3a992a156
commit 5ad403a932
2 changed files with 17 additions and 17 deletions

View File

@ -97,18 +97,6 @@
#include <type_traits>
namespace td {
namespace {
DbKey as_db_key(string key) {
// Database will still be effectively not encrypted, but
// 1. sqlite db will be protected from corruption, because that's how sqlcipher works
// 2. security through obscurity
// 3. no need for reencryption of sqlite db
if (key.empty()) {
return DbKey::raw_key("cucumber");
}
return DbKey::raw_key(std::move(key));
}
} // namespace
void Td::ResultHandler::set_td(Td *new_td) {
CHECK(td == nullptr);
@ -3208,6 +3196,17 @@ td_api::object_ptr<td_api::AuthorizationState> Td::get_fake_authorization_state_
}
}
DbKey Td::as_db_key(string key) {
// Database will still be effectively not encrypted, but
// 1. sqlite db will be protected from corruption, because that's how sqlcipher works
// 2. security through obscurity
// 3. no need for reencryption of sqlite db
if (key.empty()) {
return DbKey::raw_key("cucumber");
}
return DbKey::raw_key(std::move(key));
}
void Td::request(uint64 id, tl_object_ptr<td_api::Function> function) {
if (id == 0) {
LOG(ERROR) << "Ignore request with id == 0: " << to_string(function);
@ -3516,10 +3515,6 @@ void Td::on_authorization_lost() {
destroy();
}
static td_api::object_ptr<td_api::error> make_error(int32 code, CSlice error) {
return td_api::make_object<td_api::error>(code, error.str());
}
void Td::start_up() {
always_wait_for_mailbox();

View File

@ -939,12 +939,17 @@ class Td final : public NetQueryCallback {
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::getLanguagePackString &request);
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::testSetLogTagVerbosityLevel &request);
static DbKey as_db_key(string key);
Status init(DbKey key) TD_WARN_UNUSED_RESULT;
void clear();
void close_impl(bool destroy_flag);
Status fix_parameters(TdParameters &parameters) TD_WARN_UNUSED_RESULT;
static Status fix_parameters(TdParameters &parameters) TD_WARN_UNUSED_RESULT;
Status set_parameters(td_api::object_ptr<td_api::tdlibParameters> parameters) TD_WARN_UNUSED_RESULT;
static td_api::object_ptr<td_api::error> make_error(int32 code, CSlice error) {
return td_api::make_object<td_api::error>(code, error.str());
}
// Actor
void start_up() override;
void tear_down() override;