Skip to content
Snippets Groups Projects
Commit eab08ce2 authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

plugins: don't activate if enablePlugins preference is disabled

GitLab: #497
Change-Id: I100a9f5813d0a310298bb381a994073966dc010e
parent 63a6429a
Branches
No related tags found
No related merge requests found
......@@ -83,7 +83,7 @@ getInstalledPlugins()
std::vector<std::string>
getLoadedPlugins()
{
return jami::Manager::instance().getJamiPluginManager().getLoadedPlugins();
return jami::Manager::instance().pluginPreferences.getLoadedPlugins();
}
int
......@@ -186,6 +186,12 @@ void
setPluginsEnabled(bool state)
{
jami::Manager::instance().pluginPreferences.setPluginsEnabled(state);
for (auto& item : jami::Manager::instance().pluginPreferences.getLoadedPlugins()) {
if (state)
jami::Manager::instance().getJamiPluginManager().loadPlugin(item);
else
jami::Manager::instance().getJamiPluginManager().unloadPlugin(item);
}
jami::Manager::instance().saveConfig();
}
} // namespace DRing
......@@ -2918,10 +2918,12 @@ Manager::loadAccountMap(const YAML::Node& node)
#ifdef ENABLE_PLUGIN
pluginPreferences.unserialize(node);
if (pluginPreferences.getPluginsEnabled()) {
std::vector<std::string> loadedPlugins = pluginPreferences.getLoadedPlugins();
for (const std::string& plugin : loadedPlugins) {
jami::Manager::instance().getJamiPluginManager().loadPlugin(plugin);
}
}
#endif
} catch (const YAML::Exception& e) {
JAMI_ERR("%s: Preferences node unserialize error: ", e.what());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment