diff --git a/contrib/src/dhtnet/package.json b/contrib/src/dhtnet/package.json index fb9e9a5b3e610ea0618234e2969371c8e75a014f..b469a1b39cac50725574d94d2e4fa9123bc64529 100644 --- a/contrib/src/dhtnet/package.json +++ b/contrib/src/dhtnet/package.json @@ -1,6 +1,6 @@ { "name": "dhtnet", - "version": "f7abf971f0445d4add1fc33b2a3856f07eecf430", + "version": "406c0f46ca9d9a7785436a3981236aa0578c5b13", "url": "https://review.jami.net/plugins/gitiles/dhtnet/+archive/__VERSION__.tar.gz", "deps": [ "opendht", diff --git a/contrib/src/dhtnet/rules.mak b/contrib/src/dhtnet/rules.mak index a35c712032dcafdc58b7b429dcc96d1c9ced226f..1d981d0fff12cb0fe8a84ceb8b337a405a88eea6 100644 --- a/contrib/src/dhtnet/rules.mak +++ b/contrib/src/dhtnet/rules.mak @@ -1,5 +1,5 @@ # DHTNET -DHTNET_VERSION := f7abf971f0445d4add1fc33b2a3856f07eecf430 +DHTNET_VERSION := 406c0f46ca9d9a7785436a3981236aa0578c5b13 DHTNET_URL := https://review.jami.net/plugins/gitiles/dhtnet/+archive/$(DHTNET_VERSION).tar.gz PKGS += dhtnet diff --git a/src/account.cpp b/src/account.cpp index ded7046ca290eeddc60a575c5f715f30cf3b7c6d..5766e09434df2e0b120a37dcf7de14d93bb6eeef 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -159,13 +159,13 @@ void Account::loadConfig() { setActiveCodecs(config_->activeCodecs); auto ringtoneDir = fmt::format("{}/{}", JAMI_DATADIR, RINGDIR); - ringtonePath_ = fileutils::getFullPath(ringtoneDir, config_->ringtonePath); + ringtonePath_ = fileutils::getFullPath(ringtoneDir, config_->ringtonePath).string(); // If the user defined a custom ringtone, the file may not exists // In this case, fallback on the default ringtone path if (not std::filesystem::is_regular_file(ringtonePath_)) { JAMI_WARNING("Ringtone {} is not a valid file", ringtonePath_); config_->ringtonePath = DEFAULT_RINGTONE_PATH; - ringtonePath_ = fileutils::getFullPath(ringtoneDir, config_->ringtonePath); + ringtonePath_ = fileutils::getFullPath(ringtoneDir, config_->ringtonePath).string(); } updateUpnpController(); } diff --git a/src/account_config.cpp b/src/account_config.cpp index 5b2df46b487adeaf6246b551a6dd9ef7f887a22f..55535eb21f9cc76f26d3e8988b998ec743c76b65 100644 --- a/src/account_config.cpp +++ b/src/account_config.cpp @@ -65,7 +65,7 @@ AccountConfig::serializeDiff(YAML::Emitter& out, const AccountConfig& DEFAULT_CO SERIALIZE_CONFIG(USERNAME_KEY, username); SERIALIZE_CONFIG(MAILBOX_KEY, mailbox); out << YAML::Key << ACTIVE_CODEC_KEY << YAML::Value - << fmt::format(FMT_COMPILE("{}"), fmt::join(activeCodecs, "/"sv)); + << fmt::format(FMT_COMPILE("{}"), fmt::join(activeCodecs, "/")); SERIALIZE_CONFIG(ACCOUNT_AUTOANSWER_KEY, autoAnswerEnabled); SERIALIZE_CONFIG(ACCOUNT_READRECEIPT_KEY, sendReadReceipt); SERIALIZE_CONFIG(ACCOUNT_ISRENDEZVOUS_KEY, isRendezVous); @@ -76,7 +76,7 @@ AccountConfig::serializeDiff(YAML::Emitter& out, const AccountConfig& DEFAULT_CO SERIALIZE_CONFIG(DISPLAY_NAME_KEY, displayName); SERIALIZE_CONFIG(UPNP_ENABLED_KEY, upnpEnabled); out << YAML::Key << DEFAULT_MODERATORS_KEY << YAML::Value - << fmt::format(FMT_COMPILE("{}"), fmt::join(defaultModerators, "/"sv)); + << fmt::format(FMT_COMPILE("{}"), fmt::join(defaultModerators, "/")); SERIALIZE_CONFIG(LOCAL_MODERATORS_ENABLED_KEY, localModeratorsEnabled); SERIALIZE_CONFIG(ALL_MODERATORS_ENABLED_KEY, allModeratorsEnabled); SERIALIZE_CONFIG(PROXY_PUSH_TOKEN_KEY, deviceKey); @@ -186,7 +186,7 @@ parsePath(const std::map<std::string, std::string>& details, { auto it = details.find(key); if (it != details.end()) - s = fileutils::getFullPath(base, it->second); + s = fileutils::getFullPath(base, it->second).string(); } } // namespace jami diff --git a/src/config/yamlparser.cpp b/src/config/yamlparser.cpp index 6155741b2ff7cac60346da6c63ca04839999e5c7..24fe071b6bd19cd4dd67af0025cdba82beefe2d5 100644 --- a/src/config/yamlparser.cpp +++ b/src/config/yamlparser.cpp @@ -30,7 +30,7 @@ parsePath(const YAML::Node& node, const char* key, std::string& path, const std: { std::string val; parseValue(node, key, val); - path = fileutils::getFullPath(base, val); + path = fileutils::getFullPath(base, val).string(); } void @@ -38,7 +38,7 @@ parsePathOptional(const YAML::Node& node, const char* key, std::string& path, co { std::string val; if (parseValueOptional(node, key, val)) - path = fileutils::getFullPath(base, val); + path = fileutils::getFullPath(base, val).string(); } std::vector<std::map<std::string, std::string>> diff --git a/src/fileutils.cpp b/src/fileutils.cpp index b0e57ad661d43d7610d02d1b63be3c43c421a765..3790cf942a83321139407a67fd358ad3d9dbbcc2 100644 --- a/src/fileutils.cpp +++ b/src/fileutils.cpp @@ -293,13 +293,9 @@ getFileExtension(std::string_view filename) } bool -isPathRelative(const std::string& path) +isPathRelative(const std::filesystem::path& path) { -#ifndef _WIN32 - return not path.empty() and not(path[0] == '/'); -#else - return not path.empty() and path.find(":") == std::string::npos; -#endif + return not path.empty() and path.is_relative(); } std::string @@ -315,33 +311,33 @@ getCleanPath(const std::string& base, const std::string& path) } std::filesystem::path -getFullPath(const std::filesystem::path& base, const std::string& path) +getFullPath(const std::filesystem::path& base, const std::filesystem::path& path) { bool isRelative {not base.empty() and isPathRelative(path)}; - return isRelative ? base / path : std::filesystem::path(path); + return isRelative ? base / path : path; } std::vector<uint8_t> -loadFile(const std::string& path, const std::string& default_dir) +loadFile(const std::filesystem::path& path, const std::filesystem::path& default_dir) { return dhtnet::fileutils::loadFile(getFullPath(default_dir, path)); } std::string -loadTextFile(const std::string& path, const std::string& default_dir) +loadTextFile(const std::filesystem::path& path, const std::filesystem::path& default_dir) { std::string buffer; - std::ifstream file = ifstream(getFullPath(default_dir, path)); + std::ifstream file = ifstream(getFullPath(default_dir, path).string()); if (!file) - throw std::runtime_error("Can't read file: " + path); + throw std::runtime_error("Can't read file: " + path.string()); file.seekg(0, std::ios::end); auto size = file.tellg(); if (size > std::numeric_limits<unsigned>::max()) - throw std::runtime_error("File is too big: " + path); + throw std::runtime_error("File is too big: " + path.string()); buffer.resize(size); file.seekg(0, std::ios::beg); if (!file.read((char*) buffer.data(), size)) - throw std::runtime_error("Can't load file: " + path); + throw std::runtime_error("Can't load file: " + path.string()); return buffer; } @@ -868,7 +864,7 @@ size(const std::string& path) } std::string -sha3File(const std::string& path) +sha3File(const std::filesystem::path& path) { sha3_512_ctx ctx; sha3_512_init(&ctx); @@ -877,7 +873,7 @@ sha3File(const std::string& path) try { if (not std::filesystem::is_regular_file(path)) return {}; - openStream(file, path, std::ios::binary | std::ios::in); + openStream(file, path.string(), std::ios::binary | std::ios::in); if (!file) return {}; std::vector<char> buffer(8192, 0); @@ -931,10 +927,10 @@ accessFile(const std::string& file, int mode) } uint64_t -lastWriteTimeInSeconds(const std::string& filePath) +lastWriteTimeInSeconds(const std::filesystem::path& filePath) { return std::chrono::duration_cast<std::chrono::seconds>( - std::filesystem::last_write_time(std::filesystem::path(filePath)) + std::filesystem::last_write_time(filePath) .time_since_epoch()).count(); } diff --git a/src/fileutils.h b/src/fileutils.h index 26cefec80683bc1ea3a28d0f2880ccab5e8fd93d..d269b39075ede45bd27467d6bf0ae9b36b832a8c 100644 --- a/src/fileutils.h +++ b/src/fileutils.h @@ -59,7 +59,7 @@ std::string get_cache_dir(); LIBJAMI_PUBLIC void set_program_dir(char* program_path); // public because bin/main.cpp uses it std::string expand_path(const std::string& path); -bool isPathRelative(const std::string& path); +bool isPathRelative(const std::filesystem::path& path); /** * If path is contained in base, return the suffix, otherwise return the full path. * @param base must not finish with DIR_SEPARATOR_STR, can be empty @@ -69,7 +69,8 @@ std::string getCleanPath(const std::string& base, const std::string& path); /** * If path is relative, it is appended to base. */ -std::filesystem::path getFullPath(const std::filesystem::path& base, const std::string& path); +std::filesystem::path getFullPath(const std::filesystem::path& base, + const std::filesystem::path& path); bool createFileLink(const std::string& src, const std::string& dest, bool hard = false); @@ -81,8 +82,10 @@ bool isDirectoryWritable(const std::string& directory); * Read the full content of a file at path. * If path is relative, it is appended to default_dir. */ -std::vector<uint8_t> loadFile(const std::string& path, const std::string& default_dir = {}); -std::string loadTextFile(const std::string& path, const std::string& default_dir = {}); +std::vector<uint8_t> loadFile(const std::filesystem::path& path, + const std::filesystem::path& default_dir = {}); +std::string loadTextFile(const std::filesystem::path& path, + const std::filesystem::path& default_dir = {}); bool copy(const std::string& src, const std::string& dest); @@ -117,7 +120,7 @@ std::ofstream ofstream(const std::string& path, std::ios_base::openmode mode = s int64_t size(const std::string& path); -std::string sha3File(const std::string& path); +std::string sha3File(const std::filesystem::path& path); std::string sha3sum(const std::vector<uint8_t>& buffer); /** @@ -128,7 +131,7 @@ int accessFile(const std::string& file, int mode); /** * Return the last write time (epoch time) of a given file path (in seconds). */ -uint64_t lastWriteTimeInSeconds(const std::string& filePath); +uint64_t lastWriteTimeInSeconds(const std::filesystem::path& filePath); } // namespace fileutils } // namespace jami diff --git a/src/jamidht/archive_account_manager.cpp b/src/jamidht/archive_account_manager.cpp index 91aa2777a049e2a42989e8a26d05eb6ef53377b6..776d21732bf8b389863ee0c80bc22c39f9812030 100644 --- a/src/jamidht/archive_account_manager.cpp +++ b/src/jamidht/archive_account_manager.cpp @@ -202,7 +202,7 @@ ArchiveAccountManager::setValidity(const std::string& password, if (updated) { auto path = fileutils::getFullPath(path_, archivePath_); - archive.save(path, password); + archive.save(path.string(), password); } if (updated or not id or device.second->getId() == id) { @@ -376,7 +376,7 @@ ArchiveAccountManager::onArchiveLoaded(AuthContext& ctx, dhtnet::fileutils::check_dir(path_.c_str(), 0700); auto path = fileutils::getFullPath(path_, archivePath_); - a.save(path, ctx.credentials ? ctx.credentials->password : ""); + a.save(path.string(), ctx.credentials ? ctx.credentials->password : ""); if (not a.id.second->isCA()) { JAMI_ERR("[Auth] trying to sign a certificate with a non-CA."); @@ -569,7 +569,7 @@ AccountArchive ArchiveAccountManager::readArchive(const std::string& pwd) const { JAMI_DBG("[Auth] reading account archive"); - return AccountArchive(fileutils::getFullPath(path_, archivePath_), pwd); + return AccountArchive(fileutils::getFullPath(path_, archivePath_).string(), pwd); } void @@ -629,7 +629,7 @@ ArchiveAccountManager::saveArchive(AccountArchive& archive, const std::string& p updateArchive(archive); if (archivePath_.empty()) archivePath_ = "export.gz"; - archive.save(fileutils::getFullPath(path_, archivePath_), pwd); + archive.save(fileutils::getFullPath(path_, archivePath_).string(), pwd); } catch (const std::runtime_error& ex) { JAMI_ERR("[Auth] Can't export archive: %s", ex.what()); return; @@ -641,7 +641,7 @@ ArchiveAccountManager::changePassword(const std::string& password_old, const std::string& password_new) { try { - auto path = fileutils::getFullPath(path_, archivePath_); + auto path = fileutils::getFullPath(path_, archivePath_).string(); AccountArchive(path, password_old).save(path, password_new); return true; } catch (const std::exception&) { @@ -769,7 +769,7 @@ ArchiveAccountManager::exportArchive(const std::string& destinationPath, const s // Save contacts if possible before exporting AccountArchive archive = readArchive(password); updateArchive(archive); - archive.save(fileutils::getFullPath(path_, archivePath_), password); + archive.save(fileutils::getFullPath(path_, archivePath_).string(), password); // Export the file auto sourcePath = fileutils::getFullPath(path_, archivePath_); diff --git a/src/jamidht/conversationrepository.cpp b/src/jamidht/conversationrepository.cpp index dc2bd41428a309d9c46de1cccc0ab5e20de06f50..d6380bab2974433020aeaf4375416564dbf17d41 100644 --- a/src/jamidht/conversationrepository.cpp +++ b/src/jamidht/conversationrepository.cpp @@ -2902,7 +2902,7 @@ ConversationRepository::addMember(const std::string& uri) return {}; } - auto file = fileutils::ofstream(devicePath, std::ios::trunc | std::ios::binary); + auto file = fileutils::ofstream(devicePath.string(), std::ios::trunc | std::ios::binary); if (!file.is_open()) { JAMI_ERROR("Could not write data to {}", devicePath); return {}; @@ -3474,7 +3474,7 @@ ConversationRepository::voteKick(const std::string& uri, const std::string& type JAMI_ERROR("Error when creating {}. Abort vote", voteDirectory); return {}; } - auto votePath = fileutils::getFullPath(voteDirectory, adminUri); + auto votePath = fileutils::getFullPath(voteDirectory, adminUri).string(); auto voteFile = fileutils::ofstream(votePath, std::ios::trunc | std::ios::binary); if (!voteFile.is_open()) { JAMI_ERROR("Could not write data to {}", votePath); @@ -3482,7 +3482,7 @@ ConversationRepository::voteKick(const std::string& uri, const std::string& type } voteFile.close(); - auto toAdd = fileutils::getFullPath(relativeVotePath, adminUri); + auto toAdd = fileutils::getFullPath(relativeVotePath, adminUri).string(); if (!pimpl_->add(toAdd.c_str())) return {}; @@ -3514,7 +3514,7 @@ ConversationRepository::voteUnban(const std::string& uri, const std::string_view JAMI_ERROR("Error when creating {}. Abort vote", voteDirectory); return {}; } - auto votePath = fileutils::getFullPath(voteDirectory, adminUri); + auto votePath = fileutils::getFullPath(voteDirectory, adminUri).string(); auto voteFile = fileutils::ofstream(votePath, std::ios::trunc | std::ios::binary); if (!voteFile.is_open()) { JAMI_ERROR("Could not write data to {}", votePath); @@ -3522,7 +3522,7 @@ ConversationRepository::voteUnban(const std::string& uri, const std::string_view } voteFile.close(); - auto toAdd = fileutils::getFullPath(relativeVotePath, adminUri); + auto toAdd = fileutils::getFullPath(relativeVotePath, adminUri).string(); if (!pimpl_->add(toAdd.c_str())) return {}; diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 075306ecc64f8849bff15b3f10e047ecbe7011dc..760f52cd57b7a9c2a94890487521b4bd21310a49 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -982,7 +982,7 @@ JamiAccount::setValidity(const std::string& pwd, const dht::InfoHash& id, int64_ { if (auto manager = dynamic_cast<ArchiveAccountManager*>(accountManager_.get())) { if (manager->setValidity(pwd, id_, id, validity)) { - saveIdentity(id_, idPath_, DEVICE_ID_PATH); + saveIdentity(id_, idPath_.string(), DEVICE_ID_PATH); return true; } } @@ -1178,12 +1178,14 @@ JamiAccount::loadAccount(const std::string& archive_password, try { if (conf.managerUri.empty()) { accountManager_ = std::make_shared<ArchiveAccountManager>( - getPath(), + getPath().string(), [this]() { return getAccountDetails(); }, conf.archivePath.empty() ? "archive.gz" : conf.archivePath, conf.nameServer); } else { - accountManager_ = std::make_shared<ServerAccountManager>(getPath(), conf.managerUri, conf.nameServer); + accountManager_ = std::make_shared<ServerAccountManager>(getPath().string(), + conf.managerUri, + conf.nameServer); } auto id = accountManager_->loadIdentity(getAccountID(), @@ -1251,7 +1253,7 @@ JamiAccount::loadAccount(const std::string& archive_password, } else if (hasArchive) { // Migrating local account acreds->scheme = "local"; - acreds->uri = std::move(archivePath); + acreds->uri = std::move(archivePath).string(); acreds->updateIdentity = id; migrating = true; } @@ -1282,7 +1284,7 @@ JamiAccount::loadAccount(const std::string& archive_password, auto id = info.identity; editConfig([&](JamiAccountConfig& conf) { std::tie(conf.tlsPrivateKeyFile, conf.tlsCertificateFile) - = saveIdentity(id, idPath_, DEVICE_ID_PATH); + = saveIdentity(id, idPath_.string(), DEVICE_ID_PATH); conf.tlsPassword = {}; conf.archiveHasPassword = hasPassword; if (not conf.managerUri.empty()) { @@ -1792,7 +1794,7 @@ JamiAccount::doRegister_() dht::DhtRunner::Config config {}; config.dht_config.node_config.network = 0; config.dht_config.node_config.maintain_storage = false; - config.dht_config.node_config.persist_path = cachePath_ / "dhtstate"; + config.dht_config.node_config.persist_path = (cachePath_ / "dhtstate").string(); config.dht_config.id = id_; config.dht_config.cert_cache_all = true; config.push_node_id = getAccountID(); @@ -2475,9 +2477,9 @@ JamiAccount::loadTreatedMessages() { std::lock_guard<std::mutex> lock(messageMutex_); auto path = cachePath_ / "treatedMessages"; - treatedMessages_ = loadIdList<std::string>(path); + treatedMessages_ = loadIdList<std::string>(path.string()); if (treatedMessages_.empty()) { - auto messages = loadIdList(path); + auto messages = loadIdList(path.string()); for (const auto& m : messages) treatedMessages_.emplace(to_hex_string(m)); } @@ -2491,7 +2493,7 @@ JamiAccount::saveTreatedMessages() const auto& this_ = *sthis; std::lock_guard<std::mutex> lock(this_.messageMutex_); dhtnet::fileutils::check_dir(this_.cachePath_.c_str()); - saveIdList<decltype(this_.treatedMessages_)>(this_.cachePath_ / "treatedMessages", + saveIdList<decltype(this_.treatedMessages_)>((this_.cachePath_ / "treatedMessages").string(), this_.treatedMessages_); } }); @@ -2590,7 +2592,7 @@ JamiAccount::loadCachedProxyServer(std::function<void(const std::string& proxy)> cb(getDhtProxyServer(conf.proxyServer)); } else { loadCachedUrl(conf.proxyListUrl, - cachePath_ / "dhtproxylist", + (cachePath_ / "dhtproxylist").string(), std::chrono::hours(24 * 3), [w = weak(), cb = std::move(cb)](const dht::http::Response& response) { if (auto sthis = w.lock()) { @@ -2640,7 +2642,7 @@ JamiAccount::getDhtProxyServer(const std::string& serverList) // Cache it! dhtnet::fileutils::check_dir(cachePath_, 0700); auto proxyCachePath = cachePath_ / "dhtproxy"; - std::ofstream file = fileutils::ofstream(proxyCachePath); + std::ofstream file = fileutils::ofstream(proxyCachePath.string()); JAMI_DEBUG("Cache DHT proxy server: {}", proxyServerCached_); Json::Value node(Json::objectValue); node[getProxyConfigKey()] = proxyServerCached_; @@ -2942,7 +2944,7 @@ JamiAccount::sendTrustRequest(const std::string& to, const std::vector<uint8_t>& auto requestPath = cachePath_ / "requests"; dhtnet::fileutils::recursive_mkdir(requestPath, 0700); auto cachedFile = requestPath / to; - std::ofstream req = fileutils::ofstream(cachedFile, std::ios::trunc | std::ios::binary); + std::ofstream req = fileutils::ofstream(cachedFile.string(), std::ios::trunc | std::ios::binary); if (!req.is_open()) { JAMI_ERR("Could not write data to %s", cachedFile.c_str()); return; @@ -3670,7 +3672,7 @@ JamiAccount::sendProfile(const std::string& convId, } // We need a new channel transferFile(convId, - profilePath(), + profilePath().string(), deviceId, "profile.vcf", "", diff --git a/src/jamidht/jamiaccount.h b/src/jamidht/jamiaccount.h index 5179ba50bb0903caa8f66add92abc1862591982b..72c325b502ad4f83bc17434e65813dbbbf210404 100644 --- a/src/jamidht/jamiaccount.h +++ b/src/jamidht/jamiaccount.h @@ -147,7 +147,7 @@ public: std::unique_ptr<AccountConfig> buildConfig() const override { - return std::make_unique<JamiAccountConfig>(getAccountID(), idPath_); + return std::make_unique<JamiAccountConfig>(getAccountID(), idPath_.string()); } /** diff --git a/src/jamidht/jamiaccount_config.cpp b/src/jamidht/jamiaccount_config.cpp index 7ea5e95e6956da186c08f937bbe45d1c8d87145d..039e9f4077f3ba3a7413c95215520f726ed9e844 100644 --- a/src/jamidht/jamiaccount_config.cpp +++ b/src/jamidht/jamiaccount_config.cpp @@ -142,9 +142,11 @@ JamiAccountConfig::toMap() const a.emplace(libjami::Account::ConfProperties::ARCHIVE_HAS_PASSWORD, archiveHasPassword ? TRUE_STR : FALSE_STR); - a.emplace(Conf::CONFIG_TLS_CA_LIST_FILE, fileutils::getFullPath(path, tlsCaListFile)); - a.emplace(Conf::CONFIG_TLS_CERTIFICATE_FILE, fileutils::getFullPath(path, tlsCertificateFile)); - a.emplace(Conf::CONFIG_TLS_PRIVATE_KEY_FILE, fileutils::getFullPath(path, tlsPrivateKeyFile)); + a.emplace(Conf::CONFIG_TLS_CA_LIST_FILE, fileutils::getFullPath(path, tlsCaListFile).string()); + a.emplace(Conf::CONFIG_TLS_CERTIFICATE_FILE, + fileutils::getFullPath(path, tlsCertificateFile).string()); + a.emplace(Conf::CONFIG_TLS_PRIVATE_KEY_FILE, + fileutils::getFullPath(path, tlsPrivateKeyFile).string()); a.emplace(Conf::CONFIG_TLS_PASSWORD, tlsPassword); a.emplace(libjami::Account::ConfProperties::ALLOW_CERT_FROM_HISTORY, allowPeersFromHistory ? TRUE_STR : FALSE_STR); diff --git a/src/jamidht/jamiaccount_config.h b/src/jamidht/jamiaccount_config.h index cc3e6a6f7340290ecc1911d06b3eaf24affac11d..afd0abb5b2b328fd012bb7c0ed219d0ef69a1e07 100644 --- a/src/jamidht/jamiaccount_config.h +++ b/src/jamidht/jamiaccount_config.h @@ -26,7 +26,9 @@ constexpr static const char* DEFAULT_TURN_PWD = "ring"; constexpr static const char* DEFAULT_TURN_REALM = "ring"; struct JamiAccountConfig : public SipAccountBaseConfig { - JamiAccountConfig(const std::string& id = {}, const std::string& path = {}): SipAccountBaseConfig(std::string(ACCOUNT_TYPE_JAMI), id, path) { + JamiAccountConfig(const std::string& id = {}, const std::string& path = {}) + : SipAccountBaseConfig(std::string(ACCOUNT_TYPE_JAMI), id, path) + { // Default values specific to Jami accounts hostname = DHT_DEFAULT_BOOTSTRAP; turnServer = DEFAULT_TURN_SERVER; diff --git a/src/manager.cpp b/src/manager.cpp index 96d9d299b72d3a5ebb5b6ec348644ec61b8a120b..76163f11944bc876e8cdbf989c7085d871942f94 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -184,10 +184,10 @@ check_rename(const std::string& old_dir, const std::string& new_dir) auto old_dest = fileutils::getFullPath(old_dir, file); auto new_dest = fileutils::getFullPath(new_dir, file); if (std::filesystem::is_directory(old_dest) and std::filesystem::is_directory(new_dest)) { - check_rename(old_dest, new_dest); + check_rename(old_dest.string(), new_dest.string()); } else { JAMI_WARN() << "Migrating " << old_dest << " to " << new_dest; - std::rename(old_dest.c_str(), new_dest.c_str()); + std::rename(old_dest.string().c_str(), new_dest.string().c_str()); } } dhtnet::fileutils::removeAll(old_dir); @@ -2700,7 +2700,7 @@ Manager::getAccountDetails(const std::string& accountID) const } else { JAMI_ERR("Could not get account details on a non-existing accountID %s", accountID.c_str()); // return an empty map since we can't throw an exception to D-Bus - return std::map<std::string, std::string>(); + return {}; } } diff --git a/src/sip/sipaccountbase_config.h b/src/sip/sipaccountbase_config.h index d6e55a050ac3cf885fa120f252e3c504332a04b8..3aaa3cfd65b3f40f80618aafe0ba595868e9d953 100644 --- a/src/sip/sipaccountbase_config.h +++ b/src/sip/sipaccountbase_config.h @@ -24,7 +24,8 @@ constexpr static unsigned MAX_PORT {65536}; constexpr static unsigned HALF_MAX_PORT {MAX_PORT / 2}; struct SipAccountBaseConfig: public AccountConfig { - SipAccountBaseConfig(const std::string& type, const std::string& id, const std::string& path): AccountConfig(type, id, path) {} + SipAccountBaseConfig(const std::string& type, const std::string& id, const std::string& path) + : AccountConfig(type, id, path) {} void serializeDiff(YAML::Emitter& out, const SipAccountBaseConfig& def) const; void unserialize(const YAML::Node& node) override;