Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
0b7a9787
Commit
0b7a9787
authored
Jun 29, 2020
by
Aline Gondim Santos
Committed by
Adrien Béraud
Jul 07, 2020
Browse files
plugin: exposing plugins to linux ui
Change-Id: I0919a3a78f4066122773a2ee9ab85d8e406e7e8f
parent
248e21bf
Changes
16
Hide whitespace changes
Inline
Side-by-side
bin/dbus/cx.ring.Ring.PluginManagerInterface.xml
View file @
0b7a9787
...
...
@@ -4,7 +4,7 @@
<interface
name=
"cx.ring.Ring.PluginManagerInterface"
>
<!-- METHODS !-->
<method
name=
"loadPlugin"
tp:name-for-bindings=
"loadPlugin"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<arg
type=
"b"
name=
"loaded"
direction=
"out"
>
...
...
@@ -12,7 +12,7 @@
</method>
<method
name=
"unloadPlugin"
tp:name-for-bindings=
"unloadPlugin"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<arg
type=
"b"
name=
"unloaded"
direction=
"out"
>
...
...
@@ -20,7 +20,7 @@
</method>
<method
name=
"togglePlugin"
tp:name-for-bindings=
"togglePlugin"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<arg
type=
"b"
name=
"toggle"
direction=
"in"
>
...
...
@@ -28,7 +28,8 @@
</method>
<method
name=
"getPluginDetails"
tp:name-for-bindings=
"getPluginDetails"
>
<tp:added
version=
"0.0.0"
/>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
<tp:added
version=
"9.2.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
...
...
@@ -37,7 +38,8 @@
</method>
<method
name=
"getPluginPreferences"
tp:name-for-bindings=
"getPluginPreferences"
>
<tp:added
version=
"0.0.0"
/>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"VectorMapStringString"
/>
<tp:added
version=
"9.2.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"VectorMapStringString"
/>
...
...
@@ -46,7 +48,7 @@
</method>
<method
name=
"setPluginPreference"
tp:name-for-bindings=
"setPluginPreference"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<arg
type=
"s"
name=
"key"
direction=
"in"
>
...
...
@@ -58,7 +60,8 @@
</method>
<method
name=
"getPluginPreferencesValues"
tp:name-for-bindings=
"getPluginPreferencesValues"
>
<tp:added
version=
"0.0.0"
/>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
<tp:added
version=
"9.2.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
...
...
@@ -67,7 +70,7 @@
</method>
<method
name=
"resetPluginPreferencesValues"
tp:name-for-bindings=
"resetPluginPreferencesValues"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"path"
direction=
"in"
>
</arg>
<arg
type=
"b"
name=
"reset"
direction=
"out"
>
...
...
@@ -75,19 +78,19 @@
</method>
<method
name=
"listAvailablePlugins"
tp:name-for-bindings=
"listAvailablePlugins"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"as"
name=
"availablePlugins"
direction=
"out"
>
</arg>
</method>
<method
name=
"listLoadedPlugins"
tp:name-for-bindings=
"listLoadedPlugins"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"as"
name=
"LoadedPlugins"
direction=
"out"
>
</arg>
</method>
<method
name=
"installPlugin"
tp:name-for-bindings=
"installPlugin"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"jplPath"
direction=
"in"
>
</arg>
<arg
type=
"b"
name=
"force"
direction=
"in"
>
...
...
@@ -97,7 +100,7 @@
</method>
<method
name=
"uninstallPlugin"
tp:name-for-bindings=
"uninstallPlugin"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"pluginRootPath"
direction=
"in"
>
</arg>
<arg
type=
"i"
name=
"uninstaled"
direction=
"out"
>
...
...
@@ -105,13 +108,13 @@
</method>
<method
name=
"listCallMediaHandlers"
tp:name-for-bindings=
"listCallMediaHandlers"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"as"
name=
"listCallMediaHandlers"
direction=
"out"
>
</arg>
</method>
<method
name=
"toggleCallMediaHandler"
tp:name-for-bindings=
"toggleCallMediaHandler"
>
<tp:added
version=
"
0.0
.0"
/>
<tp:added
version=
"
9.2
.0"
/>
<arg
type=
"s"
name=
"id"
direction=
"in"
>
</arg>
<arg
type=
"b"
name=
"toggle"
direction=
"in"
>
...
...
@@ -119,11 +122,37 @@
</method>
<method
name=
"getCallMediaHandlerDetails"
tp:name-for-bindings=
"getCallMediaHandlerDetails"
>
<tp:added
version=
"0.0.0"
/>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
<tp:added
version=
"9.2.0"
/>
<arg
type=
"s"
name=
"id"
direction=
"in"
>
</arg>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
<arg
type=
"a{ss}"
name=
"CallMediaHandlerDetails"
direction=
"out"
>
</arg>
</method>
<method
name=
"getPluginsEnabled"
tp:name-for-bindings=
"getPluginsEnabled"
>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"Bool"
/>
<tp:added
version=
"9.3.0"
/>
<arg
type=
"b"
name=
"state"
direction=
"out"
>
<tp:docstring>
Returns true if plugins are enabled, false otherwise
</tp:docstring>
</arg>
</method>
<method
name=
"setPluginsEnabled"
tp:name-for-bindings=
"setPluginsEnabled"
>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.In0"
value=
"Bool"
/>
<tp:added
version=
"9.3.0"
/>
<arg
type=
"b"
name=
"state"
direction=
"in"
>
</arg>
</method>
<method
name=
"getCallMediaHandlerStatus"
tp:name-for-bindings=
"getCallMediaHandlerStatus"
>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
<tp:added
version=
"9.3.0"
/>
<annotation
name=
"org.qtproject.QtDBus.QtTypeName.Out0"
value=
"MapStringString"
/>
<arg
type=
"a{ss}"
name=
"getCallMediaHandlerStatus"
direction=
"out"
>
</arg>
</method>
</interface>
</node>
bin/dbus/dbuspluginmanagerinterface.cpp
View file @
0b7a9787
/*
* Copyright (C)
2004-
2020 Savoir-faire Linux Inc.
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
*
...
...
@@ -97,8 +97,8 @@ DBusPluginManagerInterface::uninstallPlugin(const std::string& pluginRootPath)
return
DRing
::
uninstallPlugin
(
pluginRootPath
);
}
std
::
vector
<
std
::
string
>
DBusPluginManagerInterface
::
listCallMediaHandlers
(
)
auto
DBusPluginManagerInterface
::
listCallMediaHandlers
(
)
->
decltype
(
DRing
::
listCallMediaHandlers
()
)
{
return
DRing
::
listCallMediaHandlers
();
}
...
...
@@ -114,3 +114,21 @@ DBusPluginManagerInterface::getCallMediaHandlerDetails(const std::string& id)
{
return
DRing
::
getCallMediaHandlerDetails
(
id
);
}
bool
DBusPluginManagerInterface
::
getPluginsEnabled
()
{
return
DRing
::
getPluginsEnabled
();
}
void
DBusPluginManagerInterface
::
setPluginsEnabled
(
const
bool
&
state
)
{
DRing
::
setPluginsEnabled
(
state
);
}
std
::
map
<
std
::
string
,
std
::
string
>
DBusPluginManagerInterface
::
getCallMediaHandlerStatus
()
{
return
DRing
::
getCallMediaHandlerStatus
();
}
bin/dbus/dbuspluginmanagerinterface.h
View file @
0b7a9787
/*
* Copyright (C)
2004-
2020 Savoir-faire Linux Inc.
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
*
...
...
@@ -67,4 +67,8 @@ class DRING_PUBLIC DBusPluginManagerInterface :
std
::
vector
<
std
::
string
>
listCallMediaHandlers
();
void
toggleCallMediaHandler
(
const
std
::
string
&
id
,
const
bool
&
toggle
);
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerDetails
(
const
std
::
string
&
id
);
bool
getPluginsEnabled
();
void
setPluginsEnabled
(
const
bool
&
state
);
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerStatus
();
};
bin/jni/plugin_manager_interface.i
View file @
0b7a9787
/*
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* Authors: 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
%
header
%
{
#
include
"dring/dring.h"
...
...
@@ -20,4 +39,7 @@ int uninstallPlugin(const std::string& pluginRootPath);
std
::
vector
<
std
::
string
>
listCallMediaHandlers
()
;
void
toggleCallMediaHandler
(
const
std
::
string&
id
,
bool
toggle
)
;
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerDetails
(
const
std
::
string&
id
)
;
bool
getPluginsEnabled
()
;
void
setPluginsEnabled
(
bool
state
)
;
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerStatus
()
;
}
configure.ac
View file @
0b7a9787
...
...
@@ -2,7 +2,7 @@ dnl Jami - configure.ac for automake 1.9 and autoconf 2.59
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT([Jami Daemon],[9.
2
.0],[ring@gnu.org],[jami])
AC_INIT([Jami Daemon],[9.
3
.0],[ring@gnu.org],[jami])
AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2019]])
AC_REVISION([$Revision$])
...
...
src/client/plugin_manager_interface.cpp
View file @
0b7a9787
/*
* Copyright (C) 2004-2020 Savoir-faire Linux Inc.
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* 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
...
...
@@ -92,4 +94,20 @@ namespace DRing
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerDetails
(
const
std
::
string
&
id
)
{
return
jami
::
Manager
::
instance
().
getJamiPluginManager
().
getCallServicesManager
().
getCallMediaHandlerDetails
(
id
);
}
bool
getPluginsEnabled
()
{
return
jami
::
Manager
::
instance
().
pluginPreferences
.
getPluginsEnabled
();
}
void
setPluginsEnabled
(
bool
state
)
{
jami
::
Manager
::
instance
().
pluginPreferences
.
setPluginsEnabled
(
state
);
jami
::
Manager
::
instance
().
saveConfig
();
}
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerStatus
()
{
return
jami
::
Manager
::
instance
().
getJamiPluginManager
().
getCallServicesManager
().
getCallMediaHandlerStatus
();
}
}
src/config/yamlparser.cpp
View file @
0b7a9787
/*
* Copyright (C) 2004-2020 Savoir-faire Linux Inc.
*
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
* Authors: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
* 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
...
...
@@ -47,4 +48,15 @@ parseVectorMap(const YAML::Node &node, const std::initializer_list<std::string>
return
result
;
}
std
::
set
<
std
::
string
>
parseVector
(
const
YAML
::
Node
&
node
)
{
std
::
set
<
std
::
string
>
result
;
for
(
const
auto
&
n
:
node
)
{
std
::
string
t
;
t
=
n
.
as
<
std
::
string
>
(
""
);
result
.
emplace
(
t
);
}
return
result
;
}
}}
// namespace jami::yaml_utils
src/config/yamlparser.h
View file @
0b7a9787
/*
* Copyright (C) 2004-2020 Savoir-faire Linux Inc.
*
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
* Authors: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
* 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
...
...
@@ -50,5 +51,6 @@ void parsePath(const YAML::Node &node, const char *key, std::string& path, const
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
parseVectorMap
(
const
YAML
::
Node
&
node
,
const
std
::
initializer_list
<
std
::
string
>
&
keys
);
std
::
set
<
std
::
string
>
parseVector
(
const
YAML
::
Node
&
node
);
}}
// namespace jami::yaml_utils
src/dring/plugin_manager_interface.h
View file @
0b7a9787
/*
* Copyright (C) 2004-2020 Savoir-faire Linux Inc.
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* 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
...
...
@@ -47,5 +49,7 @@ namespace DRing
DRING_PUBLIC
std
::
vector
<
std
::
string
>
listCallMediaHandlers
();
DRING_PUBLIC
void
toggleCallMediaHandler
(
const
std
::
string
&
id
,
bool
toggle
);
DRING_PUBLIC
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerDetails
(
const
std
::
string
&
id
);
DRING_PUBLIC
bool
getPluginsEnabled
();
DRING_PUBLIC
void
setPluginsEnabled
(
bool
state
);
DRING_PUBLIC
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerStatus
();
}
src/manager.cpp
View file @
0b7a9787
...
...
@@ -698,6 +698,9 @@ Manager::Manager()
,
shortcutPreferences
()
#ifdef ENABLE_VIDEO
,
videoPreferences
()
#endif
#ifdef ENABLE_PLUGIN
,
pluginPreferences
()
#endif
,
callFactory
()
,
accountFactory
()
...
...
@@ -1701,6 +1704,9 @@ Manager::saveConfig()
audioPreference
.
serialize
(
out
);
#ifdef ENABLE_VIDEO
videoPreferences
.
serialize
(
out
);
#endif
#ifdef ENABLE_PLUGIN
pluginPreferences
.
serialize
(
out
);
#endif
shortcutPreferences
.
serialize
(
out
);
...
...
@@ -2755,6 +2761,15 @@ Manager::loadAccountMap(const YAML::Node& node)
shortcutPreferences
.
unserialize
(
node
);
#ifdef ENABLE_VIDEO
videoPreferences
.
unserialize
(
node
);
#endif
#ifdef ENABLE_PLUGIN
pluginPreferences
.
unserialize
(
node
);
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
());
...
...
src/manager.h
View file @
0b7a9787
...
...
@@ -8,6 +8,7 @@
* Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
* Author: Guillaume Roguez <guillaume.roguez@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
...
...
@@ -99,6 +100,13 @@ class DRING_TESTABLE Manager {
*/
ShortcutPreferences
shortcutPreferences
;
#ifdef ENABLE_PLUGIN
/**
* Plugin preferences
*/
PluginPreferences
pluginPreferences
;
#endif
#ifdef ENABLE_VIDEO
/**
* Video preferences
...
...
src/plugin/callservicesmanager.h
View file @
0b7a9787
/*
* Copyright (C) 2004-2019 Savoir-faire Linux Inc.
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* 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
...
...
@@ -31,6 +33,12 @@ using MediaHandlerPtr = std::unique_ptr<MediaHandler>;
using
CallMediaHandlerPtr
=
std
::
unique_ptr
<
CallMediaHandler
>
;
using
AVSubjectSPtr
=
std
::
weak_ptr
<
Observable
<
AVFrame
*>>
;
struct
MediaHandlerToggled
{
std
::
string
name
=
""
;
std
::
string
state
=
"false"
;
};
class
CallServicesManager
{
public:
...
...
@@ -132,9 +140,13 @@ public:
if
(
pair
.
second
&&
getCallHandlerId
(
pair
.
second
)
==
id
)
{
pair
.
first
=
toggle
;
if
(
pair
.
first
)
{
mediaHandlerToggled_
.
name
=
id
;
mediaHandlerToggled_
.
state
=
"true"
;
listAvailableSubjects
(
pair
.
second
);
}
else
{
pair
.
second
->
detach
();
mediaHandlerToggled_
.
name
=
""
;
mediaHandlerToggled_
.
state
=
"false"
;
}
}
}
...
...
@@ -155,6 +167,11 @@ public:
return
{};
}
std
::
map
<
std
::
string
,
std
::
string
>
getCallMediaHandlerStatus
()
{
return
{
{
"name"
,
mediaHandlerToggled_
.
name
},
{
"state"
,
mediaHandlerToggled_
.
state
}};
}
private:
/**
...
...
@@ -213,6 +230,8 @@ private:
* It is pushed to this list list
*/
std
::
list
<
std
::
pair
<
const
StreamData
,
AVSubjectSPtr
>>
callAVsubjects
;
MediaHandlerToggled
mediaHandlerToggled_
;
};
}
src/plugin/jamipluginmanager.cpp
View file @
0b7a9787
...
...
@@ -26,6 +26,7 @@
//Manager
#include
"manager.h"
#include
"preferences.h"
extern
"C"
{
#include
<archive.h>
...
...
@@ -269,6 +270,8 @@ bool JamiPluginManager::loadPlugin(const std::string &rootPath)
bool
status
=
pm_
.
load
(
getPluginDetails
(
rootPath
).
at
(
"soPath"
));
JAMI_INFO
()
<<
"PLUGIN: load status - "
<<
status
;
jami
::
Manager
::
instance
().
pluginPreferences
.
saveStateLoadedPlugins
(
rootPath
,
status
);
jami
::
Manager
::
instance
().
saveConfig
();
return
status
;
}
catch
(
const
std
::
exception
&
e
)
...
...
@@ -285,6 +288,9 @@ bool JamiPluginManager::unloadPlugin(const std::string &rootPath)
bool
status
=
pm_
.
unload
(
getPluginDetails
(
rootPath
).
at
(
"soPath"
));
JAMI_INFO
()
<<
"PLUGIN: unload status - "
<<
status
;
jami
::
Manager
::
instance
().
pluginPreferences
.
saveStateLoadedPlugins
(
rootPath
,
false
);
jami
::
Manager
::
instance
().
saveConfig
();
return
status
;
}
catch
(
const
std
::
exception
&
e
)
{
...
...
src/plugin/jamipluginmanager.h
View file @
0b7a9787
/*
* Copyright (C) 2004-2020 Savoir-faire Linux Inc.
* Copyright (C) 2020 Savoir-faire Linux Inc.
*
* 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
...
...
src/preferences.cpp
View file @
0b7a9787
...
...
@@ -3,6 +3,7 @@
*
* Author: Alexandre Savard <alexandre.savard@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
...
...
@@ -146,6 +147,13 @@ static constexpr const char* RECORD_PREVIEW_KEY {"recordPreview"};
static
constexpr
const
char
*
RECORD_QUALITY_KEY
{
"recordQuality"
};
#endif
#ifdef ENABLE_PLUGIN
// plugin preferences
constexpr
const
char
*
const
PluginPreferences
::
CONFIG_LABEL
;
static
constexpr
const
char
*
JAMI_PLUGIN_KEY
{
"pluginsEnabled"
};
static
constexpr
const
char
*
JAMI_PLUGINS_LOADED_KEY
{
"loadedPlugins"
};
#endif
static
constexpr
int
PULSE_LENGTH_DEFAULT
{
250
};
/** Default DTMF length */
#ifndef _MSC_VER
static
constexpr
const
char
*
ALSA_DFT_CARD
{
"0"
};
/** Default sound card index */
...
...
@@ -641,4 +649,36 @@ void VideoPreferences::unserialize(const YAML::Node &in)
}
#endif // ENABLE_VIDEO
#ifdef ENABLE_PLUGIN
PluginPreferences
::
PluginPreferences
()
:
pluginsEnabled_
(
false
)
{}
void
PluginPreferences
::
serialize
(
YAML
::
Emitter
&
out
)
const
{
out
<<
YAML
::
Key
<<
CONFIG_LABEL
<<
YAML
::
Value
<<
YAML
::
BeginMap
;
out
<<
YAML
::
Key
<<
JAMI_PLUGIN_KEY
<<
YAML
::
Value
<<
pluginsEnabled_
;
out
<<
YAML
::
Key
<<
JAMI_PLUGINS_LOADED_KEY
<<
YAML
::
Value
<<
loadedPlugins_
;
out
<<
YAML
::
EndMap
;
}
void
PluginPreferences
::
unserialize
(
const
YAML
::
Node
&
in
)
{
// values may or may not be present
const
auto
&
node
=
in
[
CONFIG_LABEL
];
try
{
parseValue
(
node
,
JAMI_PLUGIN_KEY
,
pluginsEnabled_
);
}
catch
(...)
{
pluginsEnabled_
=
false
;
}
const
auto
&
loadedPluginsNode
=
node
[
JAMI_PLUGINS_LOADED_KEY
];
try
{
loadedPlugins_
=
yaml_utils
::
parseVector
(
loadedPluginsNode
);
}
catch
(...)
{
// loadedPlugins_ = {};
}
}
#endif // ENABLE_PLUGIN
}
// namespace jami
src/preferences.h
View file @
0b7a9787
...
...
@@ -3,6 +3,7 @@
*
* Author: Alexandre Savard <alexandre.savard@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
...
...
@@ -26,6 +27,7 @@
#include
"client/ring_signal.h"
#include
<string>
#include
<map>
#include
<set>
#include
<vector>
namespace
YAML
{
...
...
@@ -522,6 +524,46 @@ class VideoPreferences : public Serializable {
};
#endif // ENABLE_VIDEO
#ifdef ENABLE_PLUGIN
class
PluginPreferences
:
public
Serializable
{
public:
PluginPreferences
();
void
serialize
(
YAML
::
Emitter
&
out
)
const
override
;
void
unserialize
(
const
YAML
::
Node
&
in
)
override
;
bool
getPluginsEnabled
()
const
{
return
pluginsEnabled_
;
}
void
setPluginsEnabled
(
bool
pluginsEnabled
)
{
pluginsEnabled_
=
pluginsEnabled
;
}
std
::
vector
<
std
::
string
>
getLoadedPlugins
()
const
{
std
::
vector
<
std
::
string
>
v
(
loadedPlugins_
.
begin
(),
loadedPlugins_
.
end
());
return
v
;
}
void
saveStateLoadedPlugins
(
std
::
string
plugin
,
bool
loaded
)
{
if
(
loaded
)
{
if
(
loadedPlugins_
.
find
(
plugin
)
!=
loadedPlugins_
.
end
())
return
;
loadedPlugins_
.
emplace
(
plugin
);
}
else
{
auto
it
=
loadedPlugins_
.
find
(
plugin
);
if
(
it
!=
loadedPlugins_
.
end
())
loadedPlugins_
.
erase
(
it
);
}
}
private:
bool
pluginsEnabled_
;
std
::
set
<
std
::
string
>
loadedPlugins_
;
constexpr
static
const
char
*
const
CONFIG_LABEL
=
"plugins"
;
};
#endif // ENABLE_PLUGIN
}
// namespace jami
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment