blob: abca25bd47e5d7f4f8eeaa2cf236b32259c43bf7 [file] [log] [blame]
agsantos1e7736c2020-10-28 14:39:13 -04001HEADER
agsantosc9181b42020-11-26 12:03:04 -05002
agsantos1e7736c2020-10-28 14:39:13 -04003#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
agsantosc9181b42020-11-26 12:03:04 -050016
agsantos1e7736c2020-10-28 14:39:13 -040017#define PLUGINNAME_VERSION_MAJOR PLUGINVERSIONMAJOR
18#define PLUGINNAME_VERSION_MINOR PLUGINVERSIONMINOR
19#define PLUGINNAME_VERSION_PATCH PLUGINVERSIONPATCH
agsantosc9181b42020-11-26 12:03:04 -050020
agsantos1e7736c2020-10-28 14:39:13 -040021extern "C" {
22
23void
24pluginExit(void)
25{}
26
27EXPORT_PLUGIN JAMI_PluginExitFunc
28JAMI_dynPluginInit(const JAMI_PluginAPI* api)
29{
agsantos4bb4bc52021-03-08 14:21:45 -050030 std::cout << "**************************" << std::endl;
agsantos1e7736c2020-10-28 14:39:13 -040031 std::cout << "** PLUGINNAME **" << std::endl;
32 std::cout << "**************************" << std::endl << std::endl;
agsantos4bb4bc52021-03-08 14:21:45 -050033 std::cout << "Version " << PLUGINNAME_VERSION_MAJOR << "." << PLUGINNAME_VERSION_MINOR << "."
agsantos1e7736c2020-10-28 14:39:13 -040034 << PLUGINNAME_VERSION_PATCH << std::endl;
35
36 // If invokeService doesn't return an error
37 if (api) {
agsantos82678f32020-12-09 15:03:24 -050038 std::map<std::string, std::string> preferences;
39 api->invokeService(api, "getPluginPreferences", &preferences);
agsantos1e7736c2020-10-28 14:39:13 -040040 std::string dataPath;
41 api->invokeService(api, "getPluginDataPath", &dataPath);
42----------------
agsantos82678f32020-12-09 15:03:24 -050043 auto fmpPLUGINAPI = std::make_unique<jami::PLUGINAPI>(CHATHANDLERstd::move(preferences), std::move(dataPath));
agsantos1e7736c2020-10-28 14:39:13 -040044 if (api->manageComponent(api, "APIMANAGER", fmpPLUGINAPI.release())) {
45 return nullptr;
46 }
47----------------
48 }
49 return pluginExit;
50}
51}