aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2019-03-11 19:39:06 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2019-03-11 19:39:06 +0200
commit95d92e52ed6d71c21433b382f8a178a04b04954b (patch)
treef7fba616df7a94de37003be7180976bbcc5b87f2 /src/main.cpp
parentrepl: import python module (diff)
downloadsmolbote-95d92e52ed6d71c21433b382f8a178a04b04954b.tar.xz
Add PluginLoader class
- PluginLoader::verify can be used to check if the plugin has a valid (SHA512/RSA 4096) signature. - Uses nn OpenSSL public key that is embedded during the compile.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index dfe58de..0d6f466 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -18,6 +18,7 @@
#include <QFile>
#include <QLibraryInfo>
#include <QPluginLoader>
+#include "plugin/pluginloader.h"
#include <QTranslator>
#include <memory>
#include <plugininterface.h>
@@ -69,8 +70,9 @@ int main(int argc, char **argv)
CommandHash_t pluginCommands;
// Load plugins
- for(const QString &path : Util::files(config->value<QString>("plugins.path").value())) {
- auto *loader = new QPluginLoader(path);
+ for(const QString &path : Util::files(config->value<QString>("plugins.path").value(), {"*.so", "*.dll"})) {
+ auto *loader = new PluginLoader(path);
+ spdlog::info("Verifying plugin: {}", loader->verify() ? "passed" : "failed");
const bool loaded = loader->load();
spdlog::info("{} plugin {}", loaded ? "Loaded" : "Failed to load", qUtf8Printable(path));