summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-05-21 23:06:27 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-05-21 23:06:27 +0300
commit7f37f113f29dfba362269266be7c751aaf87851f (patch)
tree1dc78e4270764684117dc09f3742694f39fd12a4 /src/mir_app
parent12f0d4103b52168304ceb1f186f92a7811761a1a (diff)
unused field pluginEntry::hLangpack removed, functions that used it switched to CMPluginBase
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/CMPluginBase.cpp12
-rw-r--r--src/mir_app/src/menu_options.cpp3
-rw-r--r--src/mir_app/src/miranda.h1
-rw-r--r--src/mir_app/src/newplugins.cpp38
-rw-r--r--src/mir_app/src/plugins.h1
5 files changed, 15 insertions, 40 deletions
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index f7bf33cb63..bcc1601967 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -74,12 +74,24 @@ MIR_APP_DLL(int) GetPluginLangId(const MUUID &uuid, int _hLang)
return 0;
}
+char* GetPluginNameByInstance(HINSTANCE hInst)
+{
+ CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst);
+ return (pPlugin == nullptr) ? nullptr : pPlugin->getInfo().shortName;
+}
+
MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst)
{
CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst);
return (pPlugin == nullptr) ? g_plugin : *pPlugin;
}
+MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInst)
+{
+ CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst);
+ return (pPlugin == nullptr) ? 0 : pPlugin->m_hLang;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
CMPluginBase::CMPluginBase(const char *moduleName, const PLUGININFOEX &pInfo) :
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp
index 59b5df0a74..63e16e61ab 100644
--- a/src/mir_app/src/menu_options.cpp
+++ b/src/mir_app/src/menu_options.cpp
@@ -506,7 +506,8 @@ public:
m_service.SetTextA(szText);
}
- m_module.SetTextA(GetPluginNameByLangpack(iod->pimi->mi.langId));
+ CMPluginBase *pPlugin = GetPluginByLangId(iod->pimi->mi.langId);
+ m_module.SetTextA(pPlugin == nullptr ? "" : pPlugin->getInfo().shortName);
m_btnInsMenu.Enable(iod->pimi->mi.root == nullptr);
m_btnDefault.Enable(mir_wstrcmp(iod->name, iod->defname) != 0);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 786b744f3d..a3fb7f89c1 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -72,7 +72,6 @@ extern bool bModulesLoadedFired;
/**** newplugins.cpp *******************************************************************/
-char* GetPluginNameByLangpack(int _hLang);
char* GetPluginNameByInstance(HINSTANCE hInstance);
int LoadStdPlugins(void);
int LaunchServicePlugin(pluginEntry *p);
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 9de7b616d0..46ffe1a449 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -174,42 +174,6 @@ int LoadStdPlugins()
/////////////////////////////////////////////////////////////////////////////////////////
// global functions
-char* GetPluginNameByLangpack(int _hLang)
-{
- if (pluginList.getCount() == 0 || _hLang == 0)
- return "";
-
- for (auto &p : pluginList)
- if (p->hLangpack == _hLang)
- return p->bpi.pluginInfo->shortName;
-
- return "";
-}
-
-char* GetPluginNameByInstance(HINSTANCE hInstance)
-{
- if (pluginList.getCount() == 0)
- return nullptr;
-
- for (auto &p : pluginList)
- if (p->bpi.pluginInfo && p->bpi.hInst == hInstance)
- return p->bpi.pluginInfo->shortName;
-
- return nullptr;
-}
-
-MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE hInstance)
-{
- if (pluginList.getCount() == 0)
- return 0;
-
- for (auto &p : pluginList)
- if (p->bpi.pluginInfo && p->bpi.hInst == hInstance)
- return p->hLangpack;
-
- return 0;
-}
-
MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid)
{
for (auto &p : pluginList) {
@@ -343,7 +307,7 @@ int Plugin_UnloadDyn(pluginEntry *p)
KillModuleServices(p->bpi.hInst);
}
- int _hLang = p->hLangpack;
+ int _hLang = GetPluginLangByInstance(p->bpi.hInst);
if (_hLang != 0) {
KillModuleMenus(_hLang);
KillModuleFonts(_hLang);
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h
index f28f7fa5d8..08b5c63eda 100644
--- a/src/mir_app/src/plugins.h
+++ b/src/mir_app/src/plugins.h
@@ -48,7 +48,6 @@ struct pluginEntry
bool bIsCrypto : 1; // crypto provider
};
- int hLangpack;
BASIC_PLUGIN_INFO bpi;
};