diff options
author | George Hazan <george.hazan@gmail.com> | 2014-10-04 19:18:26 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-10-04 19:18:26 +0000 |
commit | 3f6232a496649a70ee5d2e1027072723d4171948 (patch) | |
tree | 9d17ba103d7694a2d5e28d70e51d70031f2c9241 /protocols/MRA | |
parent | e1fe110fbc06e243230ccaf885f292d80fc99f79 (diff) |
MRA:
- global variable went into a class;
- warning fixes
- code cleaning;
git-svn-id: http://svn.miranda-ng.org/main/trunk@10691 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/Mra_10.vcxproj | 4 | ||||
-rw-r--r-- | protocols/MRA/Mra_12.vcxproj | 12 | ||||
-rw-r--r-- | protocols/MRA/src/Mra.cpp | 16 | ||||
-rw-r--r-- | protocols/MRA/src/Mra.h | 9 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.cpp | 3 | ||||
-rw-r--r-- | protocols/MRA/src/MraProto.h | 3 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 6 |
8 files changed, 28 insertions, 29 deletions
diff --git a/protocols/MRA/Mra_10.vcxproj b/protocols/MRA/Mra_10.vcxproj index 8d1a43849f..1c4e94b1ec 100644 --- a/protocols/MRA/Mra_10.vcxproj +++ b/protocols/MRA/Mra_10.vcxproj @@ -82,6 +82,7 @@ <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
@@ -108,6 +109,7 @@ <PrecompiledHeaderFile>Mra.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -135,6 +137,7 @@ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<PrecompiledHeaderFile>Mra.h</PrecompiledHeaderFile>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
@@ -167,6 +170,7 @@ <EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<PrecompiledHeaderFile>Mra.h</PrecompiledHeaderFile>
<ExceptionHandling>false</ExceptionHandling>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
diff --git a/protocols/MRA/Mra_12.vcxproj b/protocols/MRA/Mra_12.vcxproj index 50559fa9a4..e3f3ee9e57 100644 --- a/protocols/MRA/Mra_12.vcxproj +++ b/protocols/MRA/Mra_12.vcxproj @@ -86,6 +86,9 @@ <WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <UndefinePreprocessorDefinitions>
+ </UndefinePreprocessorDefinitions>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
@@ -113,6 +116,9 @@ <PrecompiledHeaderFile>Mra.h</PrecompiledHeaderFile>
<WarningLevel>Level3</WarningLevel>
<AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <UndefinePreprocessorDefinitions>
+ </UndefinePreprocessorDefinitions>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@@ -140,6 +146,9 @@ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<PrecompiledHeaderFile>Mra.h</PrecompiledHeaderFile>
+ <UndefinePreprocessorDefinitions>
+ </UndefinePreprocessorDefinitions>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<AdditionalManifestDependencies>type=%27Win32%27 name=%27Microsoft.Windows.Common-Controls%27 version=%276.0.0.0%27 processorArchitecture=%27X86%27 publicKeyToken=%276595b64144ccf1df%27 language=%27*%27;%(AdditionalManifestDependencies)</AdditionalManifestDependencies>
@@ -172,6 +181,9 @@ <PrecompiledHeaderFile>Mra.h</PrecompiledHeaderFile>
<ExceptionHandling>false</ExceptionHandling>
<AssemblerOutput>AssemblyAndSourceCode</AssemblerOutput>
+ <UndefinePreprocessorDefinitions>
+ </UndefinePreprocessorDefinitions>
+ <DisableSpecificWarnings>4312;4267</DisableSpecificWarnings>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
diff --git a/protocols/MRA/src/Mra.cpp b/protocols/MRA/src/Mra.cpp index 498a701dc5..13d8ee091f 100644 --- a/protocols/MRA/src/Mra.cpp +++ b/protocols/MRA/src/Mra.cpp @@ -23,7 +23,6 @@ HINSTANCE g_hInstance; HMODULE g_hDLLXStatusIcons;
HICON g_hMainIcon;
-DWORD g_dwGlobalPluginRunning;
bool g_bChatExist;
size_t g_dwMirWorkDirPathLen;
@@ -71,18 +70,6 @@ static int mraProtoUninit(CMraProto *ppro) ///////////////////////////////////////////////////////////////////////////////
-static int OnModulesLoaded(WPARAM, LPARAM)
-{
- g_dwGlobalPluginRunning = TRUE;
- return 0;
-}
-
-static int OnPreShutdown(WPARAM, LPARAM)
-{
- g_dwGlobalPluginRunning = FALSE;
- return 0;
-}
-
extern "C" __declspec(dllexport) int Load(void)
{
mir_getLP(&pluginInfoEx);
@@ -91,9 +78,6 @@ extern "C" __declspec(dllexport) int Load(void) IconsLoad();
InitXStatusIcons();
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
-
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "MRA";
pd.type = PROTOTYPE_PROTOCOL;
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h index a5d6d5d437..b34a378b36 100644 --- a/protocols/MRA/src/Mra.h +++ b/protocols/MRA/src/Mra.h @@ -6,8 +6,6 @@ #define _CRT_SECURE_NO_WARNINGS
-#pragma warning(disable:4267 4312)
-
//#define CRTDLL
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
@@ -146,13 +144,13 @@ __forceinline BinBuffer& operator >>(BinBuffer& buf, CMStringW &sVar) { buf.get bool DB_GetStaticStringA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
bool DB_GetStaticStringW(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPWSTR lpszRetBuff, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
-
+
bool DB_GetStringA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringA &Ret);
bool DB_GetStringW(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, CMStringW &Ret);
-
+
bool DB_SetStringExA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringA &value);
bool DB_SetStringExW(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, const CMStringW &value);
-
+
bool DB_GetContactSettingBlob(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueName, LPVOID lpRet, size_t dwRetBuffSize, size_t *pdwRetBuffSize);
#include "MraConstans.h"
@@ -179,7 +177,6 @@ extern HINSTANCE g_hInstance; extern HMODULE g_hDLLXStatusIcons;
extern HICON g_hMainIcon;
-extern DWORD g_dwGlobalPluginRunning;
extern bool g_bChatExist;
extern size_t g_dwMirWorkDirPathLen;
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 53b9006494..9033c53e01 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -57,7 +57,7 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) : hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", LPGEN("Mail.ru xStatus"), "mra_xstatus25");
hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), MRA_XSTATUS_UNKNOWN_STR);
- bHideXStatusUI = FALSE;
+ m_bHideXStatusUI = false;
m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE);
if ( !IsXStatusValid(m_iXStatus))
m_iXStatus = MRA_MIR_XSTATUS_NONE;
@@ -120,6 +120,7 @@ int CMraProto::OnModulesLoaded(WPARAM, LPARAM) int CMraProto::OnPreShutdown(WPARAM, LPARAM)
{
+ m_bShutdown = true;
SetStatus(ID_STATUS_OFFLINE);
MraAvatarsQueueSuspend(hAvatarsQueueHandle);
return 0;
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h index 39b193b185..177cd8ccee 100644 --- a/protocols/MRA/src/MraProto.h +++ b/protocols/MRA/src/MraProto.h @@ -189,7 +189,8 @@ struct CMraProto : public PROTO<CMraProto> HWND hWndEMailPopupStatus;
DWORD dwEmailMessagesTotal, m_dwEmailMessagesUnread;
- bool bHideXStatusUI;
+ bool m_bShutdown;
+ bool m_bHideXStatusUI;
HGENMENU hXStatusMenuItems[MRA_XSTATUS_COUNT+4], hContactMenuRoot;
HANDLE hExtraXstatusIcon;
HANDLE hExtraInfo;
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp index 48d3c8ccdf..80507cfe4b 100644 --- a/protocols/MRA/src/Mra_proto.cpp +++ b/protocols/MRA/src/Mra_proto.cpp @@ -5,7 +5,7 @@ DWORD CMraProto::StartConnect()
{
- if (!g_dwGlobalPluginRunning)
+ if (m_bShutdown)
return ERROR_OPERATION_ABORTED;
// поток ещё/уже не работал, поставили статус что работает и запускаем
@@ -37,12 +37,12 @@ void CMraProto::MraThreadProc(LPVOID lpParameter) BOOL bConnected = FALSE;
CMStringA szHost;
DWORD dwConnectReTryCount, dwCurConnectReTryCount;
- NETLIBOPENCONNECTION nloc = { 0 };
SleepEx(100, FALSE);// to prevent high CPU load by some status plugins like allwaysonline
dwConnectReTryCount = getDword("ConnectReTryCountMRIM", MRA_DEFAULT_CONN_RETRY_COUNT_MRIM);
+ NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
nloc.flags = NLOCF_V2;
nloc.timeout = getDword("TimeOutConnectMRIM", MRA_DEFAULT_TIMEOUT_CONN_MRIM);
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index bf3c6912ff..28d8d05590 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -436,12 +436,12 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM wParam, LPARAM lParam) // hide menu items
if (pData->flags & CSSF_DISABLE_UI) {
- bHideXStatusUI = (*pData->wParam) ? FALSE : TRUE;
+ m_bHideXStatusUI = (*pData->wParam) ? false : true;
DWORD dwCount = MRA_XSTATUS_OFF_CLI_COUNT;
if (getByte(NULL, "xStatusShowAll", MRA_DEFAULT_SHOW_ALL_XSTATUSES))
dwCount = MRA_XSTATUS_COUNT;
for (DWORD i = 0; i < dwCount; i++)
- Menu_ShowItem(hXStatusMenuItems[i], !bHideXStatusUI);
+ Menu_ShowItem(hXStatusMenuItems[i], !m_bHideXStatusUI);
}
}
return iRet;
@@ -495,7 +495,7 @@ INT_PTR CMraProto::MraGetXStatusEx(WPARAM hContact, LPARAM lParam) }
if ((pData->flags & CSSF_DISABLE_UI) && pData->wParam)
- *pData->wParam = bHideXStatusUI;
+ *pData->wParam = m_bHideXStatusUI;
if ((pData->flags & CSSF_STATUSES_COUNT) && pData->wParam)
*pData->wParam = MRA_XSTATUS_COUNT - 1;
|