From e676bd1e6567b7dc9470eb130dfdff00bdf5c837 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Wed, 17 Dec 2025 12:25:38 +0100 Subject: [PATCH] fix encrypted profile creation --- src/tox_client.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tox_client.cpp b/src/tox_client.cpp index 97ba7e8..92f9cf8 100644 --- a/src/tox_client.cpp +++ b/src/tox_client.cpp @@ -61,7 +61,6 @@ ToxClient::ToxClient(ConfigModelI& conf, std::string_view save_path, std::string )) { throw std::runtime_error("failed to decrypt save file!"); } - eee(_tox_profile_password); } tox_options_set_savedata_type(options.get(), TOX_SAVEDATA_TYPE_TOX_SAVE); tox_options_set_savedata_data(options.get(), profile_data.data(), profile_data.size()); @@ -71,6 +70,12 @@ ToxClient::ToxClient(ConfigModelI& conf, std::string_view save_path, std::string } } + // prepare for runtime state + if (!_tox_profile_password.empty()) { + eee(_tox_profile_password); + } + + tox_options_set_ipv6_enabled(options.get(), conf.get_bool("tox", "ipv6_enabled").value_or(true)); tox_options_set_udp_enabled(options.get(), conf.get_bool("tox", "udp_enabled").value_or(true)); tox_options_set_local_discovery_enabled(options.get(), conf.get_bool("tox", "local_discovery_enabled").value_or(true)); @@ -207,7 +212,6 @@ void ToxClient::saveToxProfile(void) { if (!_tox_profile_password.empty()) { std::vector unencrypted_copy(data.begin(), data.end()); - //profile_data.clear(); data.resize(unencrypted_copy.size() + TOX_PASS_ENCRYPTION_EXTRA_LENGTH); eee(_tox_profile_password); if (!tox_pass_encrypt(