Move static functions from Td.cpp to Td::.
GitOrigin-RevId: f1388a1fa9e43165228eb5efc524401b9065f15f
This commit is contained in:
parent
b3a992a156
commit
5ad403a932
@ -97,18 +97,6 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace td {
|
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) {
|
void Td::ResultHandler::set_td(Td *new_td) {
|
||||||
CHECK(td == nullptr);
|
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) {
|
void Td::request(uint64 id, tl_object_ptr<td_api::Function> function) {
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
LOG(ERROR) << "Ignore request with id == 0: " << to_string(function);
|
LOG(ERROR) << "Ignore request with id == 0: " << to_string(function);
|
||||||
@ -3516,10 +3515,6 @@ void Td::on_authorization_lost() {
|
|||||||
destroy();
|
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() {
|
void Td::start_up() {
|
||||||
always_wait_for_mailbox();
|
always_wait_for_mailbox();
|
||||||
|
|
||||||
|
@ -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::getLanguagePackString &request);
|
||||||
static td_api::object_ptr<td_api::Object> do_static_request(const td_api::testSetLogTagVerbosityLevel &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;
|
Status init(DbKey key) TD_WARN_UNUSED_RESULT;
|
||||||
void clear();
|
void clear();
|
||||||
void close_impl(bool destroy_flag);
|
void close_impl(bool destroy_flag);
|
||||||
Status fix_parameters(TdParameters ¶meters) TD_WARN_UNUSED_RESULT;
|
static Status fix_parameters(TdParameters ¶meters) TD_WARN_UNUSED_RESULT;
|
||||||
Status set_parameters(td_api::object_ptr<td_api::tdlibParameters> 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
|
// Actor
|
||||||
void start_up() override;
|
void start_up() override;
|
||||||
void tear_down() override;
|
void tear_down() override;
|
||||||
|
Reference in New Issue
Block a user