From 5832bb7ca419c96b836c7edb39f68daba6a87ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Tue, 2 Jan 2024 12:29:16 -0500 Subject: [PATCH] archiver: cleanup Change-Id: I518fd3541487e432f405ae25d707cfb2713da9fc --- src/archiver.cpp | 58 ------------------------------------------------ 1 file changed, 58 deletions(-) diff --git a/src/archiver.cpp b/src/archiver.cpp index 18d6a1079a..9bdbca9089 100644 --- a/src/archiver.cpp +++ b/src/archiver.cpp @@ -55,64 +55,6 @@ using namespace std::literals; namespace jami { namespace archiver { -std::map<std::string, std::string> -jsonValueToAccount(Json::Value& value, const std::string& accountId) -{ - auto idPath_ = fileutils::get_data_dir() / accountId; - dhtnet::fileutils::check_dir(idPath_.c_str(), 0700); - auto detailsMap = libjami::getAccountTemplate( - value[libjami::Account::ConfProperties::TYPE].asString()); - - for (Json::ValueIterator itr = value.begin(); itr != value.end(); itr++) { - if (itr->asString().empty()) - continue; - if (itr.key().asString().compare(libjami::Account::ConfProperties::TLS::CA_LIST_FILE) == 0) { - std::string fileContent(itr->asString()); - fileutils::saveFile(idPath_ / "ca.key", - {fileContent.begin(), fileContent.end()}, - 0600); - - } else if (itr.key().asString().compare( - libjami::Account::ConfProperties::TLS::PRIVATE_KEY_FILE) - == 0) { - std::string fileContent(itr->asString()); - fileutils::saveFile(idPath_ / "dht.key", - {fileContent.begin(), fileContent.end()}, - 0600); - - } else if (itr.key().asString().compare( - libjami::Account::ConfProperties::TLS::CERTIFICATE_FILE) - == 0) { - std::string fileContent(itr->asString()); - fileutils::saveFile(idPath_ / "dht.crt", - {fileContent.begin(), fileContent.end()}, - 0600); - } else - detailsMap[itr.key().asString()] = itr->asString(); - } - - return detailsMap; -} - -Json::Value -accountToJsonValue(const std::map<std::string, std::string>& details) -{ - Json::Value root; - for (const auto& i : details) { - if (i.first == libjami::Account::ConfProperties::Ringtone::PATH) { - // Ringtone path is not exportable - } else if (i.first == libjami::Account::ConfProperties::TLS::CA_LIST_FILE - || i.first == libjami::Account::ConfProperties::TLS::CERTIFICATE_FILE - || i.first == libjami::Account::ConfProperties::TLS::PRIVATE_KEY_FILE) { - // replace paths by the files content - root[i.first] = fileutils::loadTextFile(std::filesystem::path(i.second)); - } else - root[i.first] = i.second; - } - - return root; -} - std::vector<uint8_t> compress(const std::string& str) { -- GitLab