Skip to content
Snippets Groups Projects
Commit 03ed9910 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Adrien Béraud
Browse files

plugin: libarchive and plugins as default for linux

fix preferences set in first plugin loading
small logic changes in libraries loading
related to: https://review.jami.net/c/ring-project/+/14433

Change-Id: I4730f279ee38d337e3ef94dd9562a5dfc1a63c32
parent b7d4ab38
Branches
No related tags found
No related merge requests found
Showing with 242 additions and 64 deletions
......@@ -24,6 +24,7 @@ source_group("Source Files\\media" FILES ${Source_Files__media})
source_group("Source Files\\media\\audio" FILES ${Source_Files__media__audio})
source_group("Source Files\\media\\audio\\sound" FILES ${Source_Files__media__audio__sound})
source_group("Source Files\\media\\video" FILES ${Source_Files__media__video})
source_group("Source Files\\plugin" FILES ${Source_Files__plugin})
if(MSVC)
if(WINDOWS_STORE)
......@@ -60,6 +61,7 @@ list (APPEND ALL_FILES
${Source_Files__upnp__protocol}
${Source_Files__upnp__protocol__natpmp}
${Source_Files__upnp__protocol__pupnp}
${Source_Files__plugin}
)
if(MSVC)
......
......@@ -29,10 +29,12 @@ dbusconfigurationmanager.adaptor.h: cx.ring.Ring.ConfigurationManager.xml Makefi
dbusinstance.adaptor.h: cx.ring.Ring.Instance.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
if ENABLE_PLUGIN
BUILT_SOURCES+=dbuspluginmanagerinterface.adaptor.h
# Rule to generate the binding headers
dbuspluginmanagerinterface.adaptor.h: cx.ring.Ring.PluginManagerInterface.xml Makefile.am
dbusxx-xml2cpp $< --adaptor=$@
endif
libclient_dbus_la_SOURCES = \
dbuscallmanager.cpp \
......@@ -46,10 +48,12 @@ libclient_dbus_la_SOURCES = \
dbus_cpp.h \
dbuspresencemanager.cpp \
dbuspresencemanager.h \
dbuspluginmanagerinterface.cpp \
dbuspluginmanagerinterface.h \
$(BUILT_SOURCES)
if ENABLE_PLUGIN
libclient_dbus_la_SOURCES += dbuspluginmanagerinterface.cpp dbuspluginmanagerinterface.h
endif
if ENABLE_VIDEO
libclient_dbus_la_SOURCES += dbusvideomanager.cpp dbusvideomanager.h
endif
......@@ -71,8 +75,11 @@ interfacedir = $(datadir)/dbus-1/interfaces
interface_DATA = cx.ring.Ring.CallManager.xml \
cx.ring.Ring.ConfigurationManager.xml \
cx.ring.Ring.Instance.xml \
cx.ring.Ring.PresenceManager.xml \
cx.ring.Ring.PluginManagerInterface.xml
cx.ring.Ring.PresenceManager.xml
if ENABLE_PLUGIN
interface_DATA += cx.ring.Ring.PluginManagerInterface.xml
endif
if ENABLE_VIDEO
interface_DATA += cx.ring.Ring.VideoManager.xml
......
......@@ -38,8 +38,10 @@
#include "dbuspresencemanager.h"
#include "presencemanager_interface.h"
#ifdef ENABLE_PLUGIN
#include "dbuspluginmanagerinterface.h"
#include "plugin_manager_interface.h"
#endif // ENABLE_PLUGIN
#include "datatransfer_interface.h"
......@@ -87,8 +89,9 @@ DBusClient::DBusClient(int flags, bool persistent)
callManager_.reset(new DBusCallManager {sessionConnection});
configurationManager_.reset(new DBusConfigurationManager {sessionConnection});
presenceManager_.reset(new DBusPresenceManager {sessionConnection});
#ifdef ENABLE_PLUGIN
pluginManagerInterface_.reset(new DBusPluginManagerInterface{sessionConnection});
#endif
DBusInstance::OnNoMoreClientFunc onNoMoreClientFunc;
if (!persistent)
onNoMoreClientFunc = [this] {this->exit();};
......@@ -120,7 +123,9 @@ DBusClient::~DBusClient()
presenceManager_.reset();
configurationManager_.reset();
callManager_.reset();
#ifdef ENABLE_PLUGIN
pluginManagerInterface_.reset();
#endif
}
int
......@@ -141,8 +146,10 @@ DBusClient::initLibrary(int flags)
auto callM = callManager_.get();
auto confM = configurationManager_.get();
auto presM = presenceManager_.get();
auto plugM = pluginManagerInterface_.get();
#ifdef ENABLE_PLUGIN
auto plugM = pluginManagerInterface_.get();
#endif
#ifdef ENABLE_VIDEO
using DRing::VideoSignal;
auto videoM = videoManager_.get();
......
......@@ -33,7 +33,10 @@ class DBusCallManager;
class DBusNetworkManager;
class DBusInstance;
class DBusPresenceManager;
#ifdef ENABLE_PLUGIN
class DBusPluginManagerInterface;
#endif
#ifdef ENABLE_VIDEO
class DBusVideoManager;
......@@ -63,7 +66,10 @@ class DRING_PUBLIC DBusClient {
std::unique_ptr<DBusConfigurationManager> configurationManager_;
std::unique_ptr<DBusPresenceManager> presenceManager_;
std::unique_ptr<DBusInstance> instanceManager_;
#ifdef ENABLE_PLUGIN
std::unique_ptr<DBusPluginManagerInterface> pluginManagerInterface_;
#endif
#ifdef ENABLE_VIDEO
std::unique_ptr<DBusVideoManager> videoManager_;
......
......@@ -45,6 +45,9 @@ print_title()
<< "https://jami.net/" << std::endl
#ifdef ENABLE_VIDEO
<< "[Video support enabled]" << std::endl
#endif
#ifdef ENABLE_PLUGIN
<< "[Plugins support enabled]" << std::endl
#endif
<< std::endl;
}
......
......@@ -60,6 +60,9 @@ print_title()
<< "https://jami.net/" << std::endl
#ifdef ENABLE_VIDEO
<< "[Video support enabled]" << std::endl
#endif
#ifdef ENABLE_PLUGIN
<< "[Plugins support enabled]" << std::endl
#endif
<< std::endl;
}
......
......@@ -47,6 +47,9 @@ print_title()
<< "https://jami.net/" << std::endl
#ifdef ENABLE_VIDEO
<< "[Video support enabled]" << std::endl
#endif
#ifdef ENABLE_PLUGIN
<< "[Plugins support enabled]" << std::endl
#endif
<< std::endl;
}
......
......@@ -51,6 +51,9 @@ print_title()
<< "https://jami.net/" << std::endl
#ifdef ENABLE_VIDEO
<< "[Video support enabled]" << std::endl
#endif
#ifdef ENABLE_PLUGIN
<< "[Plugins support enabled]" << std::endl
#endif
<< std::endl;
}
......
......@@ -170,6 +170,9 @@ your system. */
/* Video support enabled */
#define ENABLE_VIDEO /**/
/* Jami Plugin support enabled */
#define ENABLE_PLUGIN /**/
/* Name directory service support enabled */
#define HAVE_RINGNS 1
......
......@@ -302,7 +302,6 @@ PKG_CHECK_MODULES(PJPROJECT, libpjproject,, AC_MSG_ERROR([Missing pjproject file
PKG_CHECK_MODULES([YAMLCPP], [yaml-cpp >= 0.5.1],, AC_MSG_ERROR([yaml-cpp not found]))
PKG_CHECK_MODULES([JSONCPP], [jsoncpp >= 1.6.5],, AC_MSG_ERROR([jsoncpp not found]))
PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.0],, AC_MSG_ERROR([libarchive not found]))
if test "${HAVE_ANDROID}" = "1"; then
dnl Check for OpenSL
......@@ -460,6 +459,21 @@ PKG_CHECK_MODULES(LIBSWSCALE, libswscale >= 3.1.101,, AC_MSG_ERROR([Missing libs
PKG_CHECK_MODULES(LIBSWRESAMPLE, libswresample >= 1.2.101,, AC_MSG_ERROR([Missing libswresample development files]))
dnl Jami Plugin is default-enabled
AC_ARG_ENABLE([plugin], AS_HELP_STRING([--disable-plugin], [Disable plugin]))
AS_IF([test "x$enable_plugin" != "xno"],
[
AC_DEFINE(ENABLE_PLUGIN, [], [Jami Plugin support enabled])
AM_CONDITIONAL(ENABLE_PLUGIN, true)
AS_IF([test "$SYS" = linux],[
PKG_CHECK_MODULES([ARCHIVE], [libarchive >= 3.0],, AC_MSG_ERROR([libarchive not found]))
],[
])
],
[
AM_CONDITIONAL(ENABLE_PLUGIN, false)
]);
dnl Video is default-enabled
AC_ARG_ENABLE([video], AS_HELP_STRING([--disable-video], [Disable video]))
......@@ -616,6 +630,7 @@ AC_CONFIG_FILES([Makefile \
src/media/video/osxvideo/Makefile \
src/media/video/iosvideo/Makefile \
src/media/video/winvideo/Makefile \
src/plugin/Makefile \
src/security/Makefile \
src/upnp/Makefile \
src/upnp/protocol/Makefile \
......
......@@ -15,7 +15,7 @@ OPENCV_CMAKECONF := \
-DBUILD_TIFF=OFF \
-DBUILD_JASPER=OFF \
-DBUILD_JPEG=OFF \
-DBUILD_PNG=OFF \
-DBUILD_PNG=ON \
-DBUILD_OPENEXR=OFF \
-DBUILD_WEBP=OFF \
-DBUILD_TBB=OFF \
......
include ../globals.mk
ENABLE_PLUGIN_LIBS=
if ENABLE_PLUGIN
ENABLE_PLUGIN_LIBS+=./plugin/libplugin.la
endif
ENABLE_VIDEO_LIBS=
if ENABLE_VIDEO
......@@ -29,6 +35,10 @@ endif
SUBDIRS = client media config hooks sip upnp security jamidht im $(ENABLE_VIDEO_SUBDIR)
if ENABLE_PLUGIN
SUBDIRS+=plugin
endif
# libring
lib_LTLIBRARIES = libring.la
......@@ -43,6 +53,7 @@ libring_la_LIBADD = \
./upnp/libupnpcontrol.la \
./jamidht/libringacc.la \
./im/libim.la \
$(ENABLE_PLUGIN_LIBS) \
$(ENABLE_VIDEO_LIBS)
libring_la_LDFLAGS = \
......@@ -57,7 +68,6 @@ libring_la_LDFLAGS = \
@GNUTLS_LIBS@ \
@OPENDHT_LIBS@ \
@SECP256K1_LIBS@ \
@ARCHIVE_LIBS@ \
@ZLIB_LIBS@ \
@LIBSSL_LIBS@ \
@LIBCRYPTO_LIBS@ \
......@@ -70,6 +80,12 @@ libring_la_LDFLAGS = \
@LIBAVUTIL_LIBS@ \
@LIBS@
if ENABLE_PLUGIN
libring_la_LDFLAGS+= \
@ARCHIVE_LIBS@
endif
if HAVE_WIN32
libring_la_LDFLAGS += -no-undefined -avoid-version
endif
......@@ -161,15 +177,7 @@ libring_la_SOURCES = \
generic_io.h \
scheduled_executor.h \
scheduled_executor.cpp \
transport/peer_channel.h \
plugin/pluginloader.h \
plugin/pluginloaderdl.cpp \
plugin/pluginmanager.h \
plugin/pluginmanager.cpp \
plugin/mediahandler.h \
plugin/callservicemanager.h \
plugin/jamipluginmanager.h \
plugin/jamipluginmanager.cpp
transport/peer_channel.h
if HAVE_WIN32
libring_la_SOURCES += \
......@@ -181,7 +189,6 @@ nobase_include_HEADERS= dring/dring.h \
dring/security_const.h \
dring/callmanager_interface.h \
dring/configurationmanager_interface.h \
dring/plugin_manager_interface.h \
dring/presencemanager_interface.h \
dring/datatransfer_interface.h \
dring/account_const.h \
......@@ -190,6 +197,10 @@ nobase_include_HEADERS= dring/dring.h \
dring/media_const.h \
dring/def.h
if ENABLE_PLUGIN
nobase_include_HEADERS+= \
dring/plugin_manager_interface.h
endif
if ENABLE_VIDEO
nobase_include_HEADERS+= \
dring/videomanager_interface.h
......
......@@ -32,10 +32,12 @@
#include <json/json.h>
#include <zlib.h>
#ifdef ENABLE_PLUGIN
extern "C" {
#include <archive.h>
#include <archive_entry.h>
}
#endif
#include <sys/stat.h>
#include <fstream>
......@@ -309,6 +311,7 @@ openGzip(const std::string& path, const char *mode)
#endif
}
#ifdef ENABLE_PLUGIN
// LIBARCHIVE DEFINITIONS
//==========================
using ArchivePtr = std::unique_ptr<archive, void(*)(archive*)>;
......@@ -511,5 +514,6 @@ std::vector<uint8_t> readFileFromArchive(const std::string &archivePath,
}
throw std::runtime_error("File " + fileRelativePathName + " not found in the archive");
}
#endif //ENABLE_PLUGIN
}} // namespace jami::archiver
......@@ -27,6 +27,10 @@
#include <map>
#include <functional>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif // HAVE_CONFIG_H
typedef struct gzFile_s *gzFile;
namespace jami {
......@@ -84,6 +88,7 @@ std::vector<uint8_t> decompressGzip(const std::string& path);
*/
gzFile openGzip(const std::string& path, const char *mode);
#ifdef ENABLE_PLUGIN
/**
* @brief listArchiveContent
* @param archivePath
......@@ -115,6 +120,7 @@ void uncompressArchive(const std::string& path, const std::string &dir, const Fi
*/
std::vector<uint8_t> readFileFromArchive(const std::string &path,
const std::string &fileRelativePathName);
#endif //ENABLE_PLUGIN
}
} // namespace jami
......@@ -12,12 +12,16 @@ VIDEO_SRC = videomanager.cpp
noinst_HEADERS += videomanager.h
endif
if ENABLE_PLUGIN
PLUGIN_SRC = plugin_manager_interface.cpp
endif
libclient_la_SOURCES = \
ring_signal.cpp \
callmanager.cpp \
configurationmanager.cpp \
datatransfer.cpp \
plugin_manager_interface.cpp \
$(PLUGIN_SRC) \
$(PRESENCE_SRC) \
$(VIDEO_SRC)
......
......@@ -11,6 +11,7 @@
* Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
* Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
* Author: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -63,7 +64,10 @@ using random_device = dht::crypto::random_device;
#include "audio/sound/tonelist.h"
#include "audio/sound/dtmf.h"
#include "audio/ringbufferpool.h"
#ifdef ENABLE_PLUGIN
#include "plugin/jamipluginmanager.h"
#endif
#ifdef ENABLE_VIDEO
#include "client/videomanager.h"
......@@ -416,8 +420,10 @@ struct Manager::ManagerPimpl
#endif
std::unique_ptr<SIPVoIPLink> sipLink_;
#ifdef ENABLE_PLUGIN
/* Jami Plugin Manager */
JamiPluginManager jami_plugin_manager;
#endif
};
Manager::ManagerPimpl::ManagerPimpl(Manager& base)
......@@ -2951,6 +2957,7 @@ Manager::sendTextMessage(const std::string& accountID, const std::string& to,
{
if (const auto acc = getAccount(accountID)) {
try {
#ifdef ENABLE_PLUGIN
auto& convManager = jami::Manager::instance().getJamiPluginManager()
.getConversationServicesManager();
std::shared_ptr<jami::ConversationMessage> cm =
......@@ -2959,6 +2966,9 @@ Manager::sendTextMessage(const std::string& accountID, const std::string& to,
std::string>&>(payloads));
convManager.sendTextMessage(cm);
return acc->sendTextMessage(cm->to_, cm->data_);
#else
return acc->sendTextMessage(to, payloads);
#endif //ENABLE_PLUGIN
} catch (const std::exception& e) {
JAMI_ERR("Exception during text message sending: %s", e.what());
}
......@@ -3108,11 +3118,13 @@ Manager::sipVoIPLink() const
return *pimpl_->sipLink_;
}
#ifdef ENABLE_PLUGIN
JamiPluginManager&
Manager::getJamiPluginManager() const
{
return pimpl_->jami_plugin_manager;
}
#endif
std::map<std::string, std::string>
Manager::getNearbyPeers(const std::string& accountID)
......
......@@ -905,7 +905,9 @@ class DRING_TESTABLE Manager {
std::vector<DRing::Message> getLastMessages(const std::string& accountID, const uint64_t& base_timestamp);
SIPVoIPLink& sipVoIPLink() const;
#ifdef ENABLE_PLUGIN
JamiPluginManager& getJamiPluginManager() const;
#endif
private:
Manager();
......
################################################################################
# Source groups - plugin
################################################################################
list (APPEND Source_Files__plugin
"${CMAKE_CURRENT_SOURCE_DIR}/jamipluginmanager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/pluginloaderdl.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/pluginmanager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/callservicesmanager.h"
"${CMAKE_CURRENT_SOURCE_DIR}/conversationservicesmanager.h"
"${CMAKE_CURRENT_SOURCE_DIR}/conversationhandler.h"
"${CMAKE_CURRENT_SOURCE_DIR}/jamiplugin.h"
"${CMAKE_CURRENT_SOURCE_DIR}/jamipluginmanager.h"
"${CMAKE_CURRENT_SOURCE_DIR}/mediahandler.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pluginloader.h"
"${CMAKE_CURRENT_SOURCE_DIR}/pluginmanager.h"
"${CMAKE_CURRENT_SOURCE_DIR}/streamdata.h"
)
set (Source_Files__client ${Source_Files__client} PARENT_SCOPE)
\ No newline at end of file
include $(top_srcdir)/globals.mk
noinst_LTLIBRARIES = libplugin.la
noinst_HEADERS = \
callservicesmanager.h \
conversationhandler.h \
conversationservicesmanager.h \
jamiplugin.h \
jamipluginmanager.h \
mediahandler.h \
pluginloader.h \
pluginmanager.h \
streamdata.h
libplugin_la_SOURCES = \
jamipluginmanager.cpp \
pluginloaderdl.cpp \
pluginmanager.cpp
libplugin_la_LIBADD = @ARCHIVE_LIBS@
libplugin_la_CXXFLAGS = \
-I./ \
-I../ \
-DPREFIX=\"$(prefix)\" \
-DPROGSHAREDIR=\"${datadir}/ring\"
......@@ -168,11 +168,15 @@ std::map<std::string, std::string> JamiPluginManager::getPluginDetails(const std
}
std::map<std::string, std::string> details = parseManifestFile(manifestPath(rootPath));
if (!details.empty())
{
details["iconPath"] = rootPath + DIR_SEPARATOR_CH + "data" + DIR_SEPARATOR_CH + "icon.png";
details["soPath"] = rootPath + DIR_SEPARATOR_CH + "lib" + details["name"] + ".so";
detailsIt = pluginDetailsMap_.emplace(rootPath, std::move(details)).first;
return detailsIt->second;
}
return {};
}
std::vector<std::string> JamiPluginManager::listAvailablePlugins()
{
......@@ -233,13 +237,27 @@ int JamiPluginManager::installPlugin(const std::string &jplPath, bool force)
int JamiPluginManager::uninstallPlugin(const std::string &rootPath)
{
if(checkPluginValidity(rootPath)) {
if (checkPluginValidity(rootPath))
{
auto detailsIt = pluginDetailsMap_.find(rootPath);
if (detailsIt != pluginDetailsMap_.end()) {
if (detailsIt != pluginDetailsMap_.end())
{
bool loaded = pm_.checkLoadedPlugin(detailsIt->second.at("soPath"));
if (loaded)
{
JAMI_INFO() << "PLUGIN: unloading before uninstall.";
bool status = unloadPlugin(rootPath);
if (!status)
{
JAMI_INFO() << "PLUGIN: could not unload, not performing uninstall.";
return -1;
}
}
pluginDetailsMap_.erase(detailsIt);
}
return fileutils::removeAll(rootPath);
} else {
JAMI_INFO() << "PLUGIN: not installed.";
return -1;
}
}
......@@ -249,7 +267,7 @@ bool JamiPluginManager::loadPlugin(const std::string &rootPath)
try
{
bool status = pm_.load(getPluginDetails(rootPath).at("soPath"));
JAMI_INFO() << "plugin status: " << status;
JAMI_INFO() << "PLUGIN: load status - " << status;
return status;
......@@ -265,7 +283,7 @@ bool JamiPluginManager::unloadPlugin(const std::string &rootPath)
try
{
bool status = pm_.unload(getPluginDetails(rootPath).at("soPath"));
JAMI_INFO() << "plugin unload status: " << status;
JAMI_INFO() << "PLUGIN: unload status - " << status;
return status;
} catch(const std::exception& e)
......@@ -277,7 +295,8 @@ bool JamiPluginManager::unloadPlugin(const std::string &rootPath)
void JamiPluginManager::togglePlugin(const std::string &rootPath, bool toggle)
{
try {
try
{
std::string soPath = getPluginDetails(rootPath).at("soPath");
// remove the previous plugin object if it was registered
pm_.destroyPluginComponents(soPath);
......@@ -341,36 +360,12 @@ std::vector<std::map<std::string, std::string> > JamiPluginManager::getPluginPre
return preferences;
}
bool JamiPluginManager::setPluginPreference(const std::string &rootPath, const std::string &key, const std::string &value)
{
bool returnValue = true;
std::map<std::string, std::string> pluginPreferencesMap = getPluginPreferencesValuesMap(rootPath);
// Using [] instead of insert to get insert or update effect
pluginPreferencesMap[key] = value;
{
const std::string preferencesValuesFilePath = pluginPreferencesValuesFilePath(rootPath);
std::ofstream fs(preferencesValuesFilePath, std::ios::binary);
if(!fs.good()) {
return false;
}
try {
std::lock_guard<std::mutex> guard(fileutils::getFileLock(preferencesValuesFilePath));
msgpack::pack(fs, pluginPreferencesMap);
} catch (const std::exception& e) {
returnValue = false;
JAMI_ERR() << e.what();
}
}
return returnValue;
}
std::map<std::string, std::string> JamiPluginManager::getPluginPreferencesValuesMap(const std::string &rootPath)
std::map<std::string, std::string> JamiPluginManager::getPluginUserPreferencesValuesMap(const std::string &rootPath)
{
const std::string preferencesValuesFilePath = pluginPreferencesValuesFilePath(rootPath);
std::ifstream file(preferencesValuesFilePath, std::ios::binary);
std::map<std::string, std::string> rmap;
// If file is accessible
if(file.good()) {
std::lock_guard<std::mutex> guard(fileutils::getFileLock(preferencesValuesFilePath));
......@@ -396,7 +391,54 @@ std::map<std::string, std::string> JamiPluginManager::getPluginPreferencesValues
}
}
}
return rmap;
}
bool JamiPluginManager::setPluginPreference(const std::string &rootPath, const std::string &key, const std::string &value)
{
bool returnValue = false;
std::map<std::string, std::string> pluginUserPreferencesMap = getPluginUserPreferencesValuesMap(rootPath);
std::map<std::string, std::string> pluginPreferencesMap = getPluginPreferencesValuesMap(rootPath);
auto find = pluginPreferencesMap.find(key);
if (find != pluginPreferencesMap.end())
{
pluginUserPreferencesMap[key] = value;
const std::string preferencesValuesFilePath = pluginPreferencesValuesFilePath(rootPath);
std::ofstream fs(preferencesValuesFilePath, std::ios::binary);
if(!fs.good()) {
return false;
}
try {
std::lock_guard<std::mutex> guard(fileutils::getFileLock(preferencesValuesFilePath));
msgpack::pack(fs, pluginUserPreferencesMap);
returnValue = true;
} catch (const std::exception& e) {
returnValue = false;
JAMI_ERR() << e.what();
}
}
return returnValue;
}
std::map<std::string, std::string> JamiPluginManager::getPluginPreferencesValuesMap(const std::string &rootPath)
{
std::map<std::string, std::string> rmap;
std::vector<std::map<std::string,std::string>> preferences = getPluginPreferences(rootPath);
for (int i = 0; i < preferences.size(); i++)
{
rmap[preferences[i]["key"]]=preferences[i]["defaultValue"];
}
std::map<std::string, std::string> pluginUserPreferencesMap = getPluginUserPreferencesValuesMap(rootPath);
for (const auto& pair : pluginUserPreferencesMap)
{
rmap[pair.first]=pair.second;
}
return rmap;
}
......@@ -405,7 +447,6 @@ bool JamiPluginManager::resetPluginPreferencesValuesMap(const std::string &rootP
bool returnValue = true;
std::map<std::string, std::string> pluginPreferencesMap{};
{
const std::string preferencesValuesFilePath = pluginPreferencesValuesFilePath(rootPath);
std::ofstream fs(preferencesValuesFilePath, std::ios::binary);
if(!fs.good()) {
......@@ -418,7 +459,6 @@ bool JamiPluginManager::resetPluginPreferencesValuesMap(const std::string &rootP
returnValue = false;
JAMI_ERR() << e.what();
}
}
return returnValue;
}
......@@ -430,6 +470,7 @@ std::map<std::string, std::string> JamiPluginManager::readPluginManifestFromArch
} catch (const std::exception& e) {
JAMI_ERR() << e.what();
}
return {};
}
std::map<std::string, std::string> JamiPluginManager::parseManifestFile(const std::string &manifestFilePath)
......@@ -442,7 +483,6 @@ std::map<std::string, std::string> JamiPluginManager::parseManifestFile(const st
JAMI_ERR() << e.what();
}
}
return {};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment