|
Ring Daemon
|
Classes | |
| struct | ArchiveStorageData |
Functions | |
| int | accessFile (const std::string &file, int mode) |
| Windows compatibility wrapper for checking read-only attribute. | |
| bool | createFileLink (const std::filesystem::path &linkFile, const std::filesystem::path &target, bool hard) |
| bool | createHardlink (const std::filesystem::path &linkFile, const std::filesystem::path &target) |
| bool | createSymlink (const std::filesystem::path &linkFile, const std::filesystem::path &target) |
| bool | eraseFile (const std::string &path, bool dosync) |
| bool | eraseFile_posix (const std::string &path, bool dosync) |
| std::string | expand_path (const std::string &path) |
| Expand the given path. | |
| const std::filesystem::path & | get_cache_dir () |
| std::filesystem::path | get_cache_dir (const char *pkg) |
| const std::filesystem::path & | get_config_dir () |
| std::filesystem::path | get_config_dir (const char *pkg) |
| const std::filesystem::path & | get_data_dir () |
| std::filesystem::path | get_data_dir (const char *pkg) |
| const std::filesystem::path & | get_home_dir () |
| std::filesystem::path | get_home_dir_impl () |
| const std::filesystem::path & | get_resource_dir_path () |
| Get the resource directory path that was set with set_resource_dir_path. | |
| std::string | getCleanPath (const std::string &base, const std::string &path) |
| If path is contained in base, return the suffix, otherwise return the full path. | |
| std::string_view | getFileExtension (std::string_view filename) |
| std::filesystem::path | getFullPath (const std::filesystem::path &base, const std::filesystem::path &path) |
| If path is relative, it is appended to base. | |
| std::string | getOrCreateLocalDeviceId () |
| bool | isDirectoryWritable (const std::string &directory) |
| bool | isPathRelative (const std::filesystem::path &path) |
| uint64_t | lastWriteTimeInSeconds (const std::filesystem::path &filePath) |
| Return the last write time (epoch time) of a given file path (in seconds). | |
| std::vector< uint8_t > | loadCacheFile (const std::filesystem::path &path, std::chrono::system_clock::duration maxAge) |
| std::string | loadCacheTextFile (const std::filesystem::path &path, std::chrono::system_clock::duration maxAge) |
| std::vector< uint8_t > | loadFile (const std::filesystem::path &path, const std::filesystem::path &default_dir={}) |
| Read the full content of a file at path. | |
| std::string | loadTextFile (const std::filesystem::path &path, const std::filesystem::path &default_dir) |
| ArchiveStorageData | readArchive (const std::filesystem::path &path, std::string_view scheme, const std::string &pwd) |
| int | remove (const std::filesystem::path &path, bool erase) |
| void | saveFile (const std::filesystem::path &path, const std::vector< uint8_t > &data, mode_t mode=0644) |
| void | saveFile (const std::filesystem::path &path, const uint8_t *data, size_t data_size, mode_t mode=0644) |
| void | saveFile (const std::filesystem::path &path, const uint8_t *data, size_t data_size, mode_t UNUSED mode) |
| void | set_resource_dir_path (const std::filesystem::path &resourceDirPath) |
| Set the program's resource directory path. | |
| std::string | sha3File (const std::filesystem::path &path) |
| std::string | sha3sum (const std::vector< uint8_t > &buffer) |
| bool | writeArchive (const std::string &archive_str, const std::filesystem::path &path, std::string_view scheme, const std::string &password, const std::vector< uint8_t > &password_salt) |
Variables | |
| static constexpr auto | ARCHIVE_AUTH_SCHEME_KEY = "key"sv |
| static constexpr auto | ARCHIVE_AUTH_SCHEME_NONE = ""sv |
| static constexpr auto | ARCHIVE_AUTH_SCHEME_PASSWORD = "password"sv |
| static std::filesystem::path | resource_dir_path |
Windows compatibility wrapper for checking read-only attribute.
Definition at line 805 of file fileutils.cpp.
References jami::emitSignal().
Referenced by isDirectoryWritable().

| bool jami::fileutils::createFileLink | ( | const std::filesystem::path & | linkFile, |
| const std::filesystem::path & | target, | ||
| bool | hard | ||
| ) |
Definition at line 216 of file fileutils.cpp.
References createHardlink(), createSymlink(), jami::emitSignal(), and JAMI_DEBUG.
Referenced by jami::vCard::utils::save().

| bool jami::fileutils::createHardlink | ( | const std::filesystem::path & | linkFile, |
| const std::filesystem::path & | target | ||
| ) |
Definition at line 202 of file fileutils.cpp.
References jami::emitSignal(), JAMI_LOG, and JAMI_WARNING.
Referenced by createFileLink().

| bool jami::fileutils::createSymlink | ( | const std::filesystem::path & | linkFile, |
| const std::filesystem::path & | target | ||
| ) |
Definition at line 188 of file fileutils.cpp.
References jami::emitSignal(), JAMI_LOG, and JAMI_WARNING.
Referenced by createFileLink().

Definition at line 734 of file fileutils.cpp.
References jami::emitSignal(), and eraseFile_posix().
Referenced by remove().

Definition at line 690 of file fileutils.cpp.
References jami::emitSignal(), JAMI_WARN, JAMI_WARNING, S_IWGRP, and S_IWUSR.
Referenced by eraseFile().

| std::string jami::fileutils::expand_path | ( | const std::string & | path | ) |
Expand the given path.
| path | The path to be expanded. |
Definition at line 139 of file fileutils.cpp.
References jami::emitSignal(), and JAMI_ERR.
Referenced by jami::AudioPreference::setRecordPath().

| const std::filesystem::path & jami::fileutils::get_cache_dir | ( | ) |
Definition at line 495 of file fileutils.cpp.
References jami::emitSignal(), and get_cache_dir().
Referenced by jami::Manager::ManagerPimpl::cleanupAccountStorage(), jami::SIPAccountBase::flush(), get_cache_dir(), jami::Manager::init(), jami::SIPAccountBase::loadConfig(), and jami::NameDirectory::NameDirectory().

Definition at line 469 of file fileutils.cpp.
References jami::emitSignal(), get_home_dir(), jami::to_string(), and XDG_CACHE_HOME.

| const std::filesystem::path & jami::fileutils::get_config_dir | ( | ) |
Definition at line 619 of file fileutils.cpp.
References jami::emitSignal(), and get_config_dir().
Referenced by get_config_dir(), jami::Manager::init(), jami::MediaEncoder::readConfig(), and jami::Manager::ManagerPimpl::retrieveConfigPath().

Definition at line 584 of file fileutils.cpp.
References jami::emitSignal(), get_home_dir(), JAMI_DBG, and XDG_CONFIG_HOME.

| const std::filesystem::path & jami::fileutils::get_data_dir | ( | ) |
Definition at line 577 of file fileutils.cpp.
References jami::emitSignal(), and get_data_dir().
Referenced by jami::OutgoingFile::cancel(), jami::Manager::ManagerPimpl::cleanupAccountStorage(), jami::ConversationRepository::cloneConversation(), jami::ConversationRepository::createConversation(), jami::ConversationModule::Impl::editMessage(), jami::ConversationRepository::fetch(), get_data_dir(), jami::PluginPreferencesUtils::getAllowDenyListsPath(), jami::JamiPluginManager::getInstalledPlugins(), getOrCreateLocalDeviceId(), jami::GitServer::GitServer(), jami::ConversationRepository::Impl::Impl(), jami::TransferManager::Impl::Impl(), jami::Manager::init(), jami::JamiPluginManager::installPlugin(), jami::Manager::loadAccountAndConversation(), jami::Manager::loadAccountMap(), jami::ConversationModule::loadConversations(), jami::ConversationModule::Impl::loadMetadata(), jami::ConversationModule::loadSingleConversation(), jami::ConversationRepository::Impl::repository(), jami::ConversationModule::saveConvInfos(), jami::ConversationModule::saveConvRequests(), jami::ConversationModule::Impl::saveMetadata(), jami::TransferChannelHandler::TransferChannelHandler(), jami::JamiPluginManager::uninstallPlugin(), and jami::PluginPreferencesUtils::valuesFilePath().

Definition at line 545 of file fileutils.cpp.
References jami::emitSignal(), get_home_dir(), and XDG_DATA_HOME.

| const std::filesystem::path & jami::fileutils::get_home_dir | ( | ) |
Definition at line 538 of file fileutils.cpp.
References jami::emitSignal(), and get_home_dir_impl().
Referenced by get_cache_dir(), get_config_dir(), get_data_dir(), and jami::Recordable::toggleRecording().

| std::filesystem::path jami::fileutils::get_home_dir_impl | ( | ) |
Definition at line 502 of file fileutils.cpp.
References jami::emitSignal(), PROTECTED_GETENV, and jami::to_string().
Referenced by get_home_dir().

| const std::filesystem::path & jami::fileutils::get_resource_dir_path | ( | ) |
Get the resource directory path that was set with set_resource_dir_path.
Definition at line 132 of file fileutils.cpp.
References jami::emitSignal(), and resource_dir_path.
Referenced by jami::Account::loadConfig().

If path is contained in base, return the suffix, otherwise return the full path.
| base | must not finish with DIR_SEPARATOR_STR, can be empty |
| path | the path |
Definition at line 262 of file fileutils.cpp.
References DIR_SEPARATOR_STR, and jami::emitSignal().

| std::string_view jami::fileutils::getFileExtension | ( | std::string_view | filename | ) |
Definition at line 244 of file fileutils.cpp.
References jami::emitSignal().
Referenced by jami::getFileId().

| std::filesystem::path jami::fileutils::getFullPath | ( | const std::filesystem::path & | base, |
| const std::filesystem::path & | path | ||
| ) |
If path is relative, it is appended to base.
Definition at line 274 of file fileutils.cpp.
References jami::emitSignal(), and isPathRelative().
Referenced by jami::Conversation::Impl::isAdmin(), jami::ConversationRepository::join(), jami::Account::loadConfig(), loadFile(), loadTextFile(), jami::parsePath(), jami::yaml_utils::parsePath(), jami::yaml_utils::parsePathOptional(), jami::ConversationRepository::resolveVote(), jami::JamiAccountConfig::toMap(), jami::ConversationRepository::voteKick(), and jami::ConversationRepository::voteUnban().

| std::string jami::fileutils::getOrCreateLocalDeviceId | ( | ) |
Definition at line 827 of file fileutils.cpp.
References jami::emitSignal(), get_data_dir(), JAMI_ERROR, and jami::to_hex_string().
Referenced by jami::Manager::init().

Definition at line 182 of file fileutils.cpp.
References accessFile(), and jami::emitSignal().
Referenced by jami::AudioPreference::setRecordPath().

Definition at line 256 of file fileutils.cpp.
References jami::emitSignal().
Referenced by getFullPath().

Return the last write time (epoch time) of a given file path (in seconds).
Definition at line 815 of file fileutils.cpp.
References jami::emitSignal(), and JAMI_WARNING.
Referenced by jami::Conversation::preferences(), and jami::Conversation::updatePreferences().

| std::vector< uint8_t > jami::fileutils::loadCacheFile | ( | const std::filesystem::path & | path, |
| std::chrono::system_clock::duration | maxAge | ||
| ) |
Definition at line 330 of file fileutils.cpp.
References jami::emitSignal(), and JAMI_LOG.

| std::string jami::fileutils::loadCacheTextFile | ( | const std::filesystem::path & | path, |
| std::chrono::system_clock::duration | maxAge | ||
| ) |
Definition at line 346 of file fileutils.cpp.
References jami::emitSignal(), JAMI_LOG, and loadTextFile().

| std::vector< uint8_t > jami::fileutils::loadFile | ( | const std::filesystem::path & | path, |
| const std::filesystem::path & | default_dir = {} |
||
| ) |
Read the full content of a file at path.
If path is relative, it is appended to default_dir.
Definition at line 281 of file fileutils.cpp.
References jami::emitSignal(), and getFullPath().
Referenced by jami::ConversationRepository::Impl::devices(), libjami::getCertificateDetailsPath(), jami::ConversationRepository::infos(), jami::ConversationRepository::leave(), jami::Conversation::Impl::loadActiveCalls(), jami::Conversation::Impl::loadHostedCalls(), jami::ConversationRepository::Impl::loadMembers(), jami::ConversationModule::Impl::loadMetadata(), jami::Conversation::Impl::loadStatus(), jami::TransferManager::Impl::loadWaiting(), jami::Conversation::preferences(), jami::PluginUtils::readPluginCertificate(), jami::ConversationRepository::Impl::resolveBan(), jami::tls::TlsValidator::TlsValidator(), jami::SIPAccount::updateProfile(), jami::ConversationRepository::Impl::uriFromDevice(), jami::ConversationRepository::Impl::validateDevice(), and jami::Conversation::vCard().

