diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-22 00:15:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-22 00:15:20 +0300 |
commit | 77a0dc234e1925173a8944e9e641d72d9fe39aba (patch) | |
tree | f9b053818a579cc2f9f63ab964d546532403d582 /src | |
parent | 7f37f113f29dfba362269266be7c751aaf87851f (diff) |
awful crutch for Pascal plugins to use pseudo-constructor a la CMPlugin
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/CMPluginBase.cpp | 25 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 13 |
4 files changed, 29 insertions, 13 deletions
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index bcc1601967..4476db9c38 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -74,6 +74,15 @@ MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang) return 0; } +MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid) +{ + for (auto &it : pluginListAddr) + if (it->getInfo().uuid == uuid) + return it->getInst() != nullptr; + + return false; +} + char* GetPluginNameByInstance(HINSTANCE hInst) { CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst); @@ -93,6 +102,22 @@ MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInst) } ///////////////////////////////////////////////////////////////////////////////////////// +// stubs for pascal plugins + +EXTERN_C MIR_APP_DLL(void) RegisterPlugin(CMPluginBase *pPlugin) +{ + if (pPlugin->getInst() != nullptr) + pluginListAddr.insert(pPlugin); + + mir_getLP(&pPlugin->getInfo(), &pPlugin->m_hLang); +} + +EXTERN_C MIR_APP_DLL(void) UnregisterPlugin(CMPluginBase *pPlugin) +{ + pluginListAddr.remove(pPlugin); +} + +///////////////////////////////////////////////////////////////////////////////////////// CMPluginBase::CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo) : m_szModuleName(moduleName), diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index d586787cc3..4419a6009f 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -600,3 +600,5 @@ GetPluginByInstance @626 ?openOptions@CMPluginBase@@QAEXPB_W00@Z @629 NONAME
?openOptionsPage@CMPluginBase@@QAEXPB_W00@Z @630 NONAME
?getInfo@CMPluginBase@@QBEABUPLUGININFOEX@@XZ @631 NONAME
+RegisterPlugin @632
+UnregisterPlugin @633
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 9124e6c95f..219835d093 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -600,3 +600,5 @@ GetPluginByInstance @626 ?openOptions@CMPluginBase@@QEAAXPEB_W00@Z @629 NONAME
?openOptionsPage@CMPluginBase@@QEAAXPEB_W00@Z @630 NONAME
?getInfo@CMPluginBase@@QEBAAEBUPLUGININFOEX@@XZ @631 NONAME
+RegisterPlugin @632
+UnregisterPlugin @633
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 46ffe1a449..6ed202455e 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -174,19 +174,6 @@ int LoadStdPlugins() /////////////////////////////////////////////////////////////////////////////////////////
// global functions
-MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid)
-{
- for (auto &p : pluginList) {
- if (!p->bpi.hInst)
- continue;
-
- if (p->bpi.pluginInfo->uuid == uuid)
- return true;
- }
-
- return false;
-}
-
static bool validInterfaceList(MUUID *piface)
{
if (piface == nullptr)
|