|
Ring Daemon
|
This class provides an interface to functions exposed to the Plugin System interface for lrc and clients. More...
#include <jamipluginmanager.h>

Public Member Functions | |
| std::unique_ptr< dht::crypto::Certificate > | checkPluginCertificate (const std::string &jplPath, bool force) |
| Checks if the certificate mechanism is valid by checking certificate of the plugin. | |
| bool | checkPluginCertificatePublicKey (const std::string &oldJplPath, const std::string &newJplPath) |
| check if the if the public key of the certificate is the same as the public key in the new plugin | |
| bool | checkPluginCertificateValidity (dht::crypto::Certificate *cert) |
| Check the validity of a plugin certificate. | |
| bool | checkPluginSignature (const std::string &jplPath, dht::crypto::Certificate *cert) |
| Checks if the plugin signature mechanism is valid by signature of files and each files is signed. | |
| bool | checkPluginSignatureFile (const std::string &jplPath) |
| check if all file are present in the signature file | |
| bool | checkPluginSignatureValidity (const std::string &jplPath, dht::crypto::Certificate *cert) |
| Check the validity of a plugin signature. | |
| CallServicesManager & | getCallServicesManager () |
| ChatServicesManager & | getChatServicesManager () |
| std::vector< std::string > | getInstalledPlugins () |
| Returns a vector with installed plugins. | |
| std::vector< std::string > | getLoadedPlugins () const |
| Returns vector with rootpaths of the loaded plugins. | |
| std::map< std::string, std::string > | getPlatformInfo () |
| Returns a Map of platform system. | |
| std::string | getPluginAuthor (const std::string &rootPath, const std::string &pluginId) |
| get the plugin's author | |
| std::map< std::string, std::string > | getPluginDetails (const std::string &rootPath, bool reset=false) |
| Parses a manifest file and return its content along with other internally added values. | |
| std::vector< std::map< std::string, std::string > > | getPluginPreferences (const std::string &rootPath, const std::string &accountId) |
| Returns contents of plugin's preferences.json file. | |
| std::map< std::string, std::string > | getPluginPreferencesValuesMap (const std::string &rootPath, const std::string &accountId) |
| Returns a Map with preferences keys and values. | |
| PreferenceServicesManager & | getPreferenceServicesManager () |
| WebViewServicesManager & | getWebViewServicesManager () |
| int | installPlugin (const std::string &jplPath, bool force) |
| Checks if the plugin has a valid manifest, installs the plugin if not previously installed or if installing a newer version of it. | |
| JamiPluginManager () | |
| bool | loadPlugin (const std::string &rootPath) |
| Returns True if success. | |
| bool | loadPlugins () |
| Returns True if success. | |
| bool | resetPluginPreferencesValuesMap (const std::string &rootPath, const std::string &accountId) |
| Reset plugin's preferences values to their defaultValues. | |
| bool | setPluginPreference (const std::filesystem::path &rootPath, const std::string &accountId, const std::string &key, const std::string &value) |
| Modifies a preference value by saving it to a preferences.msgpack. | |
| int | uninstallPlugin (const std::string &rootPath) |
| Checks if the plugin has a valid manifest and if the plugin is loaded, tries to unload it and then removes plugin folder. | |
| bool | unloadPlugin (const std::string &rootPath) |
| Returns True if success. | |
This class provides an interface to functions exposed to the Plugin System interface for lrc and clients.
Definition at line 39 of file jamipluginmanager.h.
| jami::JamiPluginManager::JamiPluginManager | ( | ) |
Definition at line 54 of file jamipluginmanager.cpp.
| std::unique_ptr< dht::crypto::Certificate > jami::JamiPluginManager::checkPluginCertificate | ( | const std::string & | jplPath, |
| bool | force | ||
| ) |
Checks if the certificate mechanism is valid by checking certificate of the plugin.
| jplPath | |
| force |
Definition at line 237 of file jamipluginmanager.cpp.
References checkPluginCertificateValidity(), jami::emitSignal(), and jami::PluginUtils::readPluginCertificateFromArchive().
Referenced by installPlugin().

| bool jami::JamiPluginManager::checkPluginCertificatePublicKey | ( | const std::string & | oldJplPath, |
| const std::string & | newJplPath | ||
| ) |
check if the if the public key of the certificate is the same as the public key in the new plugin
| oldJplPath,newJplPath | return true if valid |
Definition at line 125 of file jamipluginmanager.cpp.
References DIR_SEPARATOR_CH, jami::emitSignal(), JAMI_ERR, jami::PluginUtils::manifestPath(), jami::PluginUtils::parseManifestFile(), jami::PluginUtils::readPluginCertificate(), and jami::PluginUtils::readPluginCertificateFromArchive().
Referenced by installPlugin().

