agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 1 | HEADER |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 2 | |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 3 | #include <iostream> |
| 4 | #include <string.h> |
| 5 | #include <thread> |
| 6 | #include <memory> |
| 7 | #include <plugin/jamiplugin.h> |
| 8 | ---------------- |
| 9 | #include "INCLUDESAPI.h"---------------- |
| 10 | |
| 11 | #ifdef WIN32 |
| 12 | #define EXPORT_PLUGIN __declspec(dllexport) |
| 13 | #else |
| 14 | #define EXPORT_PLUGIN |
| 15 | #endif |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 16 | |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 17 | #define PLUGINNAME_VERSION_MAJOR PLUGINVERSIONMAJOR |
| 18 | #define PLUGINNAME_VERSION_MINOR PLUGINVERSIONMINOR |
| 19 | #define PLUGINNAME_VERSION_PATCH PLUGINVERSIONPATCH |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame] | 20 | |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 21 | extern "C" { |
| 22 | |
| 23 | void |
| 24 | pluginExit(void) |
| 25 | {} |
| 26 | |
| 27 | EXPORT_PLUGIN JAMI_PluginExitFunc |
| 28 | JAMI_dynPluginInit(const JAMI_PluginAPI* api) |
| 29 | { |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 30 | std::cout << "**************************" << std::endl; |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 31 | std::cout << "** PLUGINNAME **" << std::endl; |
| 32 | std::cout << "**************************" << std::endl << std::endl; |
agsantos | 4bb4bc5 | 2021-03-08 14:21:45 -0500 | [diff] [blame] | 33 | std::cout << "Version " << PLUGINNAME_VERSION_MAJOR << "." << PLUGINNAME_VERSION_MINOR << "." |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 34 | << PLUGINNAME_VERSION_PATCH << std::endl; |
| 35 | |
| 36 | // If invokeService doesn't return an error |
| 37 | if (api) { |
agsantos | 82678f3 | 2020-12-09 15:03:24 -0500 | [diff] [blame] | 38 | std::map<std::string, std::string> preferences; |
| 39 | api->invokeService(api, "getPluginPreferences", &preferences); |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 40 | std::string dataPath; |
| 41 | api->invokeService(api, "getPluginDataPath", &dataPath); |
| 42 | ---------------- |
agsantos | 82678f3 | 2020-12-09 15:03:24 -0500 | [diff] [blame] | 43 | auto fmpPLUGINAPI = std::make_unique<jami::PLUGINAPI>(CHATHANDLERstd::move(preferences), std::move(dataPath)); |
agsantos | 1e7736c | 2020-10-28 14:39:13 -0400 | [diff] [blame] | 44 | if (api->manageComponent(api, "APIMANAGER", fmpPLUGINAPI.release())) { |
| 45 | return nullptr; |
| 46 | } |
| 47 | ---------------- |
| 48 | } |
| 49 | return pluginExit; |
| 50 | } |
| 51 | } |