diff options
author | George Hazan <ghazan@miranda.im> | 2018-05-21 22:53:14 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-05-21 22:53:14 +0300 |
commit | 12f0d4103b52168304ceb1f186f92a7811761a1a (patch) | |
tree | d075b08563032845a0c95288f0d479be9bc45316 /src/mir_app | |
parent | 49600428c7c70b765432d0d6beb6f3a53f95692d (diff) |
GetPluginLangId() rewritten using CMPlugin
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/CMPluginBase.cpp | 18 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 1 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 17 |
4 files changed, 18 insertions, 19 deletions
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index d75e34ac09..f7bf33cb63 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "stdafx.h" +#include "plugins.h" +static int sttFakeID = -100; static LIST<CMPluginBase> pluginListAddr(10, HandleKeySortT); void RegisterModule(CMPluginBase *pPlugin) @@ -60,6 +62,18 @@ MIR_APP_DLL(CMPluginBase*) GetPluginByLangId(int _hLang) return nullptr; } +MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang) +{ + if (uuid == miid_last) + return --sttFakeID; + + for (auto &it : pluginListAddr) + if (it->getInfo().uuid == uuid) + return (_hLang) ? _hLang : --sttFakeID; + + return 0; +} + MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst) { CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst); @@ -72,10 +86,10 @@ CMPluginBase::CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo) : m_szModuleName(moduleName), m_pInfo(pInfo) { - mir_getLP(&pInfo, &m_hLang); - if (m_hInst != nullptr) pluginListAddr.insert(this); + + mir_getLP(&pInfo, &m_hLang); } CMPluginBase::~CMPluginBase() diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 1fb62d69ed..d586787cc3 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -599,3 +599,4 @@ GetPluginByInstance @626 ?addOptions@CMPluginBase@@QAEHIPAUOPTIONSDIALOGPAGE@@@Z @628 NONAME
?openOptions@CMPluginBase@@QAEXPB_W00@Z @629 NONAME
?openOptionsPage@CMPluginBase@@QAEXPB_W00@Z @630 NONAME
+?getInfo@CMPluginBase@@QBEABUPLUGININFOEX@@XZ @631 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 6d4ca9c44a..9124e6c95f 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -599,3 +599,4 @@ GetPluginByInstance @626 ?addOptions@CMPluginBase@@QEAAH_KPEAUOPTIONSDIALOGPAGE@@@Z @628 NONAME
?openOptions@CMPluginBase@@QEAAXPEB_W00@Z @629 NONAME
?openOptionsPage@CMPluginBase@@QEAAXPEB_W00@Z @630 NONAME
+?getInfo@CMPluginBase@@QEBAAEBUPLUGININFOEX@@XZ @631 NONAME
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 262d3adc30..9de7b616d0 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -56,7 +56,6 @@ static BOOL bModuleInitialized = FALSE; wchar_t mirandabootini[MAX_PATH];
static DWORD mirandaVersion;
-static int sttFakeID = -100;
static int askAboutIgnoredPlugins;
pluginEntry *plugin_crshdmp, *plugin_service, *plugin_ssl, *plugin_clist;
@@ -211,22 +210,6 @@ MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance) return 0;
}
-MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang)
-{
- if (uuid == miid_last)
- return --sttFakeID;
-
- for (auto &p : pluginList) {
- if (!p->bpi.hInst)
- continue;
-
- if (p->bpi.pluginInfo->uuid == uuid)
- return p->hLangpack = (_hLang) ? _hLang : --sttFakeID;
- }
-
- return 0;
-}
-
MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid)
{
for (auto &p : pluginList) {
|