| bool jami::JamiPluginManager::checkPluginCertificateValidity | ( | dht::crypto::Certificate * | cert | ) |
Check the validity of a plugin certificate.
| cert |
Definition at line 149 of file jamipluginmanager.cpp.
References jami::emitSignal(), JAMI_ERROR, and store_ca_crt.
Referenced by checkPluginCertificate().

| bool jami::JamiPluginManager::checkPluginSignature | ( | const std::string & | jplPath, |
| dht::crypto::Certificate * | cert | ||
| ) |
Checks if the plugin signature mechanism is valid by signature of files and each files is signed.
| jplPath | |
return true if the plugin signature is valid
Definition at line 225 of file jamipluginmanager.cpp.
References checkPluginSignatureFile(), checkPluginSignatureValidity(), and jami::emitSignal().
Referenced by installPlugin().

check if all file are present in the signature file
| jplPath | return true if valid |
Definition at line 168 of file jamipluginmanager.cpp.
References jami::emitSignal(), jami::archiver::listFilesFromArchive(), jami::PluginUtils::readPluginManifestFromArchive(), and jami::PluginUtils::readPluginSignatureFromArchive().
Referenced by checkPluginSignature().

| bool jami::JamiPluginManager::checkPluginSignatureValidity | ( | const std::string & | jplPath, |
| dht::crypto::Certificate * | cert | ||
| ) |
Check the validity of a plugin signature.
| jplPath | |
| cert |
Definition at line 199 of file jamipluginmanager.cpp.
References jami::emitSignal(), JAMI_ERROR, jami::archiver::readFileFromArchive(), jami::PluginUtils::readPluginSignatureFromArchive(), and jami::PluginUtils::readSignatureFileFromArchive().
Referenced by checkPluginSignature().

|
inline |
Definition at line 200 of file jamipluginmanager.h.
|
inline |
Definition at line 202 of file jamipluginmanager.h.
| std::vector< std::string > jami::JamiPluginManager::getInstalledPlugins | ( | ) |
Returns a vector with installed plugins.
Definition at line 102 of file jamipluginmanager.cpp.
References jami::PluginUtils::checkPluginValidity(), jami::emitSignal(), jami::fileutils::get_data_dir(), and jami::Manager::instance().

| std::vector< std::string > jami::JamiPluginManager::getLoadedPlugins | ( | ) | const |
Returns vector with rootpaths of the loaded plugins.
Definition at line 391 of file jamipluginmanager.cpp.
References jami::emitSignal(), and jami::PluginManager::getLoadedPlugins().

| std::map< std::string, std::string > jami::JamiPluginManager::getPlatformInfo | ( | ) |
Returns a Map of platform system.
Definition at line 162 of file jamipluginmanager.cpp.
References jami::PluginUtils::getPlatformInfo().

| std::string jami::JamiPluginManager::getPluginAuthor | ( | const std::string & | rootPath, |
| const std::string & | pluginId | ||
| ) |
get the plugin's author
| rootPath | |
| pluginId |
Definition at line 64 of file jamipluginmanager.cpp.
References jami::emitSignal(), JAMI_ERROR, and jami::PluginUtils::readPluginCertificate().
Referenced by getPluginDetails().

| std::map< std::string, std::string > jami::JamiPluginManager::getPluginDetails | ( | const std::string & | rootPath, |
| bool | reset = false |
||
| ) |
Parses a manifest file and return its content along with other internally added values.
| rootPath | installation path |
| reset | If true, overrides previous details values Reset is only used in the UT for now, but it can be useful if we want to reset plugins language without restarting the application |
Definition at line 75 of file jamipluginmanager.cpp.
References DIR_SEPARATOR_CH, jami::emitSignal(), getPluginAuthor(), LIB_PREFIX, LIB_TYPE, jami::PluginUtils::manifestPath(), and jami::PluginUtils::parseManifestFile().
Referenced by loadPlugin(), and unloadPlugin().

| std::vector< std::map< std::string, std::string > > jami::JamiPluginManager::getPluginPreferences | ( | const std::string & | rootPath, |
| const std::string & | accountId | ||
| ) |
Returns contents of plugin's preferences.json file.
| rootPath | |
| accountId |
Definition at line 404 of file jamipluginmanager.cpp.
References jami::emitSignal(), and jami::PluginPreferencesUtils::getPreferences().

| std::map< std::string, std::string > jami::JamiPluginManager::getPluginPreferencesValuesMap | ( | const std::string & | rootPath, |
| const std::string & | accountId | ||
| ) |
Returns a Map with preferences keys and values.
| rootPath | |
| accountId |
Definition at line 480 of file jamipluginmanager.cpp.
References jami::emitSignal(), and jami::PluginPreferencesUtils::getPreferencesValuesMap().

|
inline |
Definition at line 206 of file jamipluginmanager.h.
|
inline |
Definition at line 204 of file jamipluginmanager.h.
Checks if the plugin has a valid manifest, installs the plugin if not previously installed or if installing a newer version of it.
| jplPath | |
| force | If true, allows installing an older plugin version. |
Definition at line 253 of file jamipluginmanager.cpp.
References CERTIFICATE_VERIFICATION_FAILED, checkPluginCertificate(), checkPluginCertificatePublicKey(), checkPluginSignature(), jami::emitSignal(), jami::fileutils::get_data_dir(), libjami::getPluginsEnabled(), jami::Manager::instance(), INVALID_PLUGIN, JAMI_ERR, libjami::loadPlugin(), loadPlugins(), jami::PluginUtils::manifestPath(), jami::PluginUtils::parseManifestFile(), PLUGIN_ALREADY_INSTALLED, PLUGIN_OLD_VERSION, jami::PluginUtils::readPluginManifestFromArchive(), jami::Manager::saveConfig(), libjami::setPluginsEnabled(), SIGNATURE_VERIFICATION_FAILED, SUCCESS, jami::archiver::uncompressArchive(), jami::PluginUtils::uncompressJplFunction(), uninstallPlugin(), and jami::swarm_protocol::version.

Returns True if success.
| rootPath | of the plugin folder |
Definition at line 342 of file jamipluginmanager.cpp.
References jami::emitSignal(), getPluginDetails(), JAMI_ERR, JAMI_INFO, and jami::PluginManager::load().
Referenced by loadPlugins(), resetPluginPreferencesValuesMap(), and setPluginPreference().

| bool jami::JamiPluginManager::loadPlugins | ( | ) |
Returns True if success.
Definition at line 360 of file jamipluginmanager.cpp.
References jami::emitSignal(), jami::Manager::instance(), and loadPlugin().
Referenced by installPlugin().

| bool jami::JamiPluginManager::resetPluginPreferencesValuesMap | ( | const std::string & | rootPath, |
| const std::string & | accountId | ||
| ) |
Reset plugin's preferences values to their defaultValues.
| rootPath | |
| accountId |
Definition at line 486 of file jamipluginmanager.cpp.
References jami::PluginManager::checkLoadedPlugin(), jami::emitSignal(), loadPlugin(), jami::PreferenceServicesManager::resetPreferences(), jami::PluginPreferencesUtils::resetPreferencesValuesMap(), and unloadPlugin().

| bool jami::JamiPluginManager::setPluginPreference | ( | const std::filesystem::path & | rootPath, |
| const std::string & | accountId, | ||
| const std::string & | key, | ||
| const std::string & | value | ||
| ) |
Modifies a preference value by saving it to a preferences.msgpack.
Plugin is reloaded only if the preference cannot take effect immediately. In other words, if we have to reload plugin so that preference may take effect.
| rootPath | |
| accountId | |
| key | |
| value |
Definition at line 410 of file jamipluginmanager.cpp.
References jami::PluginManager::checkLoadedPlugin(), jami::emitSignal(), jami::PluginPreferencesUtils::getPreferences(), jami::PluginPreferencesUtils::getPreferencesValuesMap(), jami::PluginPreferencesUtils::getUserPreferencesValuesMap(), JAMI_ERR, loadPlugin(), jami::CallServicesManager::setPreference(), jami::ChatServicesManager::setPreference(), jami::PreferenceServicesManager::setPreference(), unloadPlugin(), and jami::PluginPreferencesUtils::valuesFilePath().

Checks if the plugin has a valid manifest and if the plugin is loaded, tries to unload it and then removes plugin folder.
| rootPath |
Definition at line 314 of file jamipluginmanager.cpp.
References jami::PluginManager::checkLoadedPlugin(), jami::PluginUtils::checkPluginValidity(), jami::emitSignal(), FAILURE, jami::fileutils::get_data_dir(), jami::Manager::getAccountList(), jami::Manager::instance(), JAMI_INFO, SUCCESS, and libjami::unloadPlugin().
Referenced by installPlugin().

Returns True if success.
| rootPath | of the plugin folder |
Definition at line 374 of file jamipluginmanager.cpp.
References jami::emitSignal(), getPluginDetails(), JAMI_ERR, JAMI_INFO, and jami::PluginManager::unload().
Referenced by resetPluginPreferencesValuesMap(), and setPluginPreference().
