Skip to content
Snippets Groups Projects
Commit 139eaa24 authored by Xavier Jouslin de Noray's avatar Xavier Jouslin de Noray Committed by Andreas Traczyk
Browse files

Platform: api to fetch platform information

Change-Id: Ie1037a90024e210b75f07c1e19016bc13420491e
parent 5801ed29
Branches
No related tags found
No related merge requests found
......@@ -107,6 +107,12 @@
</arg>
</method>
<method name="getPlatformInfo" tp:name-for-bindings="getPlatformInfo">
<tp:added version="9.2.0"/>
<arg type="a{ss}" name="info" direction="out" tp:type="String_String_Map">
</arg>
</method>
<method name="getCallMediaHandlers" tp:name-for-bindings="getCallMediaHandlers">
<tp:added version="9.9.0"/>
<arg type="as" name="getCallMediaHandlers" direction="out">
......
......@@ -87,6 +87,12 @@ public:
return libjami::resetPluginPreferencesValues(path, accountId);
}
std::map<std::string, std::string>
getPlatformInfo()
{
return libjami::getPlatformInfo();
}
auto
getInstalledPlugins() -> decltype(libjami::getInstalledPlugins())
{
......
......@@ -27,6 +27,7 @@ namespace libjami {
bool loadPlugin(const std::string& path);
bool unloadPlugin(const std::string& path);
std::map<std::string,std::string> getPluginDetails(const std::string& path);
std::map<std::string, std::string> getPlatformInfo();
std::vector<std::map<std::string,std::string>> getPluginPreferences(const std::string& path, const std::string& accountId);
bool setPluginPreference(const std::string& path, const std::string& accountId, const std::string& key, const std::string& value);
std::map<std::string,std::string> getPluginPreferencesValues(const std::string& path, const std::string& accountId);
......
......@@ -147,6 +147,14 @@ uninstallPlugin(const std::string& pluginRootPath)
return -1;
}
std::map<std::string, std::string>
getPlatformInfo() {
#ifdef ENABLE_PLUGIN
return jami::Manager::instance().getJamiPluginManager().getPlatformInfo();
#endif
return {};
}
std::vector<std::string>
getCallMediaHandlers()
{
......
......@@ -49,6 +49,7 @@ LIBJAMI_PUBLIC bool resetPluginPreferencesValues(const std::string& path,
const std::string& accountId);
LIBJAMI_PUBLIC std::vector<std::string> getInstalledPlugins();
LIBJAMI_PUBLIC std::vector<std::string> getLoadedPlugins();
LIBJAMI_PUBLIC std::map<std::string, std::string> getPlatformInfo();
LIBJAMI_PUBLIC int installPlugin(const std::string& jplPath, bool force);
LIBJAMI_PUBLIC int uninstallPlugin(const std::string& pluginRootPath);
LIBJAMI_PUBLIC std::vector<std::string> getCallMediaHandlers();
......
......@@ -22,17 +22,16 @@
#include "pluginsutils.h"
#include "fileutils.h"
#include "archiver.h"
#include "logger.h"
#include <fstream>
#include <stdexcept>
#include <msgpack.hpp>
#include "manager.h"
#include "preferences.h"
#include "jami/plugin_manager_interface.h"
#include "store_ca_crt.cpp"
#include <fstream>
#include <stdexcept>
#include <msgpack.hpp>
#define SUCCESS 0
#define PLUGIN_ALREADY_INSTALLED 100 /* Plugin already installed with the same version */
#define PLUGIN_OLD_VERSION 200 /* Plugin already installed with a newer version */
......@@ -126,6 +125,12 @@ JamiPluginManager::checkPluginCertificateValidity(dht::crypto::Certificate* cert
return cert && *cert && trust_.verify(*cert);
}
std::map<std::string, std::string>
JamiPluginManager::getPlatformInfo()
{
return PluginUtils::getPlatformInfo();
}
bool
JamiPluginManager::checkPluginSignatureFile(const std::string& jplPath)
{
......
......@@ -168,6 +168,11 @@ public:
std::map<std::string, std::string> getPluginPreferencesValuesMap(const std::string& rootPath,
const std::string& accountId);
/**
* @brief Returns a Map of platform system.
*/
std::map<std::string, std::string> getPlatformInfo();
/**
* @brief Modifies a preference value by saving it to a preferences.msgpack.
* Plugin is reloaded only if the preference cannot take effect immediately.
......
......@@ -75,6 +75,14 @@ manifestPath(const std::string& rootPath)
return rootPath + DIR_SEPARATOR_CH + "manifest.json";
}
std::map<std::string, std::string>
getPlatformInfo()
{
std::map<std::string, std::string> platformInfo = {};
platformInfo["os"] = ABI;
return platformInfo;
}
std::string
getRootPathFromSoPath(const std::string& soPath)
{
......
......@@ -76,6 +76,12 @@ std::map<std::string, std::string> checkManifestValidity(std::istream& stream);
*/
std::map<std::string, std::string> checkManifestValidity(const std::vector<uint8_t>& vec);
/**
* @brief Returns a map with platform information.
* @return Map with platform information
*/
std::map<std::string, std::string> getPlatformInfo();
/**
* @brief Parses the manifest file of an installed plugin if it's valid.
* @param manifestFilePath
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment