agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 1 | /** |
| 2 | * Copyright (C) 2020 Savoir-faire Linux Inc. |
| 3 | * |
| 4 | * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 19 | */ |
| 20 | |
| 21 | #include <iostream> |
| 22 | #include <string.h> |
| 23 | #include <thread> |
| 24 | #include <memory> |
| 25 | #include <plugin/jamiplugin.h> |
| 26 | |
| 27 | #include "CenterCircleMediaHandler.h" |
| 28 | #include "CoinCircleMediaHandler.h" |
| 29 | |
| 30 | #ifdef WIN32 |
| 31 | #define EXPORT_PLUGIN __declspec(dllexport) |
| 32 | #else |
| 33 | #define EXPORT_PLUGIN |
| 34 | #endif |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame^] | 35 | |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 36 | #define HelloWorld_VERSION_MAJOR 1 |
| 37 | #define HelloWorld_VERSION_MINOR 0 |
agsantos | c9181b4 | 2020-11-26 12:03:04 -0500 | [diff] [blame^] | 38 | #define HelloWorld_VERSION_PATCH 1 |
| 39 | |
agsantos | d09cc6d | 2020-11-06 17:34:46 -0500 | [diff] [blame] | 40 | extern "C" { |
| 41 | void |
| 42 | pluginExit(void) |
| 43 | {} |
| 44 | |
| 45 | EXPORT_PLUGIN JAMI_PluginExitFunc |
| 46 | JAMI_dynPluginInit(const JAMI_PluginAPI* api) |
| 47 | { |
| 48 | std::cout << "**************************" << std::endl << std::endl; |
| 49 | std::cout << "** HelloWorld **" << std::endl; |
| 50 | std::cout << "**************************" << std::endl << std::endl; |
| 51 | std::cout << " Version " << HelloWorld_VERSION_MAJOR << "." << HelloWorld_VERSION_MINOR << "." |
| 52 | << HelloWorld_VERSION_PATCH << std::endl; |
| 53 | |
| 54 | // If invokeService doesn't return an error |
| 55 | if (api) { |
| 56 | std::map<std::string, std::string> ppm; |
| 57 | api->invokeService(api, "getPluginPreferences", &ppm); |
| 58 | std::string dataPath; |
| 59 | api->invokeService(api, "getPluginDataPath", &dataPath); |
| 60 | |
| 61 | auto fmpCenterCircleMediaHandler |
| 62 | = std::make_unique<jami::CenterCircleMediaHandler>(std::move(ppm), std::move(dataPath)); |
| 63 | if (api->manageComponent(api, |
| 64 | "CallMediaHandlerManager", |
| 65 | fmpCenterCircleMediaHandler.release())) { |
| 66 | return nullptr; |
| 67 | } |
| 68 | |
| 69 | auto fmpCoinCircleMediaHandler |
| 70 | = std::make_unique<jami::CoinCircleMediaHandler>(std::move(ppm), std::move(dataPath)); |
| 71 | if (api->manageComponent(api, |
| 72 | "CallMediaHandlerManager", |
| 73 | fmpCoinCircleMediaHandler.release())) { |
| 74 | return nullptr; |
| 75 | } |
| 76 | } |
| 77 | return pluginExit; |
| 78 | } |
| 79 | } |