Ring Daemon 16.0.0
|
Static class that gathers functions to manage plugins' preferences. More...
#include <pluginpreferencesutils.h>
Static Public Member Functions | |
static void | addAlwaysHandlerPreference (const std::string &handlerName, const std::string &rootPath) |
Creates a "always" preference for a handler if this preference doesn't exist yet. | |
static std::string | convertArrayToString (const Json::Value &jsonArray) |
Returns a colon separated string with values from a json::Value containing an array. | |
static void | getAllowDenyListPreferences (ChatHandlerList &list) |
Reads ChantHandlers status from allowdeny.msgpack file. | |
static std::filesystem::path | getAllowDenyListsPath () |
Returns the path to allowdeny.msgpack file. | |
static bool | getAlwaysPreference (const std::string &rootPath, const std::string &handlerName, const std::string &accountId) |
Read plugin's preferences and returns wheter a specific handler "always" preference is True or False. | |
static std::vector< std::map< std::string, std::string > > | getPreferences (const std::filesystem::path &rootPath, const std::string &accountId="") |
Reads a preference.json file from the plugin installed in rootPath. | |
static std::filesystem::path | getPreferencesConfigFilePath (const std::filesystem::path &rootPath, const std::string &accountId="") |
Given a plugin installation path, returns the path to the preference.json of this plugin. | |
static std::map< std::string, std::string > | getPreferencesValuesMap (const std::filesystem::path &rootPath, const std::string &accountId="") |
Reads preferences values. | |
static std::map< std::string, std::string > | getUserPreferencesValuesMap (const std::filesystem::path &rootPath, const std::string &accountId="") |
Reads preferences values which were modified from defaultValue. | |
static std::map< std::string, std::string > | parsePreferenceConfig (const Json::Value &jsonPreference) |
Parses a single preference from json::Value to a Map<string, string>. | |
static bool | resetPreferencesValuesMap (const std::string &rootPath, const std::string &accountId) |
Resets all preferences values to their defaultValues by erasing all data saved in preferences.msgpack. | |
static void | setAllowDenyListPreferences (const ChatHandlerList &list) |
Saves ChantHandlers status provided by list. | |
static std::filesystem::path | valuesFilePath (const std::filesystem::path &rootPath, const std::string &accountId="") |
Given a plugin installation path, returns the path to the preference.msgpack file. | |
Static class that gathers functions to manage plugins' preferences.
Definition at line 33 of file pluginpreferencesutils.h.
|
static |
Creates a "always" preference for a handler if this preference doesn't exist yet.
A "always" preference tells the Plugin System if in the event of a new call or chat message, the handler is suposed to be automatically activated.
handlerName | |
rootPath |
Definition at line 301 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), and getPreferencesConfigFilePath().
|
static |
Returns a colon separated string with values from a json::Value containing an array.
jsonArray |
Definition at line 59 of file pluginpreferencesutils.cpp.
References convertArrayToString(), and jami::emitSignal().
Referenced by convertArrayToString(), and parsePreferenceConfig().
|
static |
Reads ChantHandlers status from allowdeny.msgpack file.
[out] | list |
Definition at line 268 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), getAllowDenyListsPath(), and JAMI_ERR.
Referenced by jami::ChatServicesManager::ChatServicesManager().
|
static |
Returns the path to allowdeny.msgpack file.
The allowdeny.msgpack file persists ChatHandlers status for each conversation this handler was previously (de)activated.
Definition at line 53 of file pluginpreferencesutils.cpp.
References jami::fileutils::get_data_dir().
Referenced by getAllowDenyListPreferences(), and setAllowDenyListPreferences().
|
static |
Read plugin's preferences and returns wheter a specific handler "always" preference is True or False.
rootPath | |
handlerName | |
accountId |
Definition at line 362 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), getPreferences(), and getPreferencesValuesMap().
Referenced by jami::CallServicesManager::createAVSubject(), and jami::ChatServicesManager::publishMessage().
|
static |
Reads a preference.json file from the plugin installed in rootPath.
rootPath | |
accountId |
Definition at line 99 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), jami::PluginUtils::getLanguage(), jami::PluginUtils::getLocales(), getPreferencesConfigFilePath(), JAMI_ERR, parsePreferenceConfig(), jami::string_remove_suffix(), and jami::string_replace().
Referenced by getAlwaysPreference(), jami::JamiPluginManager::getPluginPreferences(), getPreferencesValuesMap(), and jami::JamiPluginManager::setPluginPreference().
|
static |
Given a plugin installation path, returns the path to the preference.json of this plugin.
rootPath | |
accountId |
Definition at line 32 of file pluginpreferencesutils.cpp.
References jami::emitSignal().
Referenced by addAlwaysHandlerPreference(), and getPreferences().
|
static |
Reads preferences values.
rootPath | |
accountId |
Definition at line 198 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), getPreferences(), and getUserPreferencesValuesMap().
Referenced by getAlwaysPreference(), jami::JamiPluginManager::getPluginPreferencesValuesMap(), and jami::JamiPluginManager::setPluginPreference().
|
static |
Reads preferences values which were modified from defaultValue.
rootPath | |
accountId |
Definition at line 162 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), JAMI_ERR, and valuesFilePath().
Referenced by getPreferencesValuesMap(), and jami::JamiPluginManager::setPluginPreference().
|
static |
Parses a single preference from json::Value to a Map<string, string>.
jsonPreference |
Definition at line 82 of file pluginpreferencesutils.cpp.
References convertArrayToString(), and jami::emitSignal().
Referenced by getPreferences().
|
static |
Resets all preferences values to their defaultValues by erasing all data saved in preferences.msgpack.
rootPath | |
accountId |
Definition at line 229 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), JAMI_ERR, and valuesFilePath().
Referenced by jami::JamiPluginManager::resetPluginPreferencesValuesMap().
|
static |
Saves ChantHandlers status provided by list.
[in] | list |
Definition at line 252 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), getAllowDenyListsPath(), and JAMI_ERR.
Referenced by jami::ChatServicesManager::publishMessage().
|
static |
Given a plugin installation path, returns the path to the preference.msgpack file.
The preference.msgpack file saves the actuall preferences values if they were modified.
rootPath | |
accountId |
Definition at line 42 of file pluginpreferencesutils.cpp.
References jami::emitSignal(), and jami::fileutils::get_data_dir().
Referenced by getUserPreferencesValuesMap(), resetPreferencesValuesMap(), and jami::JamiPluginManager::setPluginPreference().