diff --git a/td/generate/scheme/telegram_api.tl b/td/generate/scheme/telegram_api.tl index 998c09219..b53623eb2 100644 --- a/td/generate/scheme/telegram_api.tl +++ b/td/generate/scheme/telegram_api.tl @@ -340,7 +340,7 @@ photos.photo#20212ca8 photo:Photo users:Vector = photos.Photo; upload.file#96a18d5 type:storage.FileType mtime:int bytes:bytes = upload.File; upload.fileCdnRedirect#f18cda44 dc_id:int file_token:bytes encryption_key:bytes encryption_iv:bytes file_hashes:Vector = upload.File; -dcOption#5d8c6cc flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int = DcOption; +dcOption#18b7a10d flags:# ipv6:flags.0?true media_only:flags.1?true tcpo_only:flags.2?true cdn:flags.3?true static:flags.4?true id:int ip_address:string port:int secret:flags.10?bytes = DcOption; config#86b5778e flags:# phonecalls_enabled:flags.1?true default_p2p_contacts:flags.3?true preload_featured_stickers:flags.4?true ignore_phone_entities:flags.5?true revoke_pm_inbox:flags.6?true date:int expires:int test_mode:Bool this_dc:int dc_options:Vector chat_size_max:int megagroup_size_max:int forwarded_count_max:int online_update_period_ms:int offline_blur_timeout_ms:int offline_idle_timeout_ms:int online_cloud_timeout_ms:int notify_cloud_delay_ms:int notify_default_delay_ms:int push_chat_period_ms:int push_chat_limit:int saved_gifs_limit:int edit_time_limit:int revoke_time_limit:int revoke_pm_time_limit:int rating_e_decay:int stickers_recent_limit:int stickers_faved_limit:int channels_read_media_period:int tmp_sessions:flags.0?int pinned_dialogs_count_max:int call_receive_timeout_ms:int call_ring_timeout_ms:int call_connect_timeout_ms:int call_packet_timeout_ms:int me_url_prefix:string suggested_lang_code:flags.2?string lang_pack_version:flags.2?int = Config; diff --git a/td/generate/scheme/telegram_api.tlo b/td/generate/scheme/telegram_api.tlo index e64081c6d..e9a4a167a 100644 Binary files a/td/generate/scheme/telegram_api.tlo and b/td/generate/scheme/telegram_api.tlo differ diff --git a/td/telegram/ConfigManager.cpp b/td/telegram/ConfigManager.cpp index 34658d91e..599fcbb08 100644 --- a/td/telegram/ConfigManager.cpp +++ b/td/telegram/ConfigManager.cpp @@ -477,7 +477,7 @@ class ConfigRecoverer : public Actor { auto promise = PromiseCreator::lambda([actor_id = actor_shared(this)](Result r_simple_config) { send_closure(actor_id, &ConfigRecoverer::on_simple_config, std::move(r_simple_config), false); }); - auto get_dimple_config = [&]() { + auto get_simple_config = [&]() { switch (simple_config_turn_ % 3) { case 0: return get_simple_config_azure; @@ -488,7 +488,7 @@ class ConfigRecoverer : public Actor { return get_simple_config_google_dns; } }(); - simple_config_query_ = get_dimple_config(std::move(promise), G()->is_test_dc(), G()->get_gc_scheduler_id()); + simple_config_query_ = get_simple_config(std::move(promise), G()->is_test_dc(), G()->get_gc_scheduler_id()); simple_config_turn_++; } diff --git a/td/telegram/SecureValue.cpp b/td/telegram/SecureValue.cpp index 3ff1f3511..74221fe8b 100644 --- a/td/telegram/SecureValue.cpp +++ b/td/telegram/SecureValue.cpp @@ -958,6 +958,14 @@ Result decrypt_secure_value(FileManager *file_manage case SecureValueType::PhoneNumber: res.data = encrypted_secure_value.data.data; break; + case SecureValueType::UtilityBill: + case SecureValueType::BankStatement: + case SecureValueType::RentalAgreement: { + TRY_RESULT(files, decrypt_secure_files(file_manager, secret, encrypted_secure_value.files)); + res.files = std::move(files.first); + res_credentials.files = std::move(files.second); + break; + } default: { TRY_RESULT(data, decrypt_secure_data(secret, encrypted_secure_value.data)); res.data = std::move(data.first); @@ -1051,6 +1059,14 @@ EncryptedSecureValue encrypt_secure_value(FileManager *file_manager, const secur res.data = EncryptedSecureData{secure_value.data, "", ""}; res.hash = secure_storage::calc_value_hash(secure_value.data).as_slice().str(); break; + case SecureValueType::UtilityBill: + case SecureValueType::BankStatement: + case SecureValueType::RentalAgreement: { + string to_hash; + res.files = encrypt_secure_files(file_manager, master_secret, secure_value.files, to_hash); + res.hash = secure_storage::calc_value_hash(to_hash).as_slice().str(); + break; + } default: { string to_hash; res.data = encrypt_secure_data(master_secret, secure_value.data, to_hash); diff --git a/td/telegram/net/DcId.h b/td/telegram/net/DcId.h index 092d9087e..8ab780407 100644 --- a/td/telegram/net/DcId.h +++ b/td/telegram/net/DcId.h @@ -5,10 +5,12 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #pragma once + #include "td/utils/logging.h" #include "td/utils/StringBuilder.h" namespace td { + class DcId { public: DcId() = default; diff --git a/td/telegram/net/DcOptions.h b/td/telegram/net/DcOptions.h index 191f00983..c18d8dd1b 100644 --- a/td/telegram/net/DcOptions.h +++ b/td/telegram/net/DcOptions.h @@ -19,6 +19,7 @@ #include "td/utils/tl_helpers.h" namespace td { + class DcOption { // do not forget to update PrintFlags enum Flags : int32 { IPv6 = 1, MediaOnly = 2, ObfuscatedTcpOnly = 4, Cdn = 8, Static = 16 }; @@ -201,7 +202,9 @@ class DcOptions { std::vector dc_options; }; + inline StringBuilder &operator<<(StringBuilder &sb, const DcOptions &dc_options) { return sb << "DcOptions" << format::as_array(dc_options.dc_options); } + }; // namespace td diff --git a/td/telegram/net/DcOptionsSet.h b/td/telegram/net/DcOptionsSet.h index 386cfad45..c5463b766 100644 --- a/td/telegram/net/DcOptionsSet.h +++ b/td/telegram/net/DcOptionsSet.h @@ -16,6 +16,7 @@ #include namespace td { + class DcOptionsSet { public: void add_dc_options(DcOptions dc_options); @@ -102,4 +103,5 @@ class DcOptionsSet { void init_option_stat(DcOptionInfo *option_info); OptionStat *get_option_stat(const DcOptionInfo *option_info); }; + } // namespace td diff --git a/td/telegram/net/MtprotoHeader.cpp b/td/telegram/net/MtprotoHeader.cpp index 625b58265..c3fc3d323 100644 --- a/td/telegram/net/MtprotoHeader.cpp +++ b/td/telegram/net/MtprotoHeader.cpp @@ -18,7 +18,7 @@ class HeaderStorer { } template void store(StorerT &storer) const { - constexpr int32 LAYER = 78; + constexpr int32 LAYER = 79; using td::store; // invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X; diff --git a/td/telegram/net/MtprotoHeader.h b/td/telegram/net/MtprotoHeader.h index e7f4a22bd..cacd41ca6 100644 --- a/td/telegram/net/MtprotoHeader.h +++ b/td/telegram/net/MtprotoHeader.h @@ -10,6 +10,7 @@ #include "td/utils/Slice.h" namespace td { + class MtprotoHeader { public: struct Options { diff --git a/td/telegram/net/NetQuery.cpp b/td/telegram/net/NetQuery.cpp index 3fdb3c184..851a9bdb3 100644 --- a/td/telegram/net/NetQuery.cpp +++ b/td/telegram/net/NetQuery.cpp @@ -9,6 +9,7 @@ #include "td/telegram/Global.h" namespace td { + ListNode net_query_list_; int32 NetQuery::get_my_id() { diff --git a/td/telegram/net/NetQueryCreator.cpp b/td/telegram/net/NetQueryCreator.cpp index 20d71d3b9..d95deb1eb 100644 --- a/td/telegram/net/NetQueryCreator.cpp +++ b/td/telegram/net/NetQueryCreator.cpp @@ -9,6 +9,7 @@ #include "td/utils/Gzip.h" namespace td { + NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, DcId dc_id, NetQuery::Type type, NetQuery::AuthFlag auth_flag, NetQuery::GzipFlag gzip_flag, double total_timeout_limit) { @@ -37,4 +38,5 @@ NetQueryCreator::Ptr NetQueryCreator::create(uint64 id, const Storer &storer, Dc query->total_timeout_limit = total_timeout_limit; return query; } + } // namespace td diff --git a/td/telegram/net/NetQueryCreator.h b/td/telegram/net/NetQueryCreator.h index 8973dc46b..8b9b3e64a 100644 --- a/td/telegram/net/NetQueryCreator.h +++ b/td/telegram/net/NetQueryCreator.h @@ -14,6 +14,7 @@ #include "td/utils/Storer.h" namespace td { + class NetQueryCreator { public: using Ptr = NetQueryPtr; @@ -51,4 +52,5 @@ class NetQueryCreator { private: ObjectPool object_pool_; }; + } // namespace td diff --git a/td/telegram/net/NetQueryDispatcher.h b/td/telegram/net/NetQueryDispatcher.h index f47b06b20..b628d0564 100644 --- a/td/telegram/net/NetQueryDispatcher.h +++ b/td/telegram/net/NetQueryDispatcher.h @@ -21,15 +21,12 @@ #include namespace td { + class NetQueryDelayer; -class DataCenter; class DcAuthManager; class SessionMultiProxy; class PublicRsaKeyShared; class PublicRsaKeyWatchdog; -} // namespace td - -namespace td { // Not just dispatcher. class NetQueryDispatcher { diff --git a/td/telegram/net/NetType.h b/td/telegram/net/NetType.h index e04eb1a98..089e725a3 100644 --- a/td/telegram/net/NetType.h +++ b/td/telegram/net/NetType.h @@ -11,6 +11,7 @@ #include "td/utils/logging.h" namespace td { + enum class NetType : int8 { Other, Wifi, Mobile, MobileRoaming, Size, None, Unknown }; inline NetType from_td_api(tl_object_ptr &net_type) { diff --git a/td/telegram/net/Session.cpp b/td/telegram/net/Session.cpp index df37151be..b48595502 100644 --- a/td/telegram/net/Session.cpp +++ b/td/telegram/net/Session.cpp @@ -199,7 +199,7 @@ void Session::connection_online_update(bool force) { void Session::send(NetQueryPtr &&query) { last_activity_timestamp_ = Time::now(); - query->debug("Session: received from DataCenter"); + query->debug("Session: received from SessionProxy"); query->set_session_id(auth_data_.session_id_); VLOG(net_query) << "got query " << query; if (query->update_is_ready()) { diff --git a/td/telegram/net/SessionMultiProxy.h b/td/telegram/net/SessionMultiProxy.h index 7a31656cf..e1741e71d 100644 --- a/td/telegram/net/SessionMultiProxy.h +++ b/td/telegram/net/SessionMultiProxy.h @@ -14,6 +14,7 @@ #include namespace td { + class SessionProxy; class SessionMultiProxy : public Actor { @@ -50,4 +51,5 @@ class SessionMultiProxy : public Actor { void update_auth_state(); }; + } // namespace td diff --git a/td/telegram/net/SessionProxy.cpp b/td/telegram/net/SessionProxy.cpp index df1e1d84f..4b8a47e16 100644 --- a/td/telegram/net/SessionProxy.cpp +++ b/td/telegram/net/SessionProxy.cpp @@ -17,6 +17,7 @@ #include namespace td { + namespace mtproto { class RawConnection; } // namespace mtproto @@ -179,4 +180,5 @@ void SessionProxy::on_tmp_auth_key_updated(mtproto::AuthKey auth_key) { LOG(WARNING) << "tmp_auth_key " << auth_key.id() << ": " << state; tmp_auth_key_ = std::move(auth_key); } + } // namespace td diff --git a/td/telegram/net/SessionProxy.h b/td/telegram/net/SessionProxy.h index 40f881612..b83a95f36 100644 --- a/td/telegram/net/SessionProxy.h +++ b/td/telegram/net/SessionProxy.h @@ -13,7 +13,9 @@ #include namespace td { + class Session; + class SessionProxy : public Actor { public: friend class SessionCallback; @@ -49,4 +51,5 @@ class SessionProxy : public Actor { void start_up() override; void tear_down() override; }; + } // namespace td diff --git a/td/telegram/net/TempAuthKeyWatchdog.h b/td/telegram/net/TempAuthKeyWatchdog.h index eff190bf6..84be95b91 100644 --- a/td/telegram/net/TempAuthKeyWatchdog.h +++ b/td/telegram/net/TempAuthKeyWatchdog.h @@ -22,6 +22,7 @@ #include namespace td { + class TempAuthKeyWatchdog : public NetQueryCallback { class RegisteredAuthKeyImpl { public: @@ -124,4 +125,5 @@ class TempAuthKeyWatchdog : public NetQueryCallback { try_sync(); } }; + } // namespace td