| std::string jami::fileutils::loadTextFile | ( | const std::filesystem::path & | path, |
| const std::filesystem::path & | default_dir | ||
| ) |
Definition at line 287 of file fileutils.cpp.
References jami::emitSignal(), and getFullPath().
Referenced by jami::Account::getProfileVcard(), and loadCacheTextFile().

| ArchiveStorageData jami::fileutils::readArchive | ( | const std::filesystem::path & | path, |
| std::string_view | scheme, | ||
| const std::string & | pwd | ||
| ) |
Definition at line 362 of file fileutils.cpp.
References ARCHIVE_AUTH_SCHEME_KEY, ARCHIVE_AUTH_SCHEME_PASSWORD, jami::base64::decode(), jami::archiver::decompress(), jami::emitSignal(), JAMI_ERROR, JAMI_LOG, JAMI_WARNING, and jami::fileutils::ArchiveStorageData::salt.
Referenced by jami::AccountArchive::load().

Definition at line 744 of file fileutils.cpp.
References jami::emitSignal(), and eraseFile().

|
inline |
Definition at line 106 of file fileutils.h.
References saveFile().

| void jami::fileutils::saveFile | ( | const std::filesystem::path & | path, |
| const uint8_t * | data, | ||
| size_t | data_size, | ||
| mode_t | mode = 0644 |
||
| ) |
| void jami::fileutils::saveFile | ( | const std::filesystem::path & | path, |
| const uint8_t * | data, | ||
| size_t | data_size, | ||
| mode_t UNUSED | mode | ||
| ) |
Definition at line 314 of file fileutils.cpp.
References jami::emitSignal(), JAMI_ERROR, and JAMI_WARNING.
Referenced by saveFile(), and writeArchive().

| LIBJAMI_PUBLIC void jami::fileutils::set_resource_dir_path | ( | const std::filesystem::path & | resourceDirPath | ) |
Set the program's resource directory path.
This is used for clients that may be installed in different locations and are deployed with ringtones and other resources in an application relative directory.
| resource_dir_path | The path to the ringtone directory. |
Definition at line 126 of file fileutils.cpp.
References jami::emitSignal(), and resource_dir_path.
Referenced by libjami::setResourceDirPath().

| std::string jami::fileutils::sha3File | ( | const std::filesystem::path & | path | ) |
Definition at line 759 of file fileutils.cpp.
References jami::emitSignal(), and JAMI_ERROR.
Referenced by jami::ConversationModule::onFileChannelRequest(), and jami::IncomingFile::process().

Definition at line 794 of file fileutils.cpp.
References jami::emitSignal().

| bool jami::fileutils::writeArchive | ( | const std::string & | archive_str, |
| const std::filesystem::path & | path, | ||
| std::string_view | scheme, | ||
| const std::string & | password, | ||
| const std::vector< uint8_t > & | password_salt | ||
| ) |
Definition at line 432 of file fileutils.cpp.
References ARCHIVE_AUTH_SCHEME_KEY, ARCHIVE_AUTH_SCHEME_NONE, ARCHIVE_AUTH_SCHEME_PASSWORD, jami::archiver::compress(), jami::archiver::compressGzip(), jami::base64::decode(), jami::emitSignal(), JAMI_ERROR, JAMI_LOG, JAMI_WARNING, and saveFile().
Referenced by jami::AccountArchive::save().

Definition at line 116 of file fileutils.h.
Referenced by readArchive(), and writeArchive().
Definition at line 114 of file fileutils.h.
Referenced by writeArchive().
Definition at line 115 of file fileutils.h.
Referenced by readArchive(), and writeArchive().
|
static |
Definition at line 123 of file fileutils.cpp.
Referenced by get_resource_dir_path(), and set_resource_dir_path().