diff options
author | George Hazan <ghazan@miranda.im> | 2017-12-11 13:45:13 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-12-11 13:45:13 +0300 |
commit | a569fea827be7c1719f3eaca1d8b33d82d4b7889 (patch) | |
tree | cf9bd4461fb700002ec1278623eab7070bdbce1e | |
parent | d2e79ad0a421f2cc20c35f848e823d707f1f53d3 (diff) |
code cleaning
-rw-r--r-- | include/m_core.h | 6 | ||||
-rw-r--r-- | include/m_langpack.h | 6 | ||||
-rw-r--r-- | src/mir_app/src/newplugins.cpp | 42 |
3 files changed, 22 insertions, 32 deletions
diff --git a/include/m_core.h b/include/m_core.h index 6438116551..1f2d328e92 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -545,12 +545,6 @@ MIR_CORE_DLL(BOOL) IsScreenSaverRunning(); MIR_CORE_DLL(BOOL) GetOSDisplayString(wchar_t *buf, size_t bufSize);
-/////////////////////////////////////////////////////////////////////////////////////////
-// retrieves the hLangpack of a plugin by its HINSTANCE
-// returns hLangpack if found, or 0 if error occurred
-
-MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE);
-
///////////////////////////////////////////////////////////////////////////////
MIR_CORE_DLL(void) UnloadCoreModule(void);
diff --git a/include/m_langpack.h b/include/m_langpack.h index 7d97d36499..45e408a499 100644 --- a/include/m_langpack.h +++ b/include/m_langpack.h @@ -92,6 +92,12 @@ EXTERN_C MIR_CORE_DLL(int) Langpack_GetDefaultLocale(void); EXTERN_C MIR_CORE_DLL(wchar_t*) Langpack_PcharToTchar(const char *pszStr);
/////////////////////////////////////////////////////////////////////////////////////////
+// retrieves the hLangpack of a plugin by its HINSTANCE
+// returns hLangpack if found, or 0 if error occurred
+
+EXTERN_C MIR_APP_DLL(int) GetPluginLangByInstance(HINSTANCE);
+
+/////////////////////////////////////////////////////////////////////////////////////////
// reloads langpack
// wParam = 0 (ignored)
// lParam = (LPARAM)(wchar_t*)langpack file name or NULL to reload the current one
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 9d19dedc54..aa74284892 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -39,20 +39,13 @@ static int sttComparePluginsByName(const pluginEntry* p1, const pluginEntry* p2) }
LIST<pluginEntry>
- pluginList(10, sttComparePluginsByName),
- servicePlugins(5, sttComparePluginsByName),
- clistPlugins(5, sttComparePluginsByName);
+pluginList(10, sttComparePluginsByName),
+servicePlugins(5, sttComparePluginsByName),
+clistPlugins(5, sttComparePluginsByName);
/////////////////////////////////////////////////////////////////////////////////////////
MUUID miid_last = MIID_LAST;
-MUUID miid_srmm = MIID_SRMM;
-MUUID miid_clist = MIID_CLIST;
-MUUID miid_database = MIID_DATABASE;
-MUUID miid_protocol = MIID_PROTOCOL;
-MUUID miid_servicemode = MIID_SERVICEMODE;
-MUUID miid_crypto = MIID_CRYPTO;
-MUUID miid_ssl = MIID_SSL;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -73,7 +66,7 @@ static pluginEntry *plugin_freeimg, *plugin_crshdmp, *serviceModePlugin, *plugin /////////////////////////////////////////////////////////////////////////////////////////
// basic functions
-bool hasMuuid(const MUUID* p, const MUUID& uuid)
+bool hasMuuid(const MUUID *p, const MUUID &uuid)
{
if (p == nullptr)
return false;
@@ -85,7 +78,7 @@ bool hasMuuid(const MUUID* p, const MUUID& uuid) return false;
}
-bool hasMuuid(const BASIC_PLUGIN_INFO& bpi, const MUUID& uuid)
+bool hasMuuid(const BASIC_PLUGIN_INFO &bpi, const MUUID &uuid)
{
if (bpi.Interfaces)
return hasMuuid(bpi.Interfaces, uuid);
@@ -344,7 +337,7 @@ void Plugin_Uninit(pluginEntry *p) FreeLibrary(hInst);
memset(&p->bpi, 0, sizeof(p->bpi));
}
-
+
if (p == plugin_crshdmp)
plugin_crshdmp = nullptr;
pluginList.remove(p);
@@ -448,8 +441,8 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) }
// plugin declared that it's a database or a cryptor. load it asap!
- bool bIsDb = hasMuuid(pIds, miid_database);
- if (bIsDb || hasMuuid(pIds, miid_crypto)) {
+ bool bIsDb = hasMuuid(pIds, MIID_DATABASE);
+ if (bIsDb || hasMuuid(pIds, MIID_CRYPTO)) {
BASIC_PLUGIN_INFO bpi;
if (checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
// plugin is valid
@@ -466,24 +459,24 @@ pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path) else p->pclass |= PCLASS_FAILED;
}
// plugin declared that it's a contact list. mark it for the future load
- else if (hasMuuid(pIds, miid_clist)) {
+ else if (hasMuuid(pIds, MIID_CLIST)) {
// keep a note of this plugin for later
clistPlugins.insert(p);
p->pclass |= PCLASS_CLIST;
}
// plugin declared that it's a ssl provider. mark it for the future load
- else if (hasMuuid(pIds, miid_ssl)) {
+ else if (hasMuuid(pIds, MIID_SSL)) {
plugin_ssl = p;
p->pclass |= PCLASS_LAST;
}
// plugin declared that it's a service mode plugin.
// load it for a profile manager's window
- else if (hasMuuid(pIds, miid_servicemode)) {
+ else if (hasMuuid(pIds, MIID_SERVICEMODE)) {
BASIC_PLUGIN_INFO bpi;
if (checkAPI(tszFullPath, &bpi, mirandaVersion, CHECKAPI_NONE)) {
p->pclass |= (PCLASS_OK | PCLASS_BASICAPI);
p->bpi = bpi;
- if (hasMuuid(bpi, miid_servicemode)) {
+ if (hasMuuid(bpi, MIID_SERVICEMODE)) {
p->pclass |= (PCLASS_SERVICE);
servicePlugins.insert(p);
}
@@ -756,18 +749,15 @@ void EnsureCheckerLoaded(bool bEnable) int LoadSslModule(void)
{
bool bExtSSLLoaded = false;
-
- if (plugin_ssl != nullptr)
- {
- if (!TryLoadPlugin(plugin_ssl, false))
- {
+
+ if (plugin_ssl != nullptr) {
+ if (!TryLoadPlugin(plugin_ssl, false)) {
Plugin_Uninit(plugin_ssl);
}
else
bExtSSLLoaded = true;
}
- if (!bExtSSLLoaded)
- {
+ if (!bExtSSLLoaded) {
MuuidReplacement stdSsl = { MIID_SSL, L"stdssl", nullptr };
if (!LoadCorePlugin(stdSsl))
return 1;